TheNetworkGuy / netbox-zabbix-sync

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

different templetes dependning on role and model #38

Closed andershagman closed 8 months ago

andershagman commented 1 year ago

You often want to use one template for the role and one for the model. if you have four roles and four models you create four role templates and four model templates. This makes 16 combinations. In Netbox you have to create those 16 config contexts to match two templates in Zabbix.

If I create one config context for a role: bild

And one for the modell bild

I get only one template bild

Could it be possible to use template-1, template-2 ... and concatenate the template list in the script?

TheNetworkGuy commented 1 year ago

Thanks for posting! I can confirm this behavior on https://demo.netbox.dev.

I made the assumption that lists would be merged within device config context. What i would recommend is creating an issue for the folks over at Netbox to see if this can be implemented. Since this is mostly a Netbox config context rendering feature.

In the meantime i'll check if this can be somehow solved with the script :)

TheNetworkGuy commented 1 year ago

I've found an old issue that lists this Netbox behavior. Unfortunately i am unable to work around this limitation since the only solution would be to independently query all objects that could have some form of config context. The amount of API calls would increase by a lot for each device.

Although i do understand your logic and agree to it it seems like Netbox is against this behavior.

https://github.com/netbox-community/netbox/issues/5698

TheNetworkGuy commented 1 year ago

Since this issue has been stale for a couple of weeks i suggest closing this. The only way to make this type of hierarchy work is by having different list names for each device. This would make maintaining the code with several types of variables acting for the same type of data and the administrative burden of administrating templates way harder.