[mrtg] Difference between last two log points not working.

Steve Shipway s.shipway at auckland.ac.nz
Sun Nov 2 22:10:22 CET 2008

> My target script's output looks like this:
> 3374
> 0
> 256657 seconds (71 hours)
> requests, 0 requests/s (tcp and udp)
> And every 5 minutes mrtg is run, there are around 5 requests each 5
> minutes.
> So the next value of TCP requests would be 3374 + 5
> I'd like MRTG to plot the difference between the last plot and this
> current
> one, e.g. 5.
> options[requests]: growright, nopercent

Since you did not give option 'gauge', then MRTG will automatically convert the incoming data into units per second.  Therefore, if the count increments by 5 each 5-min poll, this will give 1/60 = 0.017 as the stored value (if you specified 'gauge' then it would just graph the total rather than the rate of change, which is not what you want either).

You can specify the 'perminute' option to do an implicit *60 and get a value of 1 (IE, change per minute rather than change persecond).

You could add 'Factor[]: 300' instead to multiply the received values by 300, converting units per second to units per 5min.  This might be counterintuitive and can prevent you from making total calculations as you end up with a rate-per-5min on higher granularity graphs as well.

However, remember that RRDtool performs data normalisation.  Unless your data come in EXACTLY on the 5min boundary, they will be adjusted to give a predicted value on this boundary.  This is not normally a problem with (eg) network traffic, but it can give you unexpected decimals when you are graphing small integers like this if the data come in at slightly irregular intervals.


More information about the mrtg mailing list