Page 1 of 1

check_rrdtraf plugin

Posted: Tue Oct 10, 2017 4:21 am
by nms
Hi,

When executing this plugin with a higher unit then bytes, the result is as follows (sample):

Code: Select all

/usr/local/nagios/libexec/check_rrdtraf -f /var/lib/mrtg/10.193.1.3_504.rrd -w 500.0,500.0 -c 800.0,800.0 -l M
OK - Current BW in: .64Mbps Out: .17Mbps|in=.643269Mb/s;500.0;800.0 out=.171962Mb/s;500.0;800.0
Is there a possibility to obtain the values that have 0 float showing as 0.xxMbps instead of a .xxMbps?

Also is there a possibility of taking into consideration low and high thresholds?

Thanks in advance

Re: check_rrdtraf plugin

Posted: Tue Oct 10, 2017 9:03 am
by scottwilkerson
nms wrote: Is there a possibility to obtain the values that have 0 float showing as 0.xxMbps instead of a .xxMbps?
Yes, you would have to modify the plugin /usr/local/nagios/libexec/check_rrdtraf to add the leading zero if it was less than 1.
nms wrote:Also is there a possibility of taking into consideration low and high thresholds?
This plugin does not take into account ranges or the ability to alert on levels below a certain amount, and unfortunately I do not know of another rrd plugin that does.

Re: check_rrdtraf plugin

Posted: Tue Oct 10, 2017 9:21 am
by cdienger
The plugin uses bc to do the math which drops the zero. You could pipe the output to awk to print it as a float with a leading zero:

Code: Select all

scale=$SCALE; ($VALUEIN/$SDIVIN)"| bc
becomes:

Code: Select all

scale=$SCALE; ($VALUEIN/$SDIVIN)"| bc | awk '{printf "%f", $0}'

Re: check_rrdtraf plugin

Posted: Mon Oct 30, 2017 8:03 am
by nms
Thanks cdienger.
This thread can be closed

Re: check_rrdtraf plugin

Posted: Mon Oct 30, 2017 9:39 am
by kyang
Sounds good! I'll be closing this topic as resolved!

If you have any more questions, feel free to create another thread!

Thank you for using the Nagios Support Forum!