From 5ff59a0f92b3d7996b0a729a7c43f2b88d396de2 Mon Sep 17 00:00:00 2001 From: Yannick Charton Date: Mon, 13 Nov 2023 12:11:14 +0100 Subject: [PATCH] Fixing 4d3a851 that was using isnumeric on float --- Nagstamon/Servers/IcingaDBWeb.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Nagstamon/Servers/IcingaDBWeb.py b/Nagstamon/Servers/IcingaDBWeb.py index 9370d3c2b..a22089880 100644 --- a/Nagstamon/Servers/IcingaDBWeb.py +++ b/Nagstamon/Servers/IcingaDBWeb.py @@ -208,7 +208,7 @@ def _get_status(self): else: self.new_hosts[host_name].status = self.STATES_MAPPING['hosts'][int(h['state']['soft_state'])] - if h['state']['last_update'].isnumeric(): # new version of icingadb doesnt return unix timestamp + if h['state']['last_update'].replace(".", "").isnumeric(): # new version of icingadb doesnt return unix timestamp self.new_hosts[host_name].last_check = datetime.datetime.fromtimestamp(int(float(h['state']['last_update']))) else: self.new_hosts[host_name].last_check = datetime.datetime.fromisoformat(h['state']['last_update']) @@ -237,7 +237,7 @@ def _get_status(self): # extra duration needed for calculation self.new_hosts[host_name].duration = 'n/a' if h['state']['last_state_change'] is not None: - if h['state']['last_state_change'].isnumeric(): # new version of icingadb doesnt return unix timestamp + if h['state']['last_state_change'].replace(".", "").isnumeric(): # new version of icingadb doesnt return unix timestamp duration = datetime.datetime.now() - datetime.datetime.fromtimestamp(int(float(h['state']['last_state_change']))) else: last_state_change = datetime.datetime.fromisoformat(h['state']['last_state_change']) @@ -311,7 +311,7 @@ def _get_status(self): else: self.new_hosts[host_name].services[service_name].status = self.STATES_MAPPING['services'][int(s['state']['soft_state'])] - if s['state']['last_update'].isnumeric(): # new version of icingadb doesnt return unix timestamp + if s['state']['last_update'].replace(".", "").isnumeric(): # new version of icingadb doesnt return unix timestamp self.new_hosts[host_name].services[service_name].last_check = datetime.datetime.fromtimestamp(int(float(s['state']['last_update']))) else: self.new_hosts[host_name].services[service_name].last_check = datetime.datetime.fromisoformat(s['state']['last_update']) @@ -344,7 +344,7 @@ def _get_status(self): # extra duration needed for calculation self.new_hosts[host_name].services[service_name].duration = 'n/a' if s['state']['last_state_change'] is not None: - if s['state']['last_update'].isnumeric(): # new version of icingadb doesnt return unix timestamp + if s['state']['last_update'].replace(".", "").isnumeric(): # new version of icingadb doesnt return unix timestamp duration = datetime.datetime.now() - datetime.datetime.fromtimestamp(int(float(s['state']['last_state_change']))) else: last_state_change = datetime.datetime.fromisoformat(s['state']['last_state_change'])