#!/bin/sh

PROGNAME='Check Toner 4 BlackWhite Printers ver. 0.1'

SCP="snmpget"
ARGS='-c public -v 1 -O v'
HOST=$1
TONER="K"
KM_OID='.1.3.6.1.2.1.43.11.1.1.8.1.1' # Max Black Toner 
KR_OID='.1.3.6.1.2.1.43.11.1.1.9.1.1' # Remaining Black Toner
KM_CMD=`$SCP $ARGS $HOST $KM_OID |sed 's/INTEGER: //'`
KR_CMD=`$SCP $ARGS $HOST $KR_OID |sed 's/INTEGER: //'`

while [ $TONER = "K" ] 
do

 if [ $KR_CMD -gt 150  ] ; then
	OUTPUT="${OUTPUT} BLACK Toner OK -- Toner Levels: `echo $KR_CMD` of `echo $KM_CMD` Remaining | `echo $KR_CMD`"
	STAT=0
		else
			OUTPUT="${OUTPUT} BLACK Toner Low -- Toner Levels: `echo $KR_CMD` of `echo $KM_CMD` Remaining | `echo $KR_CMD`" 
			STAT=2
fi
TONER="AB"
done

echo $OUTPUT
exit $STAT 
