Page 2 of 3

Re: MRTG ignores decimals?

Posted: Fri Oct 31, 2014 9:33 am
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.

Re: MRTG ignores decimals?

Posted: Fri Oct 31, 2014 11:28 am
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.

Re: MRTG ignores decimals?

Posted: Fri Oct 31, 2014 11:35 am
by snapon_admin
No worries, Spenser. Thanks again for digging into this.

Re: MRTG ignores decimals?

Posted: Fri Oct 31, 2014 11:41 am
by sreinhardt
You're welcome, just wanted to keep you updated!

Re: MRTG ignores decimals?

Posted: Sun Nov 02, 2014 8:28 pm
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.

Re: MRTG ignores decimals?

Posted: Mon Nov 03, 2014 11:48 am
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

Re: MRTG ignores decimals?

Posted: Mon Nov 03, 2014 12:35 pm
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!

Re: MRTG ignores decimals?

Posted: Fri Dec 05, 2014 12:40 pm
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

Re: MRTG ignores decimals?

Posted: Fri Dec 05, 2014 1:42 pm
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!

Re: MRTG ignores decimals?

Posted: Fri Dec 05, 2014 2:09 pm
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