Total Network Usage

George Toft plug-discuss@lists.plug.phoenix.az.us
Thu, 11 Apr 2002 08:38:04 -0400


MRTG has two pieces - the log generator and the graphic builder.  The
log generator is what uses SNMP to create a flat file of data per time 
unit (usually 5 minutes).  The graphic builder will build a graphic
based on the log.  If the log were to be MB of traffic, which was reset
at midnight, then you would get a sawtooth display.  There are entries
in the config file that will set the axis labels, alarm setpoints,
units of measure, time units, etc.

This is a simple exercise that can be satisfied with a 15 line bash or
perl script.  Use cron (MRTG does) to run the script.  Grab the results
of ifconfig eth0, grep for bytes, awk for the numbers, add them up,
subtract off how much there was last time through, and if it is a positive
number (negative number means you rebooted), add it to the last number
in the log, and shove it into the log file.  If the time is midnight, 
remember the value for future calculations.  

The hard part is in the MRTG config files.

George



"der.hans" wrote:
> 
> Am 10. Apr, 2002 schwätzte Bill Nash so:
> 
> >       Depends on the counters you're using. Most SNMP traffic counters
> > are incremental from zero to 2^32 (for 32 bit counters), and reflect a
> > rolling total. When it reaches the limit for the counter, it rolls over to
> > 0 and starts over. Some router and switch vendors do provide rate
> 
> Yeah, I knew I left that out. It'll come up in the SNMP docs :).
> 
> He's not gonna roll the counters over in a day.
> 
> > counters, though. MRTG normal presentation of packets or bits/bytes per
> > second is a time derived value using the different between samples,
> > usually five minutes apart.
> 
> OK, wasn't certain how MRTG works. So can you get it to mark the counters at
> the beginning and end of the day? Maybe change it to average out 24 hours
> rather than 5 min?
> 
> ciao,
> 
> der.hans
> --
> #  This line intentionally left blank.
> #  Motorraeder toeten nicht. Motorraeder werden getoetet.
> 
> ________________________________________________
> See http://PLUG.phoenix.az.us/navigator-mail.shtml if your mail doesn't post to the list quickly and you use Netscape to write mail.
> 
> PLUG-discuss mailing list  -  PLUG-discuss@lists.plug.phoenix.az.us
> http://lists.PLUG.phoenix.az.us/mailman/listinfo/plug-discuss