From 183617da519217142618194b682a2c617cec4535 Mon Sep 17 00:00:00 2001 From: Lucas Serrano Date: Sat, 11 Jan 2014 19:15:39 +0100 Subject: [PATCH] =?UTF-8?q?[printer=5Fwatch]=20On=20v=C3=A9rifie=20aussi?= =?UTF-8?q?=20quand=20l'imprimante=20est=20en=20warning?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sinon Ping est un boulet --- impression/printer_watch.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/impression/printer_watch.py b/impression/printer_watch.py index 5938ad2e..dc45ba0b 100755 --- a/impression/printer_watch.py +++ b/impression/printer_watch.py @@ -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.