This HOW-TO is realized to monitor a group of processes on linux machine. 

1) create a check_process.sh like this: 

#!/bin/bash
#
# Uso: .//check_system_pp
#

##################################################################################
#
# Processi da analizzare
PROCLIST_RED="init syslogd collectd"

##################################################################################

PATH="/usr/bin:/usr/sbin:/bin:/sbin"

STATE_OK=0
STATE_WARNING=1
STATE_CRITICAL=2
STATE_UNKNOWN=3
STATE_DEPENDENT=4

check_processes_red()
{
        PROCESS="0"
        ERROR_PROCS=""
        for PROC in `echo $PROCLIST_RED`; do
        if [ `ps -ef | grep $PROC | grep -v grep | wc -l` -lt 1 ]; then
                        PROCESS=1
                        ERROR_PROCS="$ERROR_PROCS""$PROC ";
        fi
        done

        if [ $PROCESS -eq "1" ]; then
                exit_red=$STATE_CRITICAL
        elif [ $PROCESS -eq "0" ]; then
                exit_red=$STATE_OK
        fi
}

check_processes_red

final_exit=`expr $exit_red`

if [ $final_exit -eq "0" ]; then
        echo "SYSTEM OK - All monitored resources OK. Processes: $PROCLIST_RED"
        exitstatus=$STATE_OK
elif [ $final_exit -eq "1" ]; then
        echo "SYSTEM WARNING - Processes DOWN. ($WARNING_PROCS)."
        exitstatus=$STATE_WARNING
elif [ $final_exit -ge "1" ]; then
        echo "SYSTEM CRITICAL - Resources DOWN! Processes: $ERROR_PROCS 
$WARNING_PROCS"
        exitstatus=$STATE_CRITICAL
fi

exit $exitstatus

This is a NAGIOS plugin, modified to fit the zenoss structure.

2) modify the list of processes to monitor, and move the file into /usr/bin 
with the maximum privileges

3) follow this guide to import a NAGIOS plugin into Zenoss
 http://www.zenoss.com/community/docs/howtos/create-modify-nagios-templates

but remember to set the ZENOSS command path to /usr/bin (generally is 
/opt/libexec or something..) 

4) we've done!!!




-------------------- m2f --------------------

Read this topic online here:
http://community.zenoss.com/forums/viewtopic.php?p=21355#21355

-------------------- m2f --------------------



_______________________________________________
zenoss-users mailing list
[email protected]
http://lists.zenoss.org/mailman/listinfo/zenoss-users

Reply via email to