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

Add template group creation #66

Merged
merged 23 commits into from
Mar 20, 2024
Merged

Conversation

pederhan
Copy link
Member

@pederhan pederhan commented Oct 27, 2023

This PR introduces the ability to automatically create template groups for all managed host groups. Two new configuration options have been introduced to facilitate this:

[zabbix]
create_templategroups = false
templategroup_prefix = "Templates-"

On Zabbix <6.2, this feature will create the template groups as host groups instead.

The feature is disabled by default.

Version Checks

The BaseProcess class now fetches the Zabbix API version (always matches the Zabbix Server version) on instantiation and stores it in the attribute self.zabbix_version, which allows each process to perform version checks without having to add boilerplate code for fetching and parsing version numbers first. The version is stored as a packaging.version.Version object.

Comparing version numbers should be done on the release portion of the version name against a tuple of major, minor, micro (patch) versions, i.e.:

if self.zabbix_version.release >= (6, 2, 0): ...

And not Version objects against each other:

if self.zabbix_version >= Version("6.2.0"): ...

The main difference is that comparing releases allows for using alpha, beta and rc versions of Zabbix with ZAC. If we compared two Version objects against each other, the application would assume certain features are not available when running these pre-release versions:

>>> Version("6.2.0alpha1") >= Version("6.2.0") # fails to detect version 6.2
False
>>> Version("6.2.0alpha1").release >= (6, 2, 0) # correctly detects 6.2
True

Individual version number components can be accessed via attributes:

if self.zabbix_version.major >= 1: ...
if self.zabbix_version.minor >= 2: ...
if self.zabbix_version.micro >= 3: ...

@pederhan pederhan marked this pull request as ready for review March 20, 2024 10:22
@pederhan pederhan merged commit 7fbb4c7 into unioslo:master Mar 20, 2024
3 checks passed
@pederhan pederhan deleted the template-groups branch March 20, 2024 10:24
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

Successfully merging this pull request may close these issues.

1 participant