I've seen bits about this here and there but nothing that fully answered the situation, so sorry if this is a repeat.
Our situation is that we're looking at moving into Zabbix. We already have a number of existing key-value we use to classify our hosts for different reporting systems and we'd like to get them into tags on each host for Zabbix. For example, the main ones are:
For the stack level, I can add the value to HostMetadata (say as HostMetadata=Linux,stack_level:dev) and then make an Autoregistration action to look for "stack_level:dev" and set the stack_level tag for the host to dev. But then I have to have a different action for each value that stack_level can be set to. This can also work for the owning team since there are only a few teams to write actions for, but doesn't scale for stack which can have a large number of possible values. So that method only works if I could pull out a regex to use to set the tag name in an autoregistration action.
My solution at the moment is to have puppet write a list of tag-value pairs to /etc/zabbix/data/tags.yaml and then have a small python script also on each host that will take that file and call Zabbix via API to update the tags for the host it's running on. Puppet then runs the script every time it has an update for the data file. That works perfectly fine, but I wanted to see if people thought there was a better way before I cement that down as how we handle this case.
Our situation is that we're looking at moving into Zabbix. We already have a number of existing key-value we use to classify our hosts for different reporting systems and we'd like to get them into tags on each host for Zabbix. For example, the main ones are:
- Stack (application-a, application-b, etc)
- Stack Level (dev/qa/test/prod)
- Owning team (operations/infrastructure/etc)
For the stack level, I can add the value to HostMetadata (say as HostMetadata=Linux,stack_level:dev) and then make an Autoregistration action to look for "stack_level:dev" and set the stack_level tag for the host to dev. But then I have to have a different action for each value that stack_level can be set to. This can also work for the owning team since there are only a few teams to write actions for, but doesn't scale for stack which can have a large number of possible values. So that method only works if I could pull out a regex to use to set the tag name in an autoregistration action.
My solution at the moment is to have puppet write a list of tag-value pairs to /etc/zabbix/data/tags.yaml and then have a small python script also on each host that will take that file and call Zabbix via API to update the tags for the host it's running on. Puppet then runs the script every time it has an update for the data file. That works perfectly fine, but I wanted to see if people thought there was a better way before I cement that down as how we handle this case.