Projet

Général

Profil

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

root / plugins / printer / xerox-wc7232-consumables @ e0f0fb86

Historique | Voir | Annoter | Télécharger (2,51 ko)

1
#!/bin/sh
2

    
3
PRINTER_IP=${host:-"10.10.10.10"}
4
TMP_DIR=${tmp:-"/tmp"}
5

    
6
: << =cut
7

    
8
=head1 NAME
9

    
10
Xerox-WC7232-consumables - Plugin to monitor consumables level and status on Xerox WorkCentre 7232
11

    
12
=head1 CONFIGURATION
13

    
14
PRINTER_IP
15

    
16
=head1 AUTHOR
17

    
18
Oleksiy Kochkin
19

    
20
=head1 LICENSE
21

    
22
As is.
23

    
24
=back
25

    
26
=head1 MAGIC MARKERS
27

    
28
 #%# family=contrib
29
 #%# capabilities=autoconf
30
  
31
=cut
32

    
33
case $1 in
34
config)
35

    
36
echo "graph_title Consumables level @ $PRINTER_IP"
37
echo 'graph_vlabel %'
38
echo 'graph_category printers'
39
echo 'graph_scale no'
40
echo 'cyan.label Cyan toner level'
41
echo 'cyan.draw LINE2'
42
echo 'cyan.type GAUGE'
43
echo 'cyan.colour 1921B1'
44
echo 'cyan.warning 5:'
45
echo 'cyan.critical 1:'
46
echo 'cyan.min 0'
47
echo 'cyan.max 100'
48
echo 'magenta.label Magenta toner level'
49
echo 'magenta.draw LINE2'
50
echo 'magenta.type GAUGE'
51
echo 'magenta.colour C00086'
52
echo 'magenta.warning 5:'
53
echo 'magenta.critical 1:'
54
echo 'magenta.min 0'
55
echo 'magenta.max 100'
56
echo 'yellow.label Yellow toner level'
57
echo 'yellow.draw LINE2'
58
echo 'yellow.type GAUGE'
59
echo 'yellow.colour FECD00'
60
echo 'yellow.warning 5:'
61
echo 'yellow.critical 1:'
62
echo 'yellow.min 0'
63
echo 'yellow.max 100'
64
echo 'black.label Black toner level'
65
echo 'black.draw LINE2'
66
echo 'black.type GAUGE'
67
echo 'black.colour 000000'
68
echo 'black.warning 5:'
69
echo 'black.critical 1:'
70
echo 'black.min 0'
71
echo 'black.max 100'
72
echo 'drum.label Drum unit resource left'
73
echo 'drum.draw LINE2'
74
echo 'drum.type GAUGE'
75
echo 'drum.colour 00C12B'
76
echo 'drum.warning 5:'
77
echo 'drum.critical 1:'
78
echo 'drum.min 0'
79
echo 'drum.max 100'
80
exit 0;;
81
esac
82

    
83
wget -q -o /dev/null -O $TMP_DIR/$PRINTER_IP-stsply.htm http://$PRINTER_IP/stsply.htm
84

    
85
#toner and drum cartriges have both status and percentage
86

    
87
TONER_STR=$(grep Toner "$TMP_DIR/$PRINTER_IP-stsply.htm") 
88
#info=info.concat([['Toner Cartridges',[['Cyan Toner [C]',0,77],['Magenta Toner [M]',7,1],['Yellow Toner [Y]',7,1],['Black Toner [K]',0,39]],3]]);
89

    
90
DRUM_STR=$(grep Drum "$TMP_DIR/$PRINTER_IP-stsply.htm") 
91
#info=info.concat([['Drum Cartridges',[['Drum Cartridges',0,79]],1]]);
92

    
93
echo -n "cyan.value "
94
echo $TONER_STR | egrep -o "C]',[0-9],[0-9]{1,2}" | egrep -o "[0-9]{1,2}$"
95

    
96
echo -n "magenta.value "
97
echo $TONER_STR | egrep -o "M]',[0-9],[0-9]{1,2}" | egrep -o "[0-9]{1,2}$"
98

    
99
echo -n "yellow.value "
100
echo $TONER_STR | egrep -o "Y]',[0-9],[0-9]{1,2}" | egrep -o "[0-9]{1,2}$"
101

    
102
echo -n "black.value "
103
echo $TONER_STR | egrep -o "K]',[0-9],[0-9]{1,2}" | egrep -o "[0-9]{1,2}$"
104

    
105
echo -n "drum.value "
106
echo $DRUM_STR | egrep -o "s',[0-9],[0-9]{1,2}" | egrep -o "[0-9]{1,2}$"
107

    
108
rm $TMP_DIR/$PRINTER_IP-stsply.htm
109