From 6e1aebdd019695ee6e12606c8489db39c6997087 Mon Sep 17 00:00:00 2001 From: Andriy Yakovlev Date: Sun, 29 Mar 2009 16:50:51 +0200 Subject: [PATCH] Initial version --- plugins/other/hp2600_count_ | 64 +++++++++++++++++++++++++++++++++++++ 1 file changed, 64 insertions(+) create mode 100755 plugins/other/hp2600_count_ diff --git a/plugins/other/hp2600_count_ b/plugins/other/hp2600_count_ new file mode 100755 index 00000000..c610d76a --- /dev/null +++ b/plugins/other/hp2600_count_ @@ -0,0 +1,64 @@ +#!/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 HP2600 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