[mrtg] Data problem with absolute option

Jason Harper Jason.Harper at asu.edu
Thu Jan 15 01:43:48 MET 2004


First off, I use mrtg for bandwidth usage monitoring and it works great
for that (thanks to everyone who has written or contributed to mrtg!)

I'm trying to graph usage activity for a web application.  The
application inserts a row in an SQL table roughly for each transaction.
So, my approach was this:

Create a perl script which counts the number of new records in the table
since the script was last run, prints that value on the first two lines
of output, and then prints two more lines of dummy text (for uptime and
system name).  The output of the perl script looks something like this:

----
257
257
uptime
atrecords
----

Pretty simple.  It is basically a counter that resets to zero whenever
it is run.  This sounds exactly like the "absolute" option in mrtg.  So
here is the relevant section of my mrtg.cfg:

Title[intsite-atrecords]: ASU Interactive AUDIT_TRAIL Activity
MaxBytes[intsite-atrecords]: 1000000
Options[intsite-atrecords]:
perminute,absolute,growright,nopercent,noo,pngdate,noinfo
Target[intsite-atrecords]: `/home/mrtg/getATrecords.pl`
PageTop[intsite-atrecords]: <H1>ASU Interactive AUDIT_TRAIL Activity
(records per minute)
YLegend[intsite-atrecords]: records/minute
ShortLegend[intsite-atrecords]: records/min
Legend1[intsite-atrecords]: Avg Records/minute
Legend2[intsite-atrecords]: Avg Records/minute
Legend3[intsite-atrecords]: Peak/max Records/minute
Legend4[intsite-atrecords]: Peak/max Records/minute
LegendI[intsite-atrecords]: &nbsp;Records/min:
LegendO[intsite-atrecords]: &nbsp;Records/min:
WithPeak[intsite-atrecords]: ymw

Since the values will be smallish, I wanted per-minute counts, not
per-second.  Mrtg is running every 5 minutes.

All was well until I was suspicious of how low the graphed values
seemed.  So, I modified my perl script to log to a file the values that
it returns to mrtg.  Sure enough, the values are a lot higher than what
mrtg appears to be graphing and displaying in the html.  Here's an
example of the data points since I last wiped out my intsite-atrecords.*
files to start it all over.  The first record is when I ran mrtg
manually the first time:

Jan 14 2004  4:03:48:833PM-231
Jan 14 2004  4:05:01:046PM-91
Jan 14 2004  4:10:01:333PM-300
Jan 14 2004  4:15:00:513PM-382
Jan 14 2004  4:20:00:643PM-370
Jan 14 2004  4:25:00:790PM-313
Jan 14 2004  4:30:00:983PM-291
Jan 14 2004  4:35:01:220PM-402
Jan 14 2004  4:40:01:390PM-265
Jan 14 2004  4:45:00:676PM-280
Jan 14 2004  4:50:00:836PM-242
Jan 14 2004  4:55:00:993PM-275
Jan 14 2004  5:00:01:143PM-253
Jan 14 2004  5:05:01:393PM-267
Jan 14 2004  5:10:00:563PM-299
Jan 14 2004  5:15:01:676PM-255
Jan 14 2004  5:20:00:820PM-257
Jan 14 2004  5:25:01:200PM-321
Jan 14 2004  5:29:59:833PM-261

That is the date/time the script was run (according to the SQL server..
It's the date I use in the select statement so that I only count new
records) followed by a dash and the value that it returned on line 1 and
line 2 to mrtg.  Some quick division shows that the lowest value at 4:50
was about 48.4 records per minute and the highest at 4:35 was 80.4
records per minute.  But, that's not at all what my mrtg graphs and html
pages show.  Take a look at:

http://rgweb.vpsa.asu.edu/intsite/mrtg/email/
Or more specifically
http://rgweb.vpsa.asu.edu/intsite/mrtg/email/intsite-atrecords.html

The graph shows a peak of 41 at the beginning but looks nothing at all
like the data above.  

Ideas?  Did I miss something simple?

I don't know how to interpret mrtg's .log file, but here are the first
several lines:
1074126601 261 261
1074126601 13 13 13 13
1074126301 13 13 13 13
1074126300 12 12 13 13
1074126000 0 0 6 6
1074125700 6 6 6 6
1074125400 5 5 6 6
1074125100 2 2 3 3
1074124800 1 1 1 1
1074124500 1 1 3 3
1074124200 3 3 3 3
1074123900 3 3 22 22
1074123600 22 22 22 22
1074123300 21 21 22 22
1074123000 16 16 16 16
1074122700 16 16 16 16
1074122400 16 16 16 16
1074122100 16 16 42 42
1074121800 41 41 42 42
1074121500 0 0 0 0
1074121200 0 0 0 0
(the rest are zeros)

The first line looks like the most recent reading that it was given....
I don't know what significance that has...


Thanks for any advise
Jason

--
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