#!/bin/bash HOST=${host:-"127.0.0.1"} : << =cut =head1 NAME Xerox-WC7x32-consumables - Plugin to monitor consumables level on Xerox WorkCentre 7x32 series printers =head1 CONFIGURATION host =head1 AUTHOR Oleksiy Kochkin =head1 LICENSE As is. =back =head1 MAGIC MARKERS #%# family=contrib #%# capabilities=autoconf =cut case $1 in config) echo "graph_title Consumables level @ $HOST" echo 'graph_vlabel %' echo 'graph_category printers' echo 'graph_args --upper-limit 100 -l 0' echo 'graph_scale no' echo 'cyan.label Cyan toner level' echo 'cyan.draw LINE2' echo 'cyan.type GAUGE' echo 'cyan.colour 1921B1' echo 'cyan.warning 5:' echo 'cyan.critical 1:' echo 'cyan.min 0' echo 'cyan.max 100' echo 'magenta.label Magenta toner level' echo 'magenta.draw LINE2' echo 'magenta.type GAUGE' echo 'magenta.colour C00086' echo 'magenta.warning 5:' echo 'magenta.critical 1:' echo 'magenta.min 0' echo 'magenta.max 100' echo 'yellow.label Yellow toner level' echo 'yellow.draw LINE2' echo 'yellow.type GAUGE' echo 'yellow.colour FECD00' echo 'yellow.warning 5:' echo 'yellow.critical 1:' echo 'yellow.min 0' echo 'yellow.max 100' echo 'black.label Black toner level' echo 'black.draw LINE2' echo 'black.type GAUGE' echo 'black.colour 000000' echo 'black.warning 5:' echo 'black.critical 1:' echo 'black.min 0' echo 'black.max 100' echo 'drum.label Drum unit resource left' echo 'drum.draw LINE2' echo 'drum.type GAUGE' echo 'drum.colour 00C12B' echo 'drum.warning 5:' echo 'drum.critical 1:' echo 'drum.min 0' echo 'drum.max 100' exit 0;; esac BLACK_MAX_OID=".1.3.6.1.2.1.43.11.1.1.8.1.1" BLACK_LVL_OID=".1.3.6.1.2.1.43.11.1.1.9.1.1" YELLOW_MAX_OID=".1.3.6.1.2.1.43.11.1.1.8.1.2" YELLOW_LVL_OID=".1.3.6.1.2.1.43.11.1.1.9.1.2" MAGENTA_MAX_OID=".1.3.6.1.2.1.43.11.1.1.8.1.3" MAGENTA_LVL_OID=".1.3.6.1.2.1.43.11.1.1.9.1.3" CYAN_MAX_OID=".1.3.6.1.2.1.43.11.1.1.8.1.4" CYAN_LVL_OID=".1.3.6.1.2.1.43.11.1.1.9.1.4" DRUM_MAX_OID=".1.3.6.1.2.1.43.11.1.1.8.1.24" DRUM_LVL_OID=".1.3.6.1.2.1.43.11.1.1.9.1.24" BLACK_MAX=`snmpget -v 1 -c public -Ov -Oq $HOST $BLACK_MAX_OID` BLACK_LVL=`snmpget -v 1 -c public -Ov -Oq $HOST $BLACK_LVL_OID` BLACK_LVL_PERCENTS=$(($BLACK_LVL*100/$BLACK_MAX)) YELLOW_MAX=`snmpget -v 1 -c public -Ov -Oq $HOST $YELLOW_MAX_OID` YELLOW_LVL=`snmpget -v 1 -c public -Ov -Oq $HOST $YELLOW_LVL_OID` YELLOW_LVL_PERCENTS=$(($YELLOW_LVL*100/$YELLOW_MAX)) MAGENTA_MAX=`snmpget -v 1 -c public -Ov -Oq $HOST $MAGENTA_MAX_OID` MAGENTA_LVL=`snmpget -v 1 -c public -Ov -Oq $HOST $MAGENTA_LVL_OID` MAGENTA_LVL_PERCENTS=$(($MAGENTA_LVL*100/$MAGENTA_MAX)) CYAN_MAX=`snmpget -v 1 -c public -Ov -Oq $HOST $CYAN_MAX_OID` CYAN_LVL=`snmpget -v 1 -c public -Ov -Oq $HOST $CYAN_LVL_OID` CYAN_LVL_PERCENTS=$(($CYAN_LVL*100/$CYAN_MAX)) DRUM_MAX=`snmpget -v 1 -c public -Ov -Oq $HOST $DRUM_MAX_OID` DRUM_LVL=`snmpget -v 1 -c public -Ov -Oq $HOST $DRUM_LVL_OID` DRUM_LVL_PERCENTS=$(($DRUM_LVL*100/$DRUM_MAX)) echo -n "cyan.value " echo $CYAN_LVL_PERCENTS echo -n "magenta.value " echo $MAGENTA_LVL_PERCENTS echo -n "yellow.value " echo $YELLOW_LVL_PERCENTS echo -n "black.value " echo $BLACK_LVL_PERCENTS echo -n "drum.value " echo $DRUM_LVL_PERCENTS