#! /bin/sh STATE_OK=0 STATE_WARNING=1 STATE_CRITICAL=2 STATE_UNKNOWN=3 STATE_DEPENDENT=4 if test $# -eq 1 then ECHO=OK else ECHO="Hostname not correct" exit 3 fi ping -c 1 $1 >>/dev/null if [ $? = 0 ] then REG_SM=`snmpget -v 2c -c $2 -O qv $1 1.3.6.1.4.1.161.19.3.1.7.1.0` if [ "$REG_SM" != "0" ] ; then echo $REG_SM exit $STATE_OK else echo "No Sm registered" exit $STATE_UNKNOWN fi else echo "sorry - Host unrecheable" exit 3 fi