[mrtg] Graphing uptime

Daniel Beardsmore resident at telcontar.net
Fri Sep 28 12:51:39 CEST 2018


Ah, finally I see what's going on. The software pre-emptively formats
timeticks instead of formatting this only when needed. This results in the
data being mangled before you can even see it.

 

Instead of the HTML generation formatting the time values as needed, they
are formatted prematurely, so by the time you come to plot the graph, the
data is rendered unreadable.

 

As such, there is no way to fix this without desynchronising the code from
the Debian repository. It's not even that OID that is checked, but any
timeTicks type.

 

From: mrtg [mailto:mrtg-bounces+resident=telcontar.net at lists.oetiker.ch] On
Behalf Of Daniel Beardsmore
Sent: 28 September 2018 10:06
To: mrtg at lists.oetiker.ch
Subject: [mrtg] Graphing uptime

 

Hello

 

I can see that graphing uptime is possible, as you can see here:

 

http://www.hotelsvillegia.com/mrtg/uptime.html

 

The HTML pages report uptime in the format: "163 days, 21:07:10"

 

If I check manually, I get this:

 

snmpget -v2c -c somecommunity somehost 1.3.6.1.2.1.1.3.0

DISMAN-EVENT-MIB::sysUpTimeInstance = Timeticks: (1415941565) 163 days,
21:10:15.65

 

The format is almost the same, but the latter contains the full centisecond
accuracy. You do nonetheless get the raw number included.

 

Now, using this in MRTG yields:

 

2018-09-27 19:56:04 -- 2018-09-27 19:51:33: WARNING: Expected a number but
got '163 days, 7:17:10'

 

Looking at the source code, I cannot determine quite how uptime is
processed. It seems odd that the format is almost the same (without the
centiseconds), which suggests (along with other code) that MRTG receives
pre-formatted output, and then has to scrape out the useful bits. (Which is
just plain horrible if this is true.)

 

Am I right in thinking that MRTG presently has no way to extract the raw
figure here? It seems that the SNMP library is formatting the data
prematurely and MRTG just works with that preformatted value as it suits its
own purposes, but that you cannot get the raw data out if you choose, for
example if you want to record uptime as a graph for checking for reboots.

 

In the example posted, I suspect that was bodged to get that to work.

 

Regards

 

Daniel. 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.oetiker.ch/pipermail/mrtg/attachments/20180928/d79d1f11/attachment.html>


More information about the mrtg mailing list