Merge branch 'master' into backend-functions

This commit is contained in:
Alexander Zobnin
2021-05-19 09:08:05 +03:00
41 changed files with 1838 additions and 156 deletions

View File

@@ -167,7 +167,10 @@ func (ds *ZabbixDatasourceInstance) getItems(ctx context.Context, groupFilter st
}
apps, err := ds.getApps(ctx, groupFilter, hostFilter, appFilter)
if err != nil {
// Apps not supported in Zabbix 5.4 and higher
if isAppMethodNotFoundError(err) {
apps = []map[string]interface{}{}
} else if err != nil {
return nil, err
}
var appids []string
@@ -505,3 +508,12 @@ func isNotAuthorized(err error) bool {
strings.Contains(message, "Not authorised.") ||
strings.Contains(message, "Not authorized.")
}
func isAppMethodNotFoundError(err error) bool {
if err == nil {
return false
}
message := err.Error()
return message == `Method not found. Incorrect API "application".`
}