Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Always create all host groups in mapping file #65

Open
pederhan opened this issue Sep 29, 2023 · 0 comments
Open

Always create all host groups in mapping file #65

pederhan opened this issue Sep 29, 2023 · 0 comments

Comments

@pederhan
Copy link
Member

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():

for hostgroup_name in synced_hostgroup_names:
if hostgroup_name not in host_hostgroups.keys():
logging.debug("Going to add hostgroup '%s' to host '%s'.", hostgroup_name, zabbix_hostname)
zabbix_hostgroup_id = zabbix_hostgroups.get(hostgroup_name, None)
if not zabbix_hostgroup_id:
# The hostgroup doesn't exist. We need to create it.
zabbix_hostgroup_id = self.create_hostgroup(hostgroup_name)
host_hostgroups[hostgroup_name] = zabbix_hostgroup_id

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant