diff --git a/modules/device.py b/modules/device.py index 6b00846..cf0e2a2 100644 --- a/modules/device.py +++ b/modules/device.py @@ -2,7 +2,6 @@ """ Device specific handeling for NetBox to Zabbix """ -from pprint import pprint from copy import deepcopy from logging import getLogger diff --git a/netbox_zabbix_sync.py b/netbox_zabbix_sync.py index 79fa27e..3a03f66 100755 --- a/netbox_zabbix_sync.py +++ b/netbox_zabbix_sync.py @@ -166,6 +166,9 @@ def main(arguments): # Check if a valid hostgroup has been found for this VM. if not vm.hostgroups: continue + if config["extended_site_properties"] and nb_vm.site: + logger.debug("VM %s: extending site information.", vm.name) + vm.site=(convert_recordset(netbox.dcim.sites.filter(id=nb_vm.site.id))) vm.set_inventory(nb_vm) vm.set_usermacros() vm.set_tags() @@ -238,6 +241,9 @@ def main(arguments): device.name, ) continue + if config["extended_site_properties"] and nb_device.site: + logger.debug("Device %s: extending site information.", device.name) + device.site=(convert_recordset(netbox.dcim.sites.filter(id=nb_device.site.id))) device.set_inventory(nb_device) device.set_usermacros() device.set_tags()