From 1673f7bb5914951ad152ccd91d9d49dc5a28480e Mon Sep 17 00:00:00 2001 From: TheNetworkGuy Date: Thu, 23 Jan 2025 13:54:23 +0100 Subject: [PATCH 1/3] Downgrade to old version of zabbix_utils for Zabbix 7.2. Referenced in #91 --- requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requirements.txt b/requirements.txt index a48114c..33f4b90 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,2 +1,2 @@ pynetbox -zabbix_utils +zabbix-utils==2.0.1 From 5617275594290a63331b0ec54af99d781f617699 Mon Sep 17 00:00:00 2001 From: TheNetworkGuy Date: Tue, 4 Feb 2025 12:40:13 +0100 Subject: [PATCH 2/3] implements fix for hostgroup - host API call --- modules/device.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/modules/device.py b/modules/device.py index 07554d0..e8964ba 100644 --- a/modules/device.py +++ b/modules/device.py @@ -540,6 +540,7 @@ class PhysicalDevice(): 'port', 'details', 'interfaceid'], selectGroups=["groupid"], + selectHostGroups=["groupid"], selectParentTemplates=["templateid"], selectInventory=list(inventory_map.values())) if len(host) > 1: @@ -582,7 +583,11 @@ class PhysicalDevice(): else: self.logger.debug(f"Host {self.name}: template(s) in-sync.") - for group in host["groups"]: + # Check if Zabbix version is 6 or higher. Issue #93 + group_dictname = "hostgroups" + if str(self.zabbix.version).startswith('6'): + group_dictname = "groups" + for group in host[group_dictname]: if group["groupid"] == self.group_id: self.logger.debug(f"Host {self.name}: hostgroup in-sync.") break From 7a671d6625f6364073eded27e6987190f013be80 Mon Sep 17 00:00:00 2001 From: TheNetworkGuy Date: Tue, 4 Feb 2025 12:46:00 +0100 Subject: [PATCH 3/3] Also added backwards support for Zabbix 5 --- modules/device.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/device.py b/modules/device.py index e8964ba..2ed37e8 100644 --- a/modules/device.py +++ b/modules/device.py @@ -585,7 +585,7 @@ class PhysicalDevice(): # Check if Zabbix version is 6 or higher. Issue #93 group_dictname = "hostgroups" - if str(self.zabbix.version).startswith('6'): + if str(self.zabbix.version).startswith(('6', '5')): group_dictname = "groups" for group in host[group_dictname]: if group["groupid"] == self.group_id: