Projet

Général

Profil

Révision 2495adf9

ID2495adf9833f7a954a151642507db5c7b7955cb4
Parent 5a185140
Enfant 58090489

Ajouté par Oleksiy Kochkin il y a presque 14 ans

Initial version

Voir les différences:

plugins/other/snmp_hplj2015
1
#!/bin/bash
2

  
3
HOST=${host:-"127.0.0.1"}
4

  
5
: << =cut
6

  
7
=head1 NAME
8

  
9
snmp_HPLJ2015 - Consumables level on HP LaserJet 2015n reported over SNMP
10

  
11
=head1 CONFIGURATION
12

  
13
HOST
14

  
15
=head1 AUTHOR
16

  
17
Oleksiy Kochkin
18

  
19
=head1 LICENSE
20

  
21
As is.
22

  
23
=back
24

  
25
=head1 MAGIC MARKERS
26

  
27
 #%# family=contrib
28
 #%# capabilities=autoconf
29

  
30
=cut
31

  
32
case $1 in
33
config)
34

  
35
echo "graph_title Consumables level @ $HOST"
36
echo 'graph_args --upper-limit 100 -l 0'
37
echo 'graph_vlabel %'
38
echo 'graph_category printers'
39
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
BLACK_MAX_OID=".1.3.6.1.2.1.43.11.1.1.8.1.1"
52
BLACK_LVL_OID=".1.3.6.1.2.1.43.11.1.1.9.1.1"
53

  
54
BLACK_MAX=`snmpget -v 1 -c public -Ov -Oq $HOST $BLACK_MAX_OID`
55
BLACK_LVL=`snmpget -v 1 -c public -Ov -Oq $HOST $BLACK_LVL_OID`
56
BLACK_LVL_PERCENTS=$(($BLACK_LVL*100/$BLACK_MAX))
57

  
58
echo -n "black.value "
59
echo $BLACK_LVL_PERCENTS

Formats disponibles : Unified diff