Page 1 of 1

Draw graph based on bash script

Posted: Tue May 23, 2017 7:43 am
by artaknew
Hello everyone,
I'm a new in Nagios XI, but i decided to use it to monitor my server environment, mainly windows.

I have a small bash script which uses windows performance counter to monitor network usage. the script convert bytes to Mbps.

#########################
!The SCRIPT

#!/bin/bash
#computer name $1
# Secure, password

value=`/usr/local/nagios/libexec/check_nt -H $1-p 12489 -s $2-v COUNTER -l "\network interface(*)\bytes total/sec"`
echo "scale=2; $value*0.000008" | bc
exit $exitcode
#########################

The QUESTION is: why Nagios XI does not draw graphs?

Re: Draw graph based on bash script

Posted: Tue May 23, 2017 4:33 pm
by tgriep
Your script is not outputting the performance data so the process that generates the graphs can not create the graph.
I did a simple edit to your script that should work for you.

Code: Select all

#!/bin/bash

value=`/usr/local/nagios/libexec/check_nt -H tompc -p 12489 -s nsclientpass -v COUNTER -l "\network interface(*)\bytes total/sec"`
perf=$(echo "scale=2; $value*0.000008" | bc)                                                                                                                                                              

echo "Value $value | 'MB'=$perf"

exit $exitcode

Take a look at these links for the plugin's performance data output.
https://assets.nagios.com/downloads/nag ... fdata.html
https://nagios-plugins.org/doc/guidelines.html#AEN200

Re: Draw graph based on bash script

Posted: Wed May 24, 2017 3:21 am
by artaknew
Thanks tgriep, issue is solved.