TheNetworkGuy / netbox-zabbix-sync

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

Hardcoded interface parameters #2

Closed TheNetworkGuy closed 3 years ago

TheNetworkGuy commented 3 years ago

At this stage the script creates an interface with the following parameters:

SNMP version: 2c SNMP community string: {$SNMP_COMMUNITY} Uses IP: True

This should be more flexible for different standards but also for different device SNMP parameters. I'm thinking of a faillback options like:

  1. Global SNMP default configuration in the script
  2. Have an overwrite option for each device in Netbox (If custom field is specified) or (if secret key SNMP is specified.) This setup would allow users without much scripting experience to change the behavior of Zabbix created / managed hosts.

Downside of using secret keys if the introduction of private keys importing for decrypting the secret key.

TheNetworkGuy commented 3 years ago

For now it seems logical to use config context. This allows users to bind the config context to a role / tag etc. to whatever their environment suits best. I'll integrate the use of passwords / community strings etc. in the context as well just to get the functionality up&running. After this part works i can always try to move those passwords from config context to the secrets functionality.

TheNetworkGuy commented 3 years ago

Started working on this issue and most of it is working. However:

I'm debating to implement the 2nd "feature". Zabbix prevents this adjustment "by design" due to the complexity and how to solve this situation (remove / add template, go through each item and update linkage from old interface to new one etc.)

I feel like this would be better to handle this situation off to a human that knows more context on the situation and manually update required changes.

Alternatively, the device could be cleaned up and reconfigured by the script. This results in historical data loss but does solve the issue.

However i'm very happy with the progress thus far.

TheNetworkGuy commented 3 years ago

Code to force SNMP when version changes has been written.

There is also interface type change detection which returns a error message for when the Netbox device config changes from, for example, agent to SNMP.

To prevent things from being over-complicated i decided that "Interface type changes" is something that i won't let the script handle. For now at least.

TheNetworkGuy commented 3 years ago

Implemented.