From b32fc936c66755ad7d6ea71009b47264aef32a39 Mon Sep 17 00:00:00 2001 From: Adrien Bourmault Date: Mon, 14 Feb 2022 19:25:51 +0100 Subject: [PATCH] ajout du downtime --- data.py | 34 +++++++++++++++++----------------- 1 file changed, 17 insertions(+), 17 deletions(-) diff --git a/data.py b/data.py index 266d3c9..0b73438 100644 --- a/data.py +++ b/data.py @@ -180,23 +180,23 @@ class DataStore: # We have a recovery else: - if "DOWNTIMESTART" in cur.type and not self.downtime: - message = "début de DOWNTIME" \ - " sur %s" % (host) - cur.downtime = True - # send notification - log.info("Sending to %s: %s" % (destmuc, message)) - self.linkedBot.push(destmuc, cur.maintainer+", "+message) - elif "DOWNTIMEEND" in cur.type and self.downtime: - message = "fin de DOWNTIME" \ - " sur %s" % (host) - cur.downtime = False - # send notification - log.info("Sending to %s: %s" % (destmuc, message)) - self.linkedBot.push(destmuc, cur.maintainer+", "+message) - # ignore unregistered downtimes - elif "DOWNTIME" in cur.type: - pass + if "DOWNTIME" in type: + if "DOWNTIMESTART" in type and not self.downtime: + cur.downtime = True + message = "début de downtime sur" \ + " sur %s (%s)" % (host, text) + # send notification + log.info("Sending to %s: %s" % (destmuc, message)) + self.linkedBot.push(destmuc, cur.maintainer+", "+message) + + elif "DOWNTIMEEND" in type and not self.downtime: + cur.downtime = True + message = "début de downtime sur" \ + " sur %s (%s)" % (host, text) + # send notification + log.info("Sending to %s: %s" % (destmuc, message)) + self.linkedBot.push(destmuc, cur.maintainer+", "+message) + # General problem elif not service and problemCount == 0: message = "fin d'alerte générale sur" \