From c12543ba82adad82045054d73dfba047dd263b00 Mon Sep 17 00:00:00 2001 From: Adrien Bourmault Date: Mon, 14 Feb 2022 19:13:17 +0100 Subject: [PATCH] ajout du downtime --- data.py | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/data.py b/data.py index 4177269..3a24136 100644 --- a/data.py +++ b/data.py @@ -20,6 +20,7 @@ class HostData: # Concerning host self.type = "" self.status = "OK" + self.downtime = False # Concerning services self.statuses = {} @@ -179,8 +180,22 @@ 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) # General problem - if not service and problemCount == 0: + elif not service and problemCount == 0: message = "fin d'alerte générale sur" \ " sur %s (%s)" % (host, text) # send notification