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:
@@ -89,10 +89,10 @@ func (zabbix *Zabbix) request(ctx context.Context, method string, params ZabbixA
|
||||
|
||||
// Skip auth for methods that are not required it
|
||||
if method == "apiinfo.version" {
|
||||
return zabbix.api.RequestUnauthenticated(ctx, method, params)
|
||||
return zabbix.api.RequestUnauthenticated(ctx, method, params, zabbix.version)
|
||||
}
|
||||
|
||||
result, err := zabbix.api.Request(ctx, method, params)
|
||||
result, err := zabbix.api.Request(ctx, method, params, zabbix.version)
|
||||
notAuthorized := isNotAuthorized(err)
|
||||
isTokenAuth := zabbix.settings.AuthType == settings.AuthTypeToken
|
||||
if err == zabbixapi.ErrNotAuthenticated || (notAuthorized && !isTokenAuth) {
|
||||
@@ -141,7 +141,7 @@ func (zabbix *Zabbix) Authenticate(ctx context.Context) error {
|
||||
zabbixPassword = jsonData.Get("password").MustString()
|
||||
}
|
||||
|
||||
err = zabbix.api.Authenticate(ctx, zabbixLogin, zabbixPassword)
|
||||
err = zabbix.api.Authenticate(ctx, zabbixLogin, zabbixPassword, zabbix.version)
|
||||
if err != nil {
|
||||
zabbix.logger.Error("Zabbix authentication error", "error", err)
|
||||
return err
|
||||
|
||||
Reference in New Issue
Block a user