Projet

Général

Profil

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

root / plugins / printer / xerox-wc3220 @ 6ffd5019

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

1 f3b8a0f8 Oleksiy Kochkin
#!/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-WC3220 - Plugin to monitor consumables level and status on Xerox WorkCentre 3220
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 6ffd5019 Gabriele Pohl
echo 'graph_category printer'
39 f3b8a0f8 Oleksiy Kochkin
echo 'graph_scale no'
40
echo 'black.label Black toner level'
41
echo 'black.draw LINE2'
42
echo 'black.type GAUGE'
43
echo 'black.colour 000000'
44
echo 'black.warning 5:'
45
echo 'black.critical 1:'
46
echo 'black.min 0'
47
echo 'black.max 100'
48
exit 0;;
49
esac
50
51
wget -q -o /dev/null -O $TMP_DIR/$PRINTER_IP-Supplies.html http://$PRINTER_IP/status/Supplies.html
52
53
54
TONER_STR=$(grep "<td width=5%>" "$TMP_DIR/$PRINTER_IP-Supplies.html") 
55
#<td width=5%>99%</td>
56
57
echo -n "black.value "
58
echo $TONER_STR | egrep -o "5%>[0-9]{1,2}" | egrep -o "[0-9]{1,2}$"
59
60
61
rm $TMP_DIR/$PRINTER_IP-Supplies.html
62