[Nagiosplug-help] Am i blind? how do i check a specific proce ss..

Jonathan Soong jon.soong at imvs.sa.gov.au
Wed Apr 21 17:25:46 CEST 2004


> try this check_nt_process!explorer.exe!
> 
> where the checkcommand is:
> 
> $USER1$/check_nt -H $HOSTADDRESS$ -p 1248 -v PROCSTATE -l $ARG1$

thanks for the suggestion Alexander, i ended up writing a quick bash
script to check for it (i was presuming the check_nt_process was for
windows machines?)

#! /bin/sh

PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin

PROGNAME=`basename $0`
PROGPATH=`echo $0 | sed -e 's,[\\/][^\\/][^\\/]*$,,'`
REVISION=`echo '$Revision: 1.0 $' | sed -e 's/[^0-9.]//g'`

. $PROGPATH/utils.sh


print_usage() {
        echo "Usage: $PROGNAME"
}

print_help() {
        print_revision $PROGNAME $REVISION
        echo ""
        print_usage
        echo ""
        echo "This plugin checks to see if a particular process is running."
        echo ""
        support
        exit 0
}

case "$1" in
        --help)
                print_help
                exit 0
                ;;
        -h)
                print_help
                exit 0
                ;;
        --version)
        print_revision $PROGNAME $REVISION
                exit 0
                ;;
        -V)
                print_revision $PROGNAME $REVISION
                exit 0
                ;;
        *)
                processrunning=`ps -ef | grep $1 | grep -v grep | grep
-v check_ps | grep -c ${1}`
                if [ ${processrunning} -ge 1 ];
                then
                  echo "OK: ${1} running"
                  exit $STATE_OK
                else
                  echo "CRITICAL: ${1} not running"
                  exit $STATE_CRITICAL
                fi
                ;;
esac




-- 
Jonathan Soong
Information Services
Institute of Medical and Veterinary Science (IMVS)
Email:   jon.soong at imvs.sa.gov.au
Web  :   http://www.imvs.sa.gov.au
Tel  :   +61 8 82223095
Fax  :   +61 8 82223147	





More information about the Help mailing list