mirror of
https://github.com/TheNetworkGuy/netbox-zabbix-sync.git
synced 2025-07-13 23:27:32 -06:00
Added VM filtering
This commit is contained in:
parent
30545ec0f3
commit
09a6906a63
@ -63,6 +63,8 @@ traverse_site_groups = False
|
||||
|
||||
# Default device filter, only get devices which have a name in Netbox:
|
||||
nb_device_filter = {"name__n": "null"}
|
||||
# Default filter for VMs
|
||||
vm_device_filter = {"name__n": "null"}
|
||||
|
||||
## Inventory
|
||||
# See https://www.zabbix.com/documentation/current/en/manual/config/hosts/inventory#building-inventory
|
||||
|
@ -24,7 +24,8 @@ try:
|
||||
hostgroup_format,
|
||||
vm_hostgroup_format,
|
||||
nb_device_filter,
|
||||
sync_vms
|
||||
sync_vms,
|
||||
vm_device_filter
|
||||
)
|
||||
except ModuleNotFoundError:
|
||||
print("Configuration file config.py not found in main directory."
|
||||
@ -119,7 +120,7 @@ def main(arguments):
|
||||
proxy_name = "name"
|
||||
# Get all Zabbix and Netbox data
|
||||
netbox_devices = netbox.dcim.devices.filter(**nb_device_filter)
|
||||
netbox_vms = netbox.virtualization.virtual_machines.all() if sync_vms else []
|
||||
netbox_vms = netbox.virtualization.virtual_machines.filter(**vm_device_filter) if sync_vms else []
|
||||
netbox_site_groups = convert_recordset((netbox.dcim.site_groups.all()))
|
||||
netbox_regions = convert_recordset(netbox.dcim.regions.all())
|
||||
netbox_journals = netbox.extras.journal_entries
|
||||
|
Loading…
Reference in New Issue
Block a user