2
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_
2014-09-07 14:20:12 +02:00

65 lines
1.2 KiB
Bash
Executable File

#!/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)
graph_category printer
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