ajout du downtime

This commit is contained in:
Adrien Bourmault 2022-02-14 19:13:17 +01:00
parent fd66274527
commit c12543ba82
No known key found for this signature in database
GPG Key ID: 6EB408FE0ACEC664
1 changed files with 16 additions and 1 deletions

17
data.py
View File

@ -20,6 +20,7 @@ class HostData:
# Concerning host # Concerning host
self.type = "" self.type = ""
self.status = "OK" self.status = "OK"
self.downtime = False
# Concerning services # Concerning services
self.statuses = {} self.statuses = {}
@ -179,8 +180,22 @@ class DataStore:
# We have a recovery # We have a recovery
else: 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 # General problem
if not service and problemCount == 0: elif not service and problemCount == 0:
message = "fin d'alerte générale sur" \ message = "fin d'alerte générale sur" \
" sur %s (%s)" % (host, text) " sur %s (%s)" % (host, text)
# send notification # send notification