mirror of
https://github.com/TheNetworkGuy/netbox-zabbix-sync.git
synced 2025-07-14 01:41:25 -06:00
implements fix for hostgroup - host API call
This commit is contained in:
parent
1673f7bb59
commit
5617275594
@ -540,6 +540,7 @@ class PhysicalDevice():
|
|||||||
'port', 'details',
|
'port', 'details',
|
||||||
'interfaceid'],
|
'interfaceid'],
|
||||||
selectGroups=["groupid"],
|
selectGroups=["groupid"],
|
||||||
|
selectHostGroups=["groupid"],
|
||||||
selectParentTemplates=["templateid"],
|
selectParentTemplates=["templateid"],
|
||||||
selectInventory=list(inventory_map.values()))
|
selectInventory=list(inventory_map.values()))
|
||||||
if len(host) > 1:
|
if len(host) > 1:
|
||||||
@ -582,7 +583,11 @@ class PhysicalDevice():
|
|||||||
else:
|
else:
|
||||||
self.logger.debug(f"Host {self.name}: template(s) in-sync.")
|
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:
|
if group["groupid"] == self.group_id:
|
||||||
self.logger.debug(f"Host {self.name}: hostgroup in-sync.")
|
self.logger.debug(f"Host {self.name}: hostgroup in-sync.")
|
||||||
break
|
break
|
||||||
|
Loading…
Reference in New Issue
Block a user