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

65 lines
1.2 KiB
Text
Raw Normal View History

2009-03-29 16:50:51 +02:00
#!/bin/sh
#
myname=`basename $0 | sed 's/^hp2600_count_//g'`
name="${name-}"
REGEX="${regex-\<$name\>}"
printer_ip=$name
printer_ip='10.34.9.12'
get_data (){
/usr/local/bin/wget -q -O - http://${printer_ip}/SSI/supply_status_info.htm | egrep -e '>[0-9]+'| awk -F '(<|>)' '{a=$5; sub("%"," ",a);sub("\r","",a); print a}'
}
do_stats () {
count=1
for I in `get_data`; do
[ $count = 3 ] && echo "countb.value $I"
[ $count = 6 ] && echo "county.value $I"
[ $count = 9 ] && echo "countc.value $I"
[ $count = 12 ] && echo "countm.value $I"
count=$(($count + 1))
done
}
case $1 in
config)
cat <<'EOF'
host_name printers
graph_title HP 2600 pages by cartridge statistics
graph_vlabel Count (Pages)
2014-09-07 14:20:12 +02:00
graph_category printer
2009-03-29 16:50:51 +02:00
graph_info Pages count by color.
graph_args -l 0
graph_scale no
line.label ---
line.line 0
countb.label Black
countb.draw AREA
countb.colour 000000
countb.min 0
county.label Yellow
county.min 0
county.draw STACK
county.colour ffff00
countc.label Cyan
countc.min 0
countc.draw STACK
countc.colour 00ffff
countm.label Magenta
countm.min 0
countm.draw STACK
countm.colour ff00ff
EOF
exit 0
;;
esac
do_stats
#EOF