From 1d98384629d8ca6c5ec42d8a892b761ad8706a30 Mon Sep 17 00:00:00 2001 From: Raymond Kuiper Date: Fri, 23 Feb 2024 15:14:50 +0100 Subject: [PATCH] Update netbox_zabbix_sync.py Zabbix 7.0.0 and higher changed the proxy.get api call, this commit fixes that api call by checking against the API version. --- netbox_zabbix_sync.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/netbox_zabbix_sync.py b/netbox_zabbix_sync.py index 4230dbf..7930134 100755 --- a/netbox_zabbix_sync.py +++ b/netbox_zabbix_sync.py @@ -2,6 +2,7 @@ """Netbox to Zabbix sync script.""" from os import environ, path, sys +from packaging import version import logging import argparse from pynetbox import api @@ -88,7 +89,10 @@ def main(arguments): netbox_journals = netbox.extras.journal_entries zabbix_groups = zabbix.hostgroup.get(output=['groupid', 'name']) zabbix_templates = zabbix.template.get(output=['templateid', 'name']) - zabbix_proxys = zabbix.proxy.get(output=['proxyid', 'host']) + if version.parse(zabbix.api_version()) < version.parse("7.0.0"): + zabbix_proxys = zabbix.proxy.get(output=['proxyid', 'host']) + else: + zabbix_proxys = zabbix.proxy.get(output=['proxyid', 'name']) # Go through all Netbox devices for nb_device in netbox_devices: try: