unioslo / zabbix-auto-config

MIT License
3 stars 6 forks source link

Always create all host groups in mapping file #65

Open pederhan opened 1 year ago

pederhan commented 1 year ago

As of now, for a host group to be created, at least one host must exist with one of the host group's site admin addresses assigned to it. This makes it impossible to pre-emptively create host groups before hosts have been created/assigned.

To change this, we need to refactor some of the code in ZabbixHostgroupUpdater.do_update():

https://github.com/unioslo/zabbix-auto-config/blob/2650598e839a853c70c5ec19253e2e86e40f63bc/zabbix_auto_config/processing.py#L1072-L1079

Specifically the bit around creating groups when fetching the Zabbix group ID for a specific group. We could likely just loop through all groups and create them before we assign them to hosts.