TheNetworkGuy / netbox-zabbix-sync

Python script to synchronise Netbox devices to Zabbix.
MIT License
109 stars 27 forks source link

Populating Netbox with Zabbix data #23

Closed KIvanov-1984 closed 1 year ago

KIvanov-1984 commented 1 year ago

Hello, I have such a question, zabbix has been used for a long time, there are many groups and devices for which metrics are configured, how to make sure that the script does not remove devices from existing groups and templates?

TheNetworkGuy commented 1 year ago

This is currently not possible or a feature. I would like to add some sort of initial sync script that pulls data from Zabbix to Netbox. However there are a couple of caveats:

  1. Host group names are automatically generated. This could be fixed or somehow modified to a different behavior with issue https://github.com/TheNetworkGuy/netbox-zabbix-sync/issues/20
  2. How can the script know what device model a Zabbix host is using for the template reference? The template is referenced under the device model, not the device self. For instance consider the following scenario:

Zabbix Host Router06 has template Router-Basic Host Router07 has template Router-Advanced

Both routers are the same device type, Juniper MX204.

How would a sync script know which template to choose for the MX204 device type? This will cause some conflicts for sure. IMO it would be better to onboard a single device or a batch of devices at a time and see if the sync goes according to plan.

JUST1CEjohnson commented 1 year ago

Curious about this too... Zabbix has all the device discovery features and Netbox does not. Seems it would make sense to do discovery with Zabbix and then auto-populate those hosts into Netbox for inventory.

TheNetworkGuy commented 1 year ago

@JUST1CEjohnson You are proposing switching the role of Source of Truth from Netbox to Zabbix. Do i interpreted this as a process for a one-time-use only to kickstart Netbox with information from Zabbix? Or as a more permanent solution where data is transferred between 2 systems? If so, which system is leading?

There are a lot of factors and data that are not structured of correctly formatted (or even present in every Zabbix installation) which are handy / almost necessary for Netbox. Obviously stuff like physical data (Site, location, rack, rack orientation and U height) but other data as well like Virtual chassis information, device type and the modules within said device.

I'm worried that a single script will never suffice for more than 50% of the use cases.

JUST1CEjohnson commented 1 year ago

I guess in my head I'm imagining just populating the hosts in Netbox with hosts that are auto-discovered by Zabbix. Or does Netbox has some type of discovery mechanism that I'm not familiar with?

TheNetworkGuy commented 1 year ago

You are correct in that there is no type of auto discovery for Netbox.

However like mentioned previously there are a lot of caviats with using Zabbix to populate Netbox. Data like physical location, clustering and device type would be missing.

At that point a sync script would require a lot of manual input. And at that stage i would recommend going fully manual or using a different way to initially populate Netbox.

TheNetworkGuy commented 1 year ago

Closing this one since there are numerous ways for each individual to fill Netbox. This script is designed to sync data from Netbox to Zabbix. How said individual wants to sync data from Zabbix to Netbox is up to them but the caveats and numerous different ways on how to tackle this step is something that they will need to figure out by themselves. I simply cannot make a script to fill Netbox that would suffice for all users and for all business cases / ways to document IT assets etc.