[printer_watch] On vérifie aussi quand l'imprimante est en warning

Sinon Ping est un boulet
This commit is contained in:
Lucas Serrano 2014-01-11 19:15:39 +01:00
parent d80eff0154
commit 183617da51

View file

@ -24,7 +24,7 @@ except (IOError, ValueError, TypeError):
status_id = netsnmp.Varbind("hrDeviceStatus.1")
status = netsnmp.snmpget(status_id, Version=1, DestHost="imprimante.adm", Community="public")
if status == ('5',) and (not successfuly_imported or successfuly_imported and last_status == '2'):
if status == ('5',) and (not successfuly_imported or successfuly_imported and (last_status == '2' or last_status == '3')):
"""
Cas 1: L'imprimante est down et soit elle était précédemment fonctionnelle ou son statut précédent est inconnu.
On envoie un mail pour signaler qu'elle est down.
@ -44,7 +44,7 @@ if status == ('5',) and (not successfuly_imported or successfuly_imported and la
sendmail.sendmail(u"imprimante.adm@crans.org", u"impression@lists.crans.org", u"Imprimante hors service", msg, more_headers={"X-Mailer": "/usr/scripts/impression/printer_watch.py", "Message-ID": message_id})
elif status == ('2',) and successfuly_imported and last_status == '5':
elif (status == ('2',) or status == ('3',)) and successfuly_imported and last_status == '5':
"""
Cas 2: L'imprimante est fonctionnelle après une panne.
On envoi un mail pour signaler que ce n'est plus la peine de se déplacer.