This commit is contained in:
Adrien Bourmault 2022-02-14 17:41:42 +01:00
parent e23e1a49d8
commit fd66274527
No known key found for this signature in database
GPG Key ID: 6EB408FE0ACEC664
2 changed files with 17 additions and 3 deletions

View File

@ -49,8 +49,12 @@ def cmdmainteneur(owners, nick, text, store):
if len(splittedtext) == 2: if len(splittedtext) == 2:
host = splittedtext[1] host = splittedtext[1]
for realhost in store.knownHosts:
if host in realhost:
return "le responsable de cette machine est " \ return "le responsable de cette machine est " \
+ store.knownHosts[host].maintainer + store.knownHosts[realhost].maintainer
else:
return "machine inconnue (tout le monde est son mainteneur ou bien elle n'existe pas)"
if len(splittedtext) == 3: if len(splittedtext) == 3:
host = splittedtext[1] host = splittedtext[1]

12
data.py
View File

@ -135,8 +135,18 @@ class DataStore:
# If this notification is a problem # If this notification is a problem
if not "OK" in status: 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 # 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)" \ message = "je détecte un problème général (%s)" \
" sur %s (%s)" % (status, host, text) " sur %s (%s)" % (status, host, text)
# send notification # send notification