Re: Graphing uptime

"Daniel Beardsmore" <[email protected]> Fri, 28 Sep 2018 11:51:39 +0100
Newsgroups gmane.network.mrtg.user
Organization Lud Inc.
Message-ID <[email protected]>
This is a multipart message in MIME format.

--===============7042584179766105675==
Content-Type: multipart/alternative;
	boundary="----=_NextPart_000_0440_01D45721.9F39CE50"
Content-Language: en-gb

This is a multipart message in MIME format.

------=_NextPart_000_0440_01D45721.9F39CE50
Content-Type: text/plain;
	charset="us-ascii"
Content-Transfer-Encoding: 7bit

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:[email protected]] On
Behalf Of Daniel Beardsmore
Sent: 28 September 2018 10:06
To: [email protected]
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. 


------=_NextPart_000_0440_01D45721.9F39CE50
Content-Type: text/html;
	charset="us-ascii"
Content-Transfer-Encoding: quoted-printable

<html xmlns:v=3D"urn:schemas-microsoft-com:vml" =
xmlns:o=3D"urn:schemas-microsoft-com:office:office" =
xmlns:w=3D"urn:schemas-microsoft-com:office:word" =
xmlns:m=3D"http://schemas.microsoft.com/office/2004/12/omml" =
xmlns=3D"http://www.w3.org/TR/REC-html40"><head><meta =
http-equiv=3DContent-Type content=3D"text/html; =
charset=3Dus-ascii"><meta name=3DGenerator content=3D"Microsoft Word 15 =
(filtered medium)"><style><!--
/* Font Definitions */
@font-face
	{font-family:"Cambria Math";
	panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
	{font-family:Calibri;
	panose-1:2 15 5 2 2 2 4 3 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
	{margin:0cm;
	margin-bottom:.0001pt;
	mso-add-space:auto;
	font-size:12.0pt;
	font-family:"Times New Roman",serif;}
p.MsoNormalCxSpFirst, li.MsoNormalCxSpFirst, div.MsoNormalCxSpFirst
	{mso-style-type:export-only;
	margin:0cm;
	margin-bottom:.0001pt;
	mso-add-space:auto;
	font-size:12.0pt;
	font-family:"Times New Roman",serif;}
p.MsoNormalCxSpMiddle, li.MsoNormalCxSpMiddle, div.MsoNormalCxSpMiddle
	{mso-style-type:export-only;
	margin:0cm;
	margin-bottom:.0001pt;
	mso-add-space:auto;
	font-size:12.0pt;
	font-family:"Times New Roman",serif;}
p.MsoNormalCxSpLast, li.MsoNormalCxSpLast, div.MsoNormalCxSpLast
	{mso-style-type:export-only;
	margin:0cm;
	margin-bottom:.0001pt;
	mso-add-space:auto;
	font-size:12.0pt;
	font-family:"Times New Roman",serif;}
a:link, span.MsoHyperlink
	{mso-style-priority:99;
	color:blue;
	text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
	{mso-style-priority:99;
	color:purple;
	text-decoration:underline;}
tt
	{mso-style-priority:99;
	font-family:"Courier New";}
span.EmailStyle15
	{mso-style-type:personal;
	font-family:"Arial",sans-serif;
	color:#00007F;}
span.EmailStyle16
	{mso-style-type:personal;
	font-family:"Arial",sans-serif;
	color:#00007F;}
span.EmailStyle20
	{mso-style-type:personal;
	font-family:"Arial",sans-serif;
	color:windowtext;}
span.EmailStyle21
	{mso-style-type:personal-reply;
	font-family:"Arial",sans-serif;
	color:#00007F;}
.MsoChpDefault
	{mso-style-type:export-only;
	font-size:10.0pt;}
@page WordSection1
	{size:612.0pt 792.0pt;
	margin:72.0pt 72.0pt 72.0pt 72.0pt;}
div.WordSection1
	{page:WordSection1;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext=3D"edit" spidmax=3D"1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext=3D"edit">
<o:idmap v:ext=3D"edit" data=3D"1" />
</o:shapelayout></xml><![endif]--></head><body lang=3DEN-GB link=3Dblue =
vlink=3Dpurple><div class=3DWordSection1><p =
class=3DMsoNormalCxSpFirst><span =
style=3D'font-size:10.0pt;font-family:"Arial",sans-serif;color:#00007F'>A=
h, finally I see what&#8217;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.<o:p></o:p></span></p><p class=3DMsoNormalCxSpMiddle><span =
style=3D'font-size:10.0pt;font-family:"Arial",sans-serif;color:#00007F'><=
o:p>&nbsp;</o:p></span></p><p class=3DMsoNormalCxSpMiddle><span =
style=3D'font-size:10.0pt;font-family:"Arial",sans-serif;color:#00007F'>I=
nstead 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.<o:p></o:p></span></p><p =
class=3DMsoNormalCxSpMiddle><span =
style=3D'font-size:10.0pt;font-family:"Arial",sans-serif;color:#00007F'><=
o:p>&nbsp;</o:p></span></p><p class=3DMsoNormalCxSpMiddle><span =
style=3D'font-size:10.0pt;font-family:"Arial",sans-serif;color:#00007F'>A=
s such, there is no way to fix this without desynchronising the code =
from the Debian repository. It&#8217;s not even that OID that is =
checked, but any timeTicks type.<o:p></o:p></span></p><p =
class=3DMsoNormalCxSpMiddle><span =
style=3D'font-size:10.0pt;font-family:"Arial",sans-serif;color:#00007F'><=
o:p>&nbsp;</o:p></span></p><div style=3D'border:none;border-left:solid =
blue 1.5pt;padding:0cm 0cm 0cm 4.0pt'><div><div =
style=3D'border:none;border-top:solid #E1E1E1 1.0pt;padding:3.0pt 0cm =
0cm 0cm'><p class=3DMsoNormal><b><span lang=3DEN-US =
style=3D'font-size:11.0pt;font-family:"Calibri",sans-serif'>From:</span><=
/b><span lang=3DEN-US =
style=3D'font-size:11.0pt;font-family:"Calibri",sans-serif'> mrtg =
[mailto:[email protected]] <b>On =
Behalf Of </b>Daniel Beardsmore<br><b>Sent:</b> 28 September 2018 =
10:06<br><b>To:</b> [email protected]<br><b>Subject:</b> [mrtg] =
Graphing uptime<o:p></o:p></span></p></div></div><p =
class=3DMsoNormalCxSpMiddle><o:p>&nbsp;</o:p></p><p =
class=3DMsoNormalCxSpMiddle><span =
style=3D'font-size:10.0pt;font-family:"Arial",sans-serif'>Hello<o:p></o:p=
></span></p><p class=3DMsoNormalCxSpMiddle><span =
style=3D'font-size:10.0pt;font-family:"Arial",sans-serif'><o:p>&nbsp;</o:=
p></span></p><p class=3DMsoNormalCxSpMiddle><span =
style=3D'font-size:10.0pt;font-family:"Arial",sans-serif'>I can see that =
graphing uptime is possible, as you can see =
here:<o:p></o:p></span></p><p class=3DMsoNormalCxSpMiddle><span =
style=3D'font-size:10.0pt;font-family:"Arial",sans-serif'><o:p>&nbsp;</o:=
p></span></p><p class=3DMsoNormalCxSpMiddle><span =
style=3D'font-size:10.0pt;font-family:"Arial",sans-serif'><a =
href=3D"http://www.hotelsvillegia.com/mrtg/uptime.html">http://www.hotels=
villegia.com/mrtg/uptime.html</a><o:p></o:p></span></p><p =
class=3DMsoNormalCxSpMiddle><span =
style=3D'font-size:10.0pt;font-family:"Arial",sans-serif'><o:p>&nbsp;</o:=
p></span></p><p class=3DMsoNormalCxSpMiddle><span =
style=3D'font-size:10.0pt;font-family:"Arial",sans-serif'>The HTML pages =
report uptime in the format: &#8220;163 days, =
21:07:10&#8221;<o:p></o:p></span></p><p =
class=3DMsoNormalCxSpMiddle><span =
style=3D'font-size:10.0pt;font-family:"Arial",sans-serif'><o:p>&nbsp;</o:=
p></span></p><p class=3DMsoNormalCxSpMiddle><span =
style=3D'font-size:10.0pt;font-family:"Arial",sans-serif'>If I check =
manually, I get this:<o:p></o:p></span></p><p =
class=3DMsoNormalCxSpMiddle><span =
style=3D'font-size:10.0pt;font-family:"Arial",sans-serif'><o:p>&nbsp;</o:=
p></span></p><p class=3DMsoNormalCxSpMiddle><span =
style=3D'font-size:10.0pt;font-family:"Arial",sans-serif'>snmpget -v2c =
-c somecommunity somehost 1.3.6.1.2.1.1.3.0<o:p></o:p></span></p><p =
class=3DMsoNormalCxSpMiddle><span =
style=3D'font-size:10.0pt;font-family:"Arial",sans-serif'>DISMAN-EVENT-MI=
B::sysUpTimeInstance =3D Timeticks: (1415941565) 163 days, =
21:10:15.65<o:p></o:p></span></p><p class=3DMsoNormalCxSpMiddle><span =
style=3D'font-size:10.0pt;font-family:"Arial",sans-serif'><o:p>&nbsp;</o:=
p></span></p><p class=3DMsoNormalCxSpMiddle><span =
style=3D'font-size:10.0pt;font-family:"Arial",sans-serif'>The format is =
almost the same, but the latter contains the full centisecond accuracy. =
You do nonetheless get the raw number included.<o:p></o:p></span></p><p =
class=3DMsoNormalCxSpMiddle><span =
style=3D'font-size:10.0pt;font-family:"Arial",sans-serif'><o:p>&nbsp;</o:=
p></span></p><p class=3DMsoNormalCxSpMiddle><span =
style=3D'font-size:10.0pt;font-family:"Arial",sans-serif'>Now, using =
this in MRTG yields:<o:p></o:p></span></p><p =
class=3DMsoNormalCxSpMiddle><span =
style=3D'font-size:10.0pt;font-family:"Arial",sans-serif'><o:p>&nbsp;</o:=
p></span></p><p class=3DMsoNormalCxSpMiddle><span =
style=3D'font-size:10.0pt;font-family:"Arial",sans-serif'>2018-09-27 =
19:56:04 -- 2018-09-27 19:51:33: WARNING: Expected a number but got '163 =
days, 7:17:10'<o:p></o:p></span></p><p class=3DMsoNormalCxSpMiddle><span =
style=3D'font-size:10.0pt;font-family:"Arial",sans-serif'><o:p>&nbsp;</o:=
p></span></p><p class=3DMsoNormalCxSpMiddle><span =
style=3D'font-size:10.0pt;font-family:"Arial",sans-serif'>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.)<o:p></o:p></span></p><p =
class=3DMsoNormalCxSpMiddle><span =
style=3D'font-size:10.0pt;font-family:"Arial",sans-serif'><o:p>&nbsp;</o:=
p></span></p><p class=3DMsoNormalCxSpMiddle><span =
style=3D'font-size:10.0pt;font-family:"Arial",sans-serif'>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.<o:p></o:p></span></p><p class=3DMsoNormalCxSpMiddle><span =
style=3D'font-size:10.0pt;font-family:"Arial",sans-serif'><o:p>&nbsp;</o:=
p></span></p><p class=3DMsoNormalCxSpMiddle><span =
style=3D'font-size:10.0pt;font-family:"Arial",sans-serif'>In the example =
posted, I suspect that was bodged to get that to =
work.<o:p></o:p></span></p><p class=3DMsoNormalCxSpMiddle><span =
style=3D'font-size:10.0pt;font-family:"Arial",sans-serif'><o:p>&nbsp;</o:=
p></span></p><p class=3DMsoNormalCxSpMiddle><span =
style=3D'font-size:10.0pt;font-family:"Arial",sans-serif'>Regards<o:p></o=
:p></span></p><p class=3DMsoNormalCxSpMiddle><span =
style=3D'font-size:10.0pt;font-family:"Arial",sans-serif'><o:p>&nbsp;</o:=
p></span></p><p class=3DMsoNormalCxSpLast><span =
style=3D'font-size:10.0pt;font-family:"Arial",sans-serif'>Daniel. =
<o:p></o:p></span></p></div></div></body></html>
------=_NextPart_000_0440_01D45721.9F39CE50--


--===============7042584179766105675==
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

_______________________________________________
mrtg mailing list
[email protected]
https://lists.oetiker.ch/cgi-bin/listinfo/mrtg

--===============7042584179766105675==--