Plugin Munin pour l'tat de l'imprimante.

darcs-hash:20061010222609-68412-72b7c1e2d022ba4e71571c7fa2b29a3f63ae60bf.gz
This commit is contained in:
glondu 2006-10-11 00:26:09 +02:00
parent 45a4040af1
commit d9872f5205

49
munin/etat_imprimante Executable file
View file

@ -0,0 +1,49 @@
#!/usr/bin/env python
# -*- coding: iso-8859-15 -*
import sys
sys.path.append("/usr/scripts/gestion")
import hptools
dico = {
"PrÁt": 1,
"Pr menus, appuy \x1e": 0,
"Powersave activÅ": 3,
"Verification": 2,
"imprimante": 0,
"PrÅchauffage": 1,
"Traitement de la": 0,
"tÀche du bac 4": 0,
"COMMANDER CARTOUCHE": 0,
"": 0,
}
def etat():
""" Renvoie une liste des differents ecrans actuels du display de l'imprimante """
liste_oid = ["mib-2.43.16.5.1.2.1.1","mib-2.43.16.5.1.2.1.2","mib-2.43.16.5.1.2.1.3","mib-2.43.16.5.1.2.1.4","mib-2.43.16.5.1.2.1.5"]
total = 0
try:
comm = hptools.snmp(host="laserjet.adm.crans.org", version="1", community="public")
for oid in liste_oid:
total += dico.get(comm.get_string(oid), 4)
except Exception, err:
total += 24
return total
if len(sys.argv) > 1:
arg = sys.argv[1]
else:
arg = ''
if arg == "config":
# Ecrit sur la sortie standard la configuration
print 'host_name laserjet'
print "graph_args --base 1 --lower-limit 0 --upper-limit 10"
print "graph_title Etat de l'imprimante"
print "graph_vlabel 0: no problem, 40: ragnarok"
print "etat.draw LINE2"
print "etat.label Estimation des embrouilles"
else:
# Ecrit les valeurs actuelles sur la sortie standard
print "etat.value %s" % etat()