Projet

Général

Profil

Paste
Télécharger au format
Statistiques
| Branche: | Révision:

root / plugins / printer / hp2600_count_ @ 17f78427

Historique | Voir | Annoter | Télécharger (1,16 ko)

1
#!/bin/sh
2
#
3

    
4
myname=`basename $0 | sed 's/^hp2600_count_//g'`
5

    
6
name="${name-}"
7
REGEX="${regex-\<$name\>}"
8

    
9
printer_ip=$name
10
printer_ip='10.34.9.12'
11

    
12
get_data (){
13
    /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}'
14
}
15

    
16
do_stats () {
17
    count=1
18
    for I in `get_data`; do
19
	[ $count = 3 ]  && echo "countb.value $I"
20
	[ $count = 6 ]  && echo "county.value $I"
21
	[ $count = 9 ]  && echo "countc.value $I"
22
	[ $count = 12 ] && echo "countm.value $I"
23
	count=$(($count + 1))
24
    done
25

    
26
}
27

    
28
case $1 in
29
    config)
30
        cat <<'EOF'
31
host_name printers
32
graph_title HP 2600 pages by cartridge statistics
33
graph_vlabel Count (Pages)
34
graph_category printing
35
graph_info Pages count by color.
36
graph_args  -l 0
37
graph_scale no
38
line.label ---
39
line.line 0
40
countb.label Black
41
countb.draw AREA
42
countb.colour 000000
43
countb.min 0
44
county.label Yellow
45
county.min 0
46
county.draw STACK
47
county.colour ffff00
48
countc.label Cyan
49
countc.min 0
50
countc.draw STACK
51
countc.colour 00ffff
52
countm.label Magenta
53
countm.min 0
54
countm.draw STACK
55
countm.colour ff00ff
56
EOF
57
        exit 0
58
        ;;
59
esac
60

    
61
do_stats
62

    
63

    
64
#EOF