Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Handle null JSON output in Icinga DB Web checks #999

Merged
merged 1 commit into from
Jan 8, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions Nagstamon/Servers/IcingaDBWeb.py
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,7 @@ def _get_status(self):
self.new_hosts[host_name].last_check = datetime.datetime.fromisoformat(h['state']['last_update'])

self.new_hosts[host_name].attempt = "{}/{}".format(h['state']['check_attempt'],h['max_check_attempts'])
self.new_hosts[host_name].status_information = BeautifulSoup(h['state']['output'].replace('\n', ' ').strip(), 'html.parser').text
self.new_hosts[host_name].status_information = BeautifulSoup(str(h['state']['output']).replace('\n', ' ').strip(), 'html.parser').text
self.new_hosts[host_name].passiveonly = not int(h.get('active_checks_enabled') or '0')
self.new_hosts[host_name].notifications_disabled = not int(h.get('notifications_enabled') or '0')
self.new_hosts[host_name].flapping = bool(int(h['state']['is_flapping'] or 0))
Expand Down Expand Up @@ -317,7 +317,7 @@ def _get_status(self):
self.new_hosts[host_name].services[service_name].last_check = datetime.datetime.fromisoformat(s['state']['last_update'])

self.new_hosts[host_name].services[service_name].attempt = "{}/{}".format(s['state']['check_attempt'],s['max_check_attempts'])
self.new_hosts[host_name].services[service_name].status_information = BeautifulSoup(s['state']['output'].replace('\n', ' ').strip(), 'html.parser').text
self.new_hosts[host_name].services[service_name].status_information = BeautifulSoup(str(s['state']['output']).replace('\n', ' ').strip(), 'html.parser').text
self.new_hosts[host_name].services[service_name].passiveonly = not int(s.get('active_checks_enabled') or '0')
self.new_hosts[host_name].services[service_name].notifications_disabled = not int(s.get('notifications_enabled') or '0')
self.new_hosts[host_name].services[service_name].flapping = bool(int(s['state']['is_flapping'] or 0))
Expand Down