Notification on Low CPU Usage


#1

I have a number of Windows servers that I’m monitoring with check_nt. From what I can determine the Warning and Critical parameters are thresholds which can trigger notification if the utilization is ABOVE them. In my application, I’m more concerned about low CPU utilization as it indicates that something is not working correctly. How can I configure this?


#2

You’re going to have to write a script in linux that runs check_nt, then performs something based on its output. This is linux, you are not restricted to pre-built binary functions.
eg:
your service definition has a new check_command:
check_command check_nt_load

Then heres your checkcommand:
define command{
command_name check_nt_load
command_line /usr/local/nagios/libexec/check_nt_load_script.sh $HOSTADDRESS$
}

This will run /usr/local/nagios/libexec/check_nt_load_script.sh , passing the HOSTADDRESS ip to it. This gets registered as $1 .

Heres a check_nt_load_script.sh example:

!#/bin/bash
#Wild guess on the check_nt parameters needed here cause i don’t use it… modify as necessary

LOAD=/usr/local/nagios/libexec/check_nt -H $1 -c load -l 1,5,6

#This is gonna throw back a return code of 0 (OK), 1 (WARNING), or 2 (CRITICAL). this return code gets thrown into the default variable called $?. We want to swap, if load is CRITICAL that is GOOD right? yeah!

if “$?” == “2” ]
then
echo “Load is HIGH! This is gooood!! $LOAD” | sed -e 's/CRITICAL/OK/'
exit 0
else
echo “LOAD is too LOW! $LOAD” | sed -e 's/OK/CRITICAL/'
exit 2
fi

Something along those lines. The | sed -e is just doing a text replacement - OK with CRITICAL and vice versa. Good luck


#3

Thank you very much!