2
0
mirror of https://github.com/munin-monitoring/contrib.git synced 2018-11-08 00:59:34 +01:00
contrib-munin/plugins/printer/oki_c5500_health_

43 lines
1.9 KiB
Bash
Executable File

#!/bin/bash
#
# oki_c5500_health_ munin grabber script
# 2008.03 by steve@kosada.com
destination=`basename $0 | sed 's/^oki_c5500_health_//g'`
password='foo'
if [ "$1" = "config" ]; then
echo "graph_title oki c5500 health: $destination"
echo 'graph_vlabel percent'
echo 'graph_args --lower-limit 0 --upper-limit 100'
echo 'graph_category printing'
echo "tonerCyan.label Toner: Cyan"
echo "tonerMagenta.label Toner: Magenta"
echo "tonerYellow.label Toner: Yellow"
echo "tonerBlack.label Toner: Black"
echo "drumCyan.label Drum: Cyan"
echo "drumMagenta.label Drum: Magenta"
echo "drumYellow.label Drum: Yellow"
echo "drumBlack.label Drum: Black"
echo "belt.label Belt"
echo "fuser.label Fuser"
else
infopage=`wget -q -O - http://root:$password@$destination/printer/printerinfo_top.htm | perl -p -e 's/\n/ /m'`
echo tonerCyan.value `echo $infopage | perl -p -e 's/^.+AVAILABELCYANTONER\"\ value\=\"([0-9]+)\".+$/$1/'`
echo tonerMagenta.value `echo $infopage | perl -p -e 's/^.+AVAILABELMAGENTATONER\"\ value\=\"([0-9]+)\".+$/$1/'`
echo tonerYellow.value `echo $infopage | perl -p -e 's/^.+AVAILABELYELLOWTONER\"\ value\=\"([0-9]+)\".+$/$1/'`
echo tonerBlack.value `echo $infopage | perl -p -e 's/^.+AVAILABELBLACKTONER\"\ value\=\"([0-9]+)\".+$/$1/'`
echo drumCyan.value `echo $infopage | perl -p -e 's/^.+Cyan.+cyanbar[^%]+>([0-9][0-9])%(.+)$/$1/'`
echo drumMagenta.value `echo $infopage | perl -p -e 's/^.+Magenta.+magentabar[^%]+>([0-9][0-9])%(.+)$/$1/'`
echo drumYellow.value `echo $infopage | perl -p -e 's/^.+Yellow.+yellowbar[^%]+>([0-9][0-9])%(.+)$/$1/'`
echo drumBlack.value `echo $infopage | perl -p -e 's/^.+Black.+blackbar[^%]+>([0-9][0-9])%(.+)$/$1/'`
echo belt.value `echo $infopage | perl -p -e 's/^.+Belt[^%]+%[^%]+greybar[^%]+>([0-9][0-9])%(.+)$/$1/'`
echo fuser.value `echo $infopage | perl -p -e 's/^.+Fuser[^%]+%[^%]+greybar[^%]+>([0-9][0-9])%(.+)$/$1/'`
fi