From e505097305481d72583696238ba8e4d7f472d4c5 Mon Sep 17 00:00:00 2001 From: Henri Wahl <2835065+HenriWahl@users.noreply.github.com> Date: Tue, 26 Mar 2024 21:35:14 +0100 Subject: [PATCH] added zabbix api_version() --- Nagstamon/Servers/ZabbixProblemBased.py | 4 ++++ Nagstamon/thirdparty/zabbix_api.py | 3 +-- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/Nagstamon/Servers/ZabbixProblemBased.py b/Nagstamon/Servers/ZabbixProblemBased.py index 319dce01c..4cea0fc7a 100644 --- a/Nagstamon/Servers/ZabbixProblemBased.py +++ b/Nagstamon/Servers/ZabbixProblemBased.py @@ -85,6 +85,10 @@ def do_request(self, method, params={}, no_auth=False): return response_json['result'] + def api_version(self, **options): + obj = self.do_request('apiinfo.version', options, no_auth=True) + return obj['result'] + def logged_in(self): if self.zbx_auth is None: return False diff --git a/Nagstamon/thirdparty/zabbix_api.py b/Nagstamon/thirdparty/zabbix_api.py index 16bb94657..582e6391f 100644 --- a/Nagstamon/thirdparty/zabbix_api.py +++ b/Nagstamon/thirdparty/zabbix_api.py @@ -302,8 +302,7 @@ def logged_in(self): return False def api_version(self, **options): - # kicked out check auth to be able to check vesion before being logged in to use the correct username keyword - #self.__checkauth__() + # kicked out check auth to be able to check version before being logged in to use the correct username keyword obj = self.do_request(self.json_obj('apiinfo.version', options, auth=False)) return obj['result']