Fix querying and authentication for Zabbix v7.0+ (#1931)

* Fix querying for Zabbix v7.2+

* Update check from 7.2 to 7.0

* Fix also select acknowledges key

* Remove unsused methods

* release commit 4.6.0

---------

Co-authored-by: yesoreyeram <153843+yesoreyeram@users.noreply.github.com>
This commit is contained in:
Ivana Huckova
2024-12-17 02:02:43 +01:00
committed by GitHub
parent 0225320a62
commit dbcc008489
15 changed files with 1226 additions and 84 deletions

View File

@@ -494,7 +494,13 @@ func (ds *Zabbix) GetAllGroups(ctx context.Context) ([]Group, error) {
params := ZabbixAPIParams{
"output": []string{"name", "groupid"},
"sortfield": "name",
"real_hosts": true,
}
// Zabbix v7.0 and later removed `real_hosts` parameter and replaced it with `with_hosts`
if ds.version < 70 {
params["real_hosts"] = true
} else {
params["with_hosts"] = true
}
result, err := ds.Request(ctx, &ZabbixAPIRequest{Method: "hostgroup.get", Params: params})