diff --git a/serviceData.py b/serviceData.py index f8f42de..b77c6ef 100644 --- a/serviceData.py +++ b/serviceData.py @@ -45,7 +45,11 @@ class ServiceData: text = self.serviceData[host][service]["text"] 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) elif self.serviceData[host][service]["status_type"] == "UNKNOWN": @@ -93,13 +97,15 @@ class ServiceData: # Is it a service and is it known if service and service in self.serviceData[host]: # 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_type"] = status_type - self.serviceData[host][service]["destmuc"] = destmuc - self.serviceData[host][service]["text"] = text + self.serviceData[host][service]["status_state"] = status_state + self.serviceData[host][service]["status_type"] = status_type + self.serviceData[host][service]["destmuc"] = destmuc + self.serviceData[host][service]["text"] = text + 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 - maintainer = self.serviceData[host]["maintainer"] + # Is it an unkown service elif service: @@ -109,19 +115,20 @@ class ServiceData: self.serviceData[host][service]["status_state"] = status_state self.serviceData[host][service]["status_type"] = status_type self.serviceData[host][service]["text"] = text - self.serviceData[host][service]["needUpdate"] = True 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) else: # update host if needed + self.serviceData[host]["destmuc"] = destmuc + self.serviceData[host]["status_state"] = status_state + self.serviceData[host]["status_type"] = status_type + self.serviceData[host]["text"] = text + maintainer = self.serviceData[host]["maintainer"] if status_type != self.serviceData[host]["status_type"]: - self.serviceData[host]["destmuc"] = destmuc - self.serviceData[host]["status_state"] = status_state - self.serviceData[host]["status_type"] = status_type - self.serviceData[host]["text"] = text self.serviceData[host]["needUpdate"] = True - maintainer = self.serviceData[host]["maintainer"] # That host is not known else: