TheNetworkGuy / netbox-zabbix-sync

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

Create function to disable a host #12

Closed TheNetworkGuy closed 2 years ago

TheNetworkGuy commented 2 years ago

Currently the Netbox status is used in the following way:

The last step seems a bit extreme since deletion of the host also means that the historical data is removed. My suggestion would be to introduce the following setup:

  1. Introduce 2 new variables, somewhere on top of the script, that list the Netbox states for deletion or the disabled state.
  2. Check if the host state matches one of the configured deletion states. If so, delete the host from Zabbix
  3. If the host matches one of the configured "disabled" states, run a consistency check and set the host to disable
  4. If the host matches neigher one of the configured states, run the script as usual and either create the host or run a consistency check.
TheNetworkGuy commented 2 years ago

I've created 2 new variables. The script becomes a lot more flexible and you can assign a Netbox function to a Zabbix state:

Given that maintenance is a bit more tricky to implement due to the flexibility that Zabbix offers (and since its more of a "Zabbix" feature than a global SOT setting) i wont be implementing this for now. If you have any ideas in the future feel free to open a new issue.