[mrtg] Re: Incorrect 'MAX' listed for weekly/monthly/yearly graphs

Alex van den Bogaerdt alex at ergens.op.HET.NET
Wed Jul 17 01:07:52 MEST 2002


Jason Ahrens wrote:

> The above snippet suggests that the max value is kept (presumable for
> showing in max in/out) when from an actual cooked test we can see that it is
> not.
> 
> Does anyone know what is going on with this? Is there any way to make MRTG
> behave in the documented fashion? We would prefer not to turn on WithPeak as
> that would skew the graphs and render them useless for trend analysis.

Without "WithPeaks" you are not seeing maxima.  The numbers below the
image are showing what is in the image --> maximum of all visible lines.

Whether or not "WithPeak" would make the graphs useles for trend analysis
is a discussion I don't want to start (yes, I do disagree) but currently
this seems to be the only way to actually show them on the html page
without fetching the values from the mrtg log yourself.

If you have a look at the logfile format, you'll see that the 4th and 5th
columns store maxima.  If you want to process the log yourself, you can do
it like this:

1) copy the logfile from the start until you find a time stamp you're
   not interested in anymore
2) sort the resulting partial logfile
3) take the first line and extract the number

An example using GNU tools.  There are two things you need to know:
First of all, this example may be not quite right.  For simplicity
I assume the first three lines of the logfile should be skipped. In
reality I'm not sure this is always exactly three lines.  Secondly,
this is not a programming contest so there may be a better way to
actually do the job.  I'm just giving you an example to work with.

1. find the unix-since-epoch time for July 1st:
   date -d 20020701 +%s
   result: 1025474400  (in my time zone)
2. copy the log:
   tail +4 x.log | awk '$1 >= 1025474400'
3. get the 4th column (maximum ifInOctets rate):
   cut -d' ' -f4
4. sort it:
   sort -n
5. take the last line:
   tail -1

Entire command:

tail +4 x.log | awk '$1 >= '`date -d20020701 +%s` | \
                                   cut -d' ' -f4 | sort -n | tail -1

HTH
-- 
   __________________________________________________________________
 / alex at slot.hollandcasino.nl                  alex at ergens.op.het.net \
| work                                                         private |
| My employer is capable of speaking therefore I speak only for myself |
+----------------------------------------------------------------------+
| Technical questions sent directly to me will be nuked. Use the list. | 
+----------------------------------------------------------------------+
| http://faq.mrtg.org/                                                 |
| http://rrdtool.eu.org  --> tutorial                                  |
+----------------------------------------------------------------------+

--
Unsubscribe mailto:mrtg-request at list.ee.ethz.ch?subject=unsubscribe
Archive     http://www.ee.ethz.ch/~slist/mrtg
FAQ         http://faq.mrtg.org    Homepage     http://www.mrtg.org
WebAdmin    http://www.ee.ethz.ch/~slist/lsg2.cgi



More information about the mrtg mailing list