[Nagiosplug-help] General Plugin design

Jared Brick jared.brick at convergia.net
Wed Oct 16 10:57:02 CEST 2002


Hi,

	I am looking for a quick and dirty way to check if a process is running
on an nt box running snmp. My *very* simple (please no flames, I just
need this to work):


#!/bin/bash
HOST=$1
STRING=$2
PROCESS=$3

test=`snmpwalk $HOST $STRING
host.hrSWRun.hrSWRunTable.hrSWRunEntry.hrSWRunName | grep -c $PROCESS`

if [ ${test} -eq 1 ]; then
        echo "Process $PROCESS is running."
        exit 0
else
        echo "Process $PROCESS is not running."
        exit 2
fi

The plugin itself works when I run it on a command line:

./check_nt_proc XXXXXX.XXXXX.com notpublic CMD.EXE

But it fails to work when I use it in nagios:

check_command                   check_nt_proc!notpublic!CMD.EXE

define command{
        command_name    check_nt_proc
        command_line    $USER1$/check_nt_proc XXX.XX.com  $ARGS1$ $ARG2$
        }

If anyone has any insight to this, or can point me in the right
direction, it would be greatly appreciated. Also if anyone knows of a
better way to do this (ie another plugin), it would also be very
helpful.

Thanks,

Jared





More information about the Help mailing list