Graphing uptime

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

--===============3059744575332092669==
Content-Type: multipart/alternative;
	boundary="----=_NextPart_000_0419_01D45712.EABD4F50"
Content-Language: en-gb

This is a multipart message in MIME format.

------=_NextPart_000_0419_01D45712.EABD4F50
Content-Type: text/plain;
	charset="us-ascii"
Content-Transfer-Encoding: 7bit

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_0419_01D45712.EABD4F50
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:x=3D"urn:schemas-microsoft-com:office:excel" =
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-compose;
	font-family:"Arial",sans-serif;
	color:windowtext;}
.MsoChpDefault
	{mso-style-type:export-only;
	mso-fareast-language:EN-US;}
@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'>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></body></html>
------=_NextPart_000_0419_01D45712.EABD4F50--


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

--===============3059744575332092669==--