My name is Harry. I just try to use the Nagios’s check_processes script (see bottom of this message for check_processes script) to check my environment. The check_processes script works perfect from command line.
E.g: nagios@sftest#/usr/local/nagios/libexec/check_processes
Not OK - 2 processes NOT running: cvs mysql
My machine doesn’t have cvs and mysql running.
However, when i apply this script on Nagios configuration, i don’t see “Not OK - 2 processes NOT running: cvs mysql” message showing Nagiso web interface. Here what i do:
- Copy check_processes file to the path /usr/local/nagios/libexec/ (this is all-plugins located)
- Add lines in /usr/local/nagios/etc/checkcommands.cfg
define command {
command_name check_processes
command_line /usr/local/nagios/libexec/check_processes
} - Add lines in /usr/local/nagios/etc/services.cfg
define service {
use generic-service
host_name dbinhouse
service_description Check processes
is_volatile 0
check_period 24x7
max_check_attempts 3
normal_check_interval 5
retry_check_interval 1
contact_groups sveng-admin
notification_interval 60
notification_period 24x7
notification_options c,r
check_command check_processes
}
Here is what i see from Nagios Web interface:
- Check processes CRITICAL 03-06-2008 14:35:53 3d 2h 48m 37s 3/3 -------------------------------------------
All dot-dot shows at “status information” column. - There is nothing listed like when do it from command line (e.g: Not OK - 2 processes NOT running: cvs mysql)
Any help is very appreciate it. Anything i miss?
Thanks,
Harry-
check_processes script starts here:
You may have to change this, depending on where you installed your
Nagios plugins
PROGNAME=“check_processes"
PATH=”/usr/bin:/usr/sbin:/bin:/sbin"
LIBEXEC="/usr/local/nagios/libexec"
. $LIBEXEC/utils.sh
DEFINING THE PROCESS LIST
#LIST="init"
LIST=“nagios cvs sendmail httpd mysql”
REQUISITE NAGIOS COMMAND LINE STUFF
print_usage() {
echo "Usage: $PROGNAME"
echo “Usage: $PROGNAME --help???”
}
print_help() {
echo ""
print_usage
echo ""
echo "Basic processes list monitor plugin for Nagios"
echo ""
echo "This plugin not developped by the Nagios Plugin group."
echo "Please do not e-mail them for support on this plugin, since"
echo "they won’t know what you’re talking about …"
echo ""
echo “For contact info, read the plugin itself…”
}
while test -n "$1"
do
case “$1” in
–help) print_help; exit $STATE_OK;;
-h) print_help; exit $STATE_OK;;
*) print_usage; exit $STATE_UNKNOWN;;
esac
done
FINALLY THE MAIN ROUTINE
COUNT=“0"
DOWN=”"
for PROCESS in echo $LIST
do
if ps -ef | grep -i $PROCESS | grep -v grep | wc -l
-lt 1 ]
then
let COUNT=$COUNT+1
DOWN="$DOWN $PROCESS"
fi
echo "-------------------------------------------"
echo "Processes checked: $PROCESS "
done
echo "-------------------------------------------"
if $COUNT -gt 0 ]
then
echo "Not OK - $COUNT processes NOT running: $DOWN"
exit $STATE_CRITICAL
fi
Nothing caused us to exit early, so we’re okay.
echo "OK - All requisite processes running."
exit $STATE_OK
End here ---------