mirror of
https://github.com/TheNetworkGuy/netbox-zabbix-sync.git
synced 2025-12-13 03:49:37 -06:00
Added option to extend site information for devices and vms.
This commit is contained in:
parent
9259e73617
commit
79e82c4365
@ -2,7 +2,6 @@
|
|||||||
"""
|
"""
|
||||||
Device specific handeling for NetBox to Zabbix
|
Device specific handeling for NetBox to Zabbix
|
||||||
"""
|
"""
|
||||||
from pprint import pprint
|
|
||||||
|
|
||||||
from copy import deepcopy
|
from copy import deepcopy
|
||||||
from logging import getLogger
|
from logging import getLogger
|
||||||
|
|||||||
@ -166,6 +166,9 @@ def main(arguments):
|
|||||||
# Check if a valid hostgroup has been found for this VM.
|
# Check if a valid hostgroup has been found for this VM.
|
||||||
if not vm.hostgroups:
|
if not vm.hostgroups:
|
||||||
continue
|
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_inventory(nb_vm)
|
||||||
vm.set_usermacros()
|
vm.set_usermacros()
|
||||||
vm.set_tags()
|
vm.set_tags()
|
||||||
@ -238,6 +241,9 @@ def main(arguments):
|
|||||||
device.name,
|
device.name,
|
||||||
)
|
)
|
||||||
continue
|
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_inventory(nb_device)
|
||||||
device.set_usermacros()
|
device.set_usermacros()
|
||||||
device.set_tags()
|
device.set_tags()
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user