MRTG ignores decimals?

This support forum board is for support questions relating to Nagios XI, our flagship commercial network monitoring solution.
User avatar
snapon_admin
Posts: 952
Joined: Mon Jun 10, 2013 10:39 am
Location: Kenosha, WI
Contact:

Re: MRTG ignores decimals?

Post by snapon_admin »

The -l switch is being used, but it's in M. We prefer seeing the data units in Mbps as opposed to Kbps. It only seems logical that if a bandwidth warning threshold is set to 4Mbps, that we would get a warning when the utilization is at 4Mbps, or 4.6Mbps, or 4.9Mbps. The issue we're experiencing is that we're not getting a warning until it hits 5Mbps.
sreinhardt
-fno-stack-protector
Posts: 4366
Joined: Mon Nov 19, 2012 12:10 pm

Re: MRTG ignores decimals?

Post by sreinhardt »

Just wanted to touch base. I know exactly where the bug is in the code, simply have not had as much time as I would like to resolve it, and apparently I am horrid at making bash to float math. If I hadn't fallen asleep at the keyboard last night, it would probably be done. I can promise(as it's only a few minor things left) it will be at the latest monday morning.
Nagios-Plugins maintainer exclusively, unless you have other C language bugs with open-source nagios projects, then I am happy to help! Please pm or use other communication to alert me to issues as I no longer track the forum.
User avatar
snapon_admin
Posts: 952
Joined: Mon Jun 10, 2013 10:39 am
Location: Kenosha, WI
Contact:

Re: MRTG ignores decimals?

Post by snapon_admin »

No worries, Spenser. Thanks again for digging into this.
sreinhardt
-fno-stack-protector
Posts: 4366
Joined: Mon Nov 19, 2012 12:10 pm

Re: MRTG ignores decimals?

Post by sreinhardt »

You're welcome, just wanted to keep you updated!
Nagios-Plugins maintainer exclusively, unless you have other C language bugs with open-source nagios projects, then I am happy to help! Please pm or use other communication to alert me to issues as I no longer track the forum.
sreinhardt
-fno-stack-protector
Posts: 4366
Joined: Mon Nov 19, 2012 12:10 pm

Re: MRTG ignores decimals?

Post by sreinhardt »

For some reason, your rrd example is giving me 0 bytes in and out at the moment, although I could have sworn it worked before. Regardless, I modifed the plugin to work with bc which was already a dependency. It seems to be working properly in my test systems, but as always please deploy in test first. If we confirm this works on your systems as well, I will get it patched in for the next XI release.
You do not have the required permissions to view the files attached to this post.
Nagios-Plugins maintainer exclusively, unless you have other C language bugs with open-source nagios projects, then I am happy to help! Please pm or use other communication to alert me to issues as I no longer track the forum.
User avatar
snapon_admin
Posts: 952
Joined: Mon Jun 10, 2013 10:39 am
Location: Kenosha, WI
Contact:

Re: MRTG ignores decimals?

Post by snapon_admin »

It does appear to work, but there are still some strange results if I use decimals as the threshold. It should be noted that we only use whole numbers so this won't really affect us, but I felt I should point it out. Examples:

Using 2Mbps as the warning threshold (I checked ahead of time so knew that this would trigger warning if it worked):

Code: Select all

/usr/local/nagios/libexec/check_rrdtraf -f /var/lib/mrtg/10.97.255.1_2.rrd -w 2,2 -c 5,5 -l M
OUTPUT: WARNING - Current BW in: .86Mbps Out: 2.37Mbps|in=.860095Mb/s;2;5 out=2.371877Mb/s;2;5
Perfect, exactly what I want to see and what didn't happen before. Now for the weird part. If I change the threshold to 2.4, I get OK, which would be expected since 2.3 is below the threshold, but if I do 2.2 it still says OK when it should be warning if the bandwidth is 2.3Mbps. Example (note, I had to change the thresholds because the bandwidth usage went down, but still the same principle that decimal thresholds don't seem to work right.)

Code: Select all

/usr/local/nagios/libexec/check_rrdtraf -f /var/lib/mrtg/10.97.255.1_2.rrd -w 1.6,1.6 -c 5,5 -l M
OUTPUT: OK - Current BW in: .64Mbps Out: 1.57Mbps|in=.644514Mb/s;1.6;5 out=1.570820Mb/s;1.6;5

Code: Select all

/usr/local/nagios/libexec/check_rrdtraf -f /var/lib/mrtg/10.97.255.1_2.rrd -w 1.4,1.4 -c 5,5 -l M
OUTPUT: OK - Current BW in: .64Mbps Out: 1.57Mbps|in=.644514Mb/s;1.4;5 out=1.570820Mb/s;1.4;5
sreinhardt
-fno-stack-protector
Posts: 4366
Joined: Mon Nov 19, 2012 12:10 pm

Re: MRTG ignores decimals?

Post by sreinhardt »

Ah I see what you are saying, thanks for checking! I'll poke around a bit more and have another update for you!
Nagios-Plugins maintainer exclusively, unless you have other C language bugs with open-source nagios projects, then I am happy to help! Please pm or use other communication to alert me to issues as I no longer track the forum.
zaji_nms
Posts: 616
Joined: Tue Oct 16, 2012 12:28 am

Re: MRTG ignores decimals?

Post by zaji_nms »

Dear sreinhardt

Me facing same issue, threshold in decimal, it get ignored, our one of user using the bandwidth in 7Gbps, I cannot give MRTG graph in Mbps, I want to set threshold 6.5 Warning, 6.8 Critical but giving error.

Regards
Zajil NMS
sreinhardt
-fno-stack-protector
Posts: 4366
Joined: Mon Nov 19, 2012 12:10 pm

Re: MRTG ignores decimals?

Post by sreinhardt »

Have you tried the updated version posted a few posts ago? If so what is the new error you are getting when running via cli? I am aware that there is still some tweaking to be done here, and I will do it sooner or later, hopefully sooner!
Nagios-Plugins maintainer exclusively, unless you have other C language bugs with open-source nagios projects, then I am happy to help! Please pm or use other communication to alert me to issues as I no longer track the forum.
zaji_nms
Posts: 616
Joined: Tue Oct 16, 2012 12:28 am

Re: MRTG ignores decimals?

Post by zaji_nms »

Dear sreinhardt

Your upload (by sreinhardt » Mon Nov 03, 2014 5:28 am) , no I did not try as I have to take help of our System Admin. Error coming on old Nagios 2012 and Nagios 2014R2.0 just ignoring (no alert at all). Me waiting your final fixing and upload, so only once I have to take help of my System Admin.

Me window user and Nagios on CentOS, if I open in NOTEPAD, characters are wrap around, if I open in WORDPAD its okay, may I copy/paste from Window (wordpad) to Linux? Will there any bad impact? If no issue, then I will without fear (from Wordpad to Linux , just copy/paste).

Regards
Zajil NMS
Locked