NetBox Preparation
Custom Fields
The sync script depends on certain custom fields being present in NetBox. These fields allow the script to assign and track Zabbix host information on the corresponding NetBox objects.
Required Custom Fields
Create the following custom fields in NetBox → Customization → Custom Fields
zabbix_hostid
- Type: Integer
- Name:
zabbix_hostid
- Required: No
- Default: null
- Object:
dcim > device
This field is used to store the Zabbix host ID on NetBox devices.
zabbix_template
- Type: Text
- Name:
zabbix_template
- Required: No
- Default: null
- Object:
dcim > device_type
This field is used to specify the default Zabbix template for devices of a given type. There is also a possibility to use config context for template data. We recommend (especially for starters) to use the custom field.
You can make the zabbix_hostid field hidden or read-only to prevent human intervention.
This is optional and there is a use case for leaving it read-write in the UI to manually change the ID. For example to re-run a sync.
VM's
If you plan to sync Virtual Machines, also assign the zabbix_id custom field to Virtual Machine objects. Provisioning of templates to VM's is only supported using config context.
Custom Links
To improve user experience, you can add custom links that redirect from a NetBox device to its corresponding Zabbix host details. These links can contain some interesting Jinja2 logic which can be utilized. This means that the link will only be available on devices which are actually synced to Zabbix. Devices such as patch panels will not have a link, avoiding confusion in the GUI.
Example custom links:
We recommend setting both links to the Object types DCIM - Devices and Virtualization - Virtual machines