From fd662745274f83162592fdd6c2fa35ce69c56bf8 Mon Sep 17 00:00:00 2001 From: Adrien Bourmault Date: Mon, 14 Feb 2022 17:41:42 +0100 Subject: [PATCH] v0.3.0 --- commands.py | 8 ++++++-- data.py | 12 +++++++++++- 2 files changed, 17 insertions(+), 3 deletions(-) diff --git a/commands.py b/commands.py index 7fe0e3e..59af416 100644 --- a/commands.py +++ b/commands.py @@ -49,8 +49,12 @@ def cmdmainteneur(owners, nick, text, store): if len(splittedtext) == 2: host = splittedtext[1] - return "le responsable de cette machine est " \ - + store.knownHosts[host].maintainer + for realhost in store.knownHosts: + if host in realhost: + return "le responsable de cette machine est " \ + + store.knownHosts[realhost].maintainer + else: + return "machine inconnue (tout le monde est son mainteneur ou bien elle n'existe pas)" if len(splittedtext) == 3: host = splittedtext[1] diff --git a/data.py b/data.py index c033627..4177269 100644 --- a/data.py +++ b/data.py @@ -135,8 +135,18 @@ class DataStore: # If this notification is a problem if not "OK" in status: + # Unknown state + if "UNKNOWN" in cur.type and problemCount == 0: + message = "état inconnu sur (%s)" % (host, text) + # send notification + log.info("Sending to %s: %s" % (destmuc, message)) + self.linkedBot.push(destmuc, cur.maintainer+", "+message) + # Unknown state + elif "UNKNOWN" in cur.type: + pass + # General problem - if not "OK" in cur.status and problemCount == 0: + elif not "OK" in cur.status and problemCount == 0: message = "je détecte un problème général (%s)" \ " sur %s (%s)" % (status, host, text) # send notification