Page 1 of 2

how to enable performance graph on a custom service

Posted: Mon Aug 14, 2017 9:58 am
by lpereira
Hello All:
First to all, i want to apologize in advance, since English is not my native languaje :).

here is mi issue... i'm using nagios XI 5.4.7 and i suceeded in adding a custom service for disk check space. the script alerts when the space is below 10gb or 5gb (it not uses % for alerting).

The thing is... i want to have a performance graph for this new service i have added. I've tried looking around, but i did not see any solution for this.

Is there anyone who can assist on this?

I appreciate in advance any help you guys can provide

have a great day.

Luciano.

Re: how to enable performance graph on a custom service

Posted: Mon Aug 14, 2017 10:33 am
by kyang
Hi @Ipereira,

If you go to Service Detail (on the left) --> find and click on your custom service for disk space --> next to the overview tab there should be a small graph icon --> once clicked, it should show performance graphing.

You might have to change the graph time frame if your service is relatively new and not showing any information.

Does this answer your question? Let me know!

Re: how to enable performance graph on a custom service

Posted: Mon Aug 14, 2017 10:43 am
by mcapra
Can you share the output of your custom script executed from the CLI of your Nagios XI machine? Nagios plugins have certain criteria for reporting performance data, and It'd be useful to be sure your plugin is following that criteria:
https://nagios-plugins.org/doc/guidelines.html#AEN200

Re: how to enable performance graph on a custom service

Posted: Mon Aug 14, 2017 10:48 am
by lpereira
kyang wrote:Hi @Ipereira,

If you go to Service Detail (on the left) --> find and click on your custom service for disk space --> next to the overview tab there should be a small graph icon --> once clicked, it should show performance graphing.

You might have to change the graph time frame if your service is relatively new and not showing any information.

Does this answer your question? Let me know!

Thanks for your quick response. please check the screenshots below... there are no graphics available for "Drive E: Disk Usage Space" and "Drive C: Disk Usage Space", those are the custom ones...

Re: how to enable performance graph on a custom service

Posted: Mon Aug 14, 2017 12:27 pm
by lpereira
mcapra wrote:Can you share the output of your custom script executed from the CLI of your Nagios XI machine? Nagios plugins have certain criteria for reporting performance data, and It'd be useful to be sure your plugin is following that criteria:
https://nagios-plugins.org/doc/guidelines.html#AEN200
hi, this is the content of the .sh file
#!/bin/bash
#:set fileformat=unix

FREESPACE=`/usr/local/nagios/libexec/check_nt -H $2 -p 12489 \
-v USEDDISKSPACE -l $4 | awk -F"- " '{ print $4 }' | awk -F "|" '{ print $1 }'`

SIZE=`echo $FREESPACE | awk '{ print $2 }'`
UNIT=`echo $FREESPACE | awk '{ print $3 }'`

if [ $UNIT == "Gb" ]; then
SIZE=`echo $SIZE \* 1024 | bc`
fi

if [ `echo "$SIZE >= $6" | bc` -eq 1 ]; then
echo "$4:\ Drive Space OK - $FREESPACE"
exit 0
elif [ `echo "$SIZE < $6" | bc` -eq 1 -a `echo "$SIZE > $8" | bc` -eq 1 ]; then
echo "$4:\ Drive Space WARNING - $FREESPACE"
exit 1
elif [ `echo "$SIZE <= $8" | bc` -eq 1 ]; then
echo "$4:\ Drive Space CRITICAL - $FREESPACE"
ex
thanks for the reply

Re: how to enable performance graph on a custom service

Posted: Mon Aug 14, 2017 2:55 pm
by scottwilkerson
your code is missing some code, but I'll give you a snippet that might fill in the blank and give you basic perf graphing

Code: Select all

echo "$4:\ Drive Space OK - $FREESPACE|free=$SIZE"
exit 0
elif [ `echo "$SIZE < $6" | bc` -eq 1 -a `echo "$SIZE > $8" | bc` -eq 1 ]; then
echo "$4:\ Drive Space WARNING - $FREESPACE|free=$SIZE"
exit 1
elif [ `echo "$SIZE <= $8" | bc` -eq 1 ]; then
echo "$4:\ Drive Space CRITICAL - $FREESPACE|free=$SIZE"

Re: how to enable performance graph on a custom service

Posted: Mon Aug 14, 2017 3:23 pm
by lpereira
scottwilkerson wrote:your code is missing some code, but I'll give you a snippet that might fill in the blank and give you basic perf graphing

Code: Select all

echo "$4:\ Drive Space OK - $FREESPACE|free=$SIZE"
exit 0
elif [ `echo "$SIZE < $6" | bc` -eq 1 -a `echo "$SIZE > $8" | bc` -eq 1 ]; then
echo "$4:\ Drive Space WARNING - $FREESPACE|free=$SIZE"
exit 1
elif [ `echo "$SIZE <= $8" | bc` -eq 1 ]; then
echo "$4:\ Drive Space CRITICAL - $FREESPACE|free=$SIZE"
Thanks!! i have modified the script but now i have differences on the outputs

the old one:
[root@Nagios libexec]# ./check_disk_by_size.sh -H xxx.xxx.xxx.xxx -l e -w 24000000 -c 23000000
e:\ Drive Space CRITICAL - free 234.84 Gb (7%)
the modify one:
[root@Nagios testin]# ./check_disk_by_size.sh -H Xxxx.xxx.xxx.xxx -l e -w 24000000 -c 23000000
e:\ Drive Space OK - free 234.80 Gb (7%) |free=240435.20

Re: how to enable performance graph on a custom service

Posted: Mon Aug 14, 2017 5:05 pm
by scottwilkerson
This new output should automatically create the graphs in Nagios XI on the performance graph tab.

Re: how to enable performance graph on a custom service

Posted: Mon Aug 14, 2017 5:15 pm
by lpereira
yes but one output says "drive OK" and the other one "Drive Critical". i have 2 different responses from the same query

Re: how to enable performance graph on a custom service

Posted: Tue Aug 15, 2017 10:33 am
by scottwilkerson
lpereira wrote:yes but one output says "drive OK" and the other one "Drive Critical". i have 2 different responses from the same query
What I added didn't change anything on the script that would change that logic.

Can you post the whole file so we can see the logic in the file?