diff --git a/Nagstamon/Servers/Alertmanager/alertmanagerserver.py b/Nagstamon/Servers/Alertmanager/alertmanagerserver.py index cab61547e..eb578fc6b 100644 --- a/Nagstamon/Servers/Alertmanager/alertmanagerserver.py +++ b/Nagstamon/Servers/Alertmanager/alertmanagerserver.py @@ -213,7 +213,7 @@ def _get_status(self): # check if any error occured errors_occured = self.check_for_error(data, error, status_code) - if errors_occured is not False: + if errors_occured is not None: return errors_occured for alert in data: diff --git a/Nagstamon/Servers/Centreon/CentreonLegacy.py b/Nagstamon/Servers/Centreon/CentreonLegacy.py index 0482ff014..76ad00859 100644 --- a/Nagstamon/Servers/Centreon/CentreonLegacy.py +++ b/Nagstamon/Servers/Centreon/CentreonLegacy.py @@ -604,7 +604,7 @@ def _get_status(self): errors_occured = self.check_for_error(xmlobj, error, status_code) # if there are errors return them - if errors_occured: + if errors_occured is not None: return(errors_occured) # Check if the result is not empty @@ -625,7 +625,7 @@ def _get_status(self): xmlobj, error, status_code = result.result, result.error, result.status_code errors_occured = self.check_for_error(xmlobj, error, status_code) # if there are errors return them - if errors_occured: + if errors_occured is not None: return(errors_occured) # a second time a bad session id should raise an error @@ -690,7 +690,7 @@ def _get_status(self): # check if any error occured errors_occured = self.check_for_error(xmlobj, error, status_code) # if there are errors return them - if errors_occured: + if errors_occured is not None: return(errors_occured) # Check if the result is not empty @@ -710,7 +710,7 @@ def _get_status(self): xmlobj, error, status_code = result.result, result.error, result.status_code errors_occured = self.check_for_error(xmlobj, error, status_code) # if there are errors return them - if errors_occured: + if errors_occured is not None: return(errors_occured) # a second time a bad session id should raise an error @@ -735,7 +735,7 @@ def _get_status(self): errors_occured = self.check_for_error(xmlobj_meta, error_meta, status_code_meta) # if there are errors return them - if errors_occured: + if errors_occured is not None: return(errors_occured) # a second time a bad session id should raise an error diff --git a/Nagstamon/Servers/Generic.py b/Nagstamon/Servers/Generic.py index c541c1320..d160ba69e 100644 --- a/Nagstamon/Servers/Generic.py +++ b/Nagstamon/Servers/Generic.py @@ -648,7 +648,7 @@ def _get_status(self): # check if any error occured errors_occured = self.check_for_error(htobj, error, status_code) # if there are errors return them - if errors_occured is not False: + if errors_occured is not None: return(errors_occured) # put a copy of a part of htobj into table to be able to delete htobj @@ -773,7 +773,7 @@ def _get_status(self): # check if any error occured errors_occured = self.check_for_error(htobj, error, status_code) # if there are errors return them - if errors_occured is not False: + if errors_occured is not None: return(errors_occured) # too much copy.deepcopy()s here give recursion crashs diff --git a/Nagstamon/Servers/Icinga.py b/Nagstamon/Servers/Icinga.py index ccbc0a3f4..81b2a4ae3 100644 --- a/Nagstamon/Servers/Icinga.py +++ b/Nagstamon/Servers/Icinga.py @@ -167,7 +167,7 @@ def _get_status_JSON(self): # check if any error occured errors_occured = self.check_for_error(jsonraw, error, status_code) # if there are errors return them - if errors_occured: + if errors_occured is not None: return(errors_occured) jsondict = json.loads(jsonraw) @@ -231,7 +231,7 @@ def _get_status_JSON(self): # check if any error occured errors_occured = self.check_for_error(jsonraw, error, status_code) # if there are errors return them - if errors_occured: + if errors_occured is not None: return(errors_occured) jsondict = json.loads(jsonraw) @@ -339,7 +339,7 @@ def _get_status_HTML(self): # check if any error occured errors_occured = self.check_for_error(htobj, error, status_code) # if there are errors return them - if errors_occured: + if errors_occured is not None: return(errors_occured) # put a copy of a part of htobj into table to be able to delete htobj @@ -468,7 +468,7 @@ def _get_status_HTML(self): # check if any error occured errors_occured = self.check_for_error(htobj, error, status_code) # if there are errors return them - if errors_occured: + if errors_occured is not None: return(errors_occured) table = htobj('table', {'class': 'status'})[0] diff --git a/Nagstamon/Servers/IcingaDBWeb.py b/Nagstamon/Servers/IcingaDBWeb.py index a09441179..9370d3c2b 100644 --- a/Nagstamon/Servers/IcingaDBWeb.py +++ b/Nagstamon/Servers/IcingaDBWeb.py @@ -161,7 +161,7 @@ def _get_status(self): # check if any error occured potential_error = self.check_for_error(jsonraw, error, status_code) - if potential_error: + if potential_error is not None: return potential_error # Check if the backend is running diff --git a/Nagstamon/Servers/IcingaDBWebNotifications.py b/Nagstamon/Servers/IcingaDBWebNotifications.py index 3d1c356df..41109df25 100644 --- a/Nagstamon/Servers/IcingaDBWebNotifications.py +++ b/Nagstamon/Servers/IcingaDBWebNotifications.py @@ -86,7 +86,7 @@ def _update_new_host_content(self) -> Result: # check if any error occurred potential_error = self.check_for_error(result.result, result.error, result.status_code) - if potential_error: + if potential_error is not None: return potential_error # HEALTH CHECK diff --git a/Nagstamon/Servers/Opsview.py b/Nagstamon/Servers/Opsview.py index fe47ea0ef..ea9577fec 100644 --- a/Nagstamon/Servers/Opsview.py +++ b/Nagstamon/Servers/Opsview.py @@ -244,7 +244,7 @@ def _get_status(self): # check if any error occured errors_occured = self.check_for_error(data, error, status_code) # if there are errors return them - if errors_occured: + if errors_occured is not None: return errors_occured if conf.debug_mode: diff --git a/Nagstamon/Servers/Prometheus.py b/Nagstamon/Servers/Prometheus.py index 53e8b777b..5b502dc16 100644 --- a/Nagstamon/Servers/Prometheus.py +++ b/Nagstamon/Servers/Prometheus.py @@ -155,7 +155,7 @@ def _get_status(self): # check if any error occured errors_occured = self.check_for_error(data, error, status_code) - if errors_occured is not False: + if errors_occured is not None: return(errors_occured) if conf.debug_mode: diff --git a/Nagstamon/Servers/Thruk.py b/Nagstamon/Servers/Thruk.py index 1d0b33959..209f16223 100644 --- a/Nagstamon/Servers/Thruk.py +++ b/Nagstamon/Servers/Thruk.py @@ -279,7 +279,7 @@ def _get_status(self): # check if any error occured errors_occured = self.check_for_error(jsonraw, error, status_code) # if there are errors return them - if errors_occured: + if errors_occured is not None: return(errors_occured) # in case basic auth did not work try form login cookie based login @@ -327,7 +327,7 @@ def _get_status(self): # check if any error occured errors_occured = self.check_for_error(jsonraw, error, status_code) # if there are errors return them - if errors_occured: + if errors_occured is not None: return(errors_occured) # in case basic auth did not work try form login cookie based login diff --git a/Nagstamon/Servers/op5Monitor.py b/Nagstamon/Servers/op5Monitor.py index 80f063c6e..9d520a353 100644 --- a/Nagstamon/Servers/op5Monitor.py +++ b/Nagstamon/Servers/op5Monitor.py @@ -151,7 +151,7 @@ def _get_status(self): # check if any error occured errors_occured = self.check_for_error(data, error, status_code) # if there are errors return them - if errors_occured: + if errors_occured is not None: return(errors_occured) if data['count']: @@ -212,7 +212,7 @@ def _get_status(self): # check if any error occured errors_occured = self.check_for_error(data, error, status_code) # if there are errors return them - if errors_occured: + if errors_occured is not None: return(errors_occured) if data['count']: