[mrtg] Time drift in entries in log file.

Ayaz Ahmed Khan ayaz at ayaz.pk
Sun Mar 18 08:38:31 CET 2007

Hash: SHA1

"Steve Shipway" typed:
> "Ayaz Ahmed Khan" wrote:
>> I have setup MRTG on a system at work.  In the log file generated and
>> subsequently updated by MRTG, I am seeing a time drift of anywhere
>> from 2, 3 to 4 seconds in lines 2 to 4, despite MRTG being set to poll
>> every five
> I don't think this is a cause for concern.  Polling will often take
> varying times as it depends on server and network loading.  However,
> MRTG compensates for this by adjusting its internal rates based on the
> data logging times, so if the poll happens a few seconds late, then the
> rate of change will be very slightly adjusted to reflect this.  If you
> use gauge, though, I think the numbers may be logged as-is to the data
> time window.

The drift is in lines 2 and lines 3 only.  The rest of the lines vary by an 
absolute number of seconds, which is 300 seconds in my case.  

I'm writing a Perl script that retrieves traffic data and time from the log 
file every five minutes (or more, depending on how long the script takes to 
reach the point where the function that parses the mrtg log file is called), 
and I'm required to return values for those lines in the log file where the 
timestamp matches a defined criteria and is a multiple of 300 [seconds].  
Only lines 2 and 3 are showing an inexplicable drift of 2, sometimes 3, or 4 
seconds, which is adjusted by MRTG in the next run but the new values 
introduced in place of lines 2 and 3 have a similar drift again (which is 
again adjusted on the next run and so on).  I am, right now, achieving what 
is required by ignoring lines 1-3.  This seems to work perfectly, but I am 
curious why the drift is there, and whether it is something that can be seen 
anywhere where MRTG is deployed or it is valid only in my case and for my 

The MRTG is set up, in my environment, in a local LAN settings and I should 
like to believe that there are no apparent delays in anything and no 
perceptible network load, either.

Thank you for replying, Steve and Stuart.  Your replies are much appreciated.

- -- 
Ayaz Ahmed Khan

Falling in love makes smoking pot all day look like the ultimate in
                -- Dave Sim, author of "Cerebus".
Version: GnuPG v1.4.5 (GNU/Linux)


More information about the mrtg mailing list