Hi All,

I found following script from this mail list for OS Process monitoring. So
when I tried it, it is perfectly monitor given set of process locally. But
when I tried to add it to a remote server for monitor it not works.
What I did
1. Created Data Source in name of check_process and select command
monitoring
2. copied script (check_process.sh) to $ZENHOME/libexe folder and use
check_process as command.
3. Tried testing data source by giving remote ip
So it will give an allert saying process are down although its woking fine
on remote server.

Is there any way to use this script for remote server monitoring. Script is

#!/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
_______________________________________________
zenoss-users mailing list
[email protected]
http://lists.zenoss.org/mailman/listinfo/zenoss-users

Reply via email to