This commit is contained in:
Adrien Bourmault 2022-02-07 20:43:35 +01:00 committed by admin666
parent f48e41bd4b
commit aefd66009f
1 changed files with 20 additions and 13 deletions

View File

@ -45,7 +45,11 @@ class ServiceData:
text = self.serviceData[host][service]["text"] text = self.serviceData[host][service]["text"]
msg = "(néant)" msg = "(néant)"
if self.serviceData[host][service]["status_type"] == "PROBLEM": if self.serviceData[host]["status_type"] == "PROBLEM" or
self.serviceData[host]["status_type"] == "UNKNOWN":
msg = "{}, je détecte de multiples problèmes sur {}".format(maintainer, host)
elif self.serviceData[host][service]["status_type"] == "PROBLEM":
msg = "{}, je détecte un problème de {} sur {} ({})".format(maintainer, service, host, text) msg = "{}, je détecte un problème de {} sur {} ({})".format(maintainer, service, host, text)
elif self.serviceData[host][service]["status_type"] == "UNKNOWN": elif self.serviceData[host][service]["status_type"] == "UNKNOWN":
@ -93,13 +97,15 @@ class ServiceData:
# Is it a service and is it known # Is it a service and is it known
if service and service in self.serviceData[host]: if service and service in self.serviceData[host]:
# update host if needed # update host if needed
if status_type != self.serviceData[host][service]["status_type"]:
self.serviceData[host][service]["status_state"] = status_state self.serviceData[host][service]["status_state"] = status_state
self.serviceData[host][service]["status_type"] = status_type self.serviceData[host][service]["status_type"] = status_type
self.serviceData[host][service]["destmuc"] = destmuc self.serviceData[host][service]["destmuc"] = destmuc
self.serviceData[host][service]["text"] = text self.serviceData[host][service]["text"] = text
self.serviceData[host][service]["needUpdate"] = True
maintainer = self.serviceData[host]["maintainer"] maintainer = self.serviceData[host]["maintainer"]
if status_type != self.serviceData[host][service]["status_type"] and
status_type != self.serviceData[host]["status_type"]:
self.serviceData[host][service]["needUpdate"] = True
# Is it an unkown service # Is it an unkown service
elif service: elif service:
@ -109,19 +115,20 @@ class ServiceData:
self.serviceData[host][service]["status_state"] = status_state self.serviceData[host][service]["status_state"] = status_state
self.serviceData[host][service]["status_type"] = status_type self.serviceData[host][service]["status_type"] = status_type
self.serviceData[host][service]["text"] = text self.serviceData[host][service]["text"] = text
self.serviceData[host][service]["needUpdate"] = True
maintainer = self.serviceData[host]["maintainer"] maintainer = self.serviceData[host]["maintainer"]
if status_type != self.serviceData[host]["status_type"]:
self.serviceData[host][service]["needUpdate"] = True
# This is a host (not a service) # This is a host (not a service)
else: else:
# update host if needed # update host if needed
if status_type != self.serviceData[host]["status_type"]:
self.serviceData[host]["destmuc"] = destmuc self.serviceData[host]["destmuc"] = destmuc
self.serviceData[host]["status_state"] = status_state self.serviceData[host]["status_state"] = status_state
self.serviceData[host]["status_type"] = status_type self.serviceData[host]["status_type"] = status_type
self.serviceData[host]["text"] = text self.serviceData[host]["text"] = text
self.serviceData[host]["needUpdate"] = True
maintainer = self.serviceData[host]["maintainer"] maintainer = self.serviceData[host]["maintainer"]
if status_type != self.serviceData[host]["status_type"]:
self.serviceData[host]["needUpdate"] = True
# That host is not known # That host is not known
else: else: