Perfdata is not generated on check_ioutil

This support forum board is for support questions relating to Nagios XI, our flagship commercial network monitoring solution.
Locked
ethanyin
Posts: 1
Joined: Sat Mar 14, 2015 2:02 am

Perfdata is not generated on check_ioutil

Post by ethanyin »

Dear, we are running the Nagios XI 2014R2.4, recently we add the script to check the IO utile on few linux box (VM), but found the perfdata is not generated and the performance char is not available for this service. I googled it but found nothing to resolve the issue. Can you please help to check?

The script is :

#!/bin/sh

iostat=`which iostat 2>/dev/null`
bc=`which bc 2>/dev/null`

function help {
echo -e "This plugin shows the I/O usage_rate of the specified disk, using the iostat external program.\n\t example \n\t ./$0 -d sda
2 -w 10 -c 20"
exit -1
}

# Ensuring we have the needed tools:
( [ ! -f $iostat ] ) && ( echo "ERROR: iostat command not found .Please install" && exit -1 )

# Getting parameters:
while getopts "d:w:c:h" OPT; do
case $OPT in
"d") disk=$OPTARG;;
"w") warning=$OPTARG;;
"c") critical=$OPTARG;;
"h") help;;
esac
done

# Adjusting the three warn and crit levels:

crit_util=`echo $critical`
warn_util=`echo $warning`

# Checking parameters:
[ ! -b "/dev/$disk" ] && echo "ERROR: Device incorrectly specified" && help

( [ $warn_util == "" ] || [ $crit_util == "" ] ) && echo "ERROR: You must specify all warning and critical levels" && help

( [[ "$warn_util" -ge "$crit_util" ]] ) && echo "ERROR: critical levels must be highter than warning levels" && help

# Doing the actual check:
util=`$iostat -dx 1 10 $disk | grep $disk | awk '{print $12}'|sort -nr | head -n 1 `

# Comparing the result and setting the correct level:
if ( echo ${util} ${crit_util}|awk '!($1>=$2){exit 1}' );then
msg="CRITICAL"
status=2
else if ( echo ${util} ${warn_util} |awk '!($1>=$2){exit 1}');then
msg="WARNING"
status=1
else
msg="OK"
status=0
fi
fi

# Printing the results:
echo "$msg - I/O stats util_rate=$util "

# Bye!
exit $status


And I also check the settings in the service. Process Perfdata is on by default but the file under /usr/local/nagios/share/perfdata/ is not created but all the other services are.
User avatar
Box293
Too Basu
Posts: 5126
Joined: Sun Feb 07, 2010 10:55 pm
Location: Deniliquin, Australia
Contact:

Re: Perfdata is not generated on check_ioutil

Post by Box293 »

I Nagios, performance data must be part of the plugin output. It is the data after the pipe | symbol and must be formatted in a specific manner. Your plugin does not do this.

I actually did a talk on this at the Nagios World Conference, you can watch it here:

https://www.youtube.com/watch?v=kqA2KcpUFg4
http://www.slideshare.net/nagiosinc/tro ... and-graphs

This has all the information to get the performance data added.
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.
Locked