Move health check to the backend (#2120)
This PR moves the health check to backend only leaving in the frontend the functionality to test the dbconnector datasource. Leaving the `dbconnector.testDataSource` should be fine since the datasource types we allow for db connection with Zabbix already are backend datasources, and so their health requests would go through the backend. Verified: Clicking test and seeing a `health` request go out. IMPORTANT: While testing this in the UI, I found a bug with the config editor - whenever a change is made in the UI and tested, the changes don't take effect (i.e. disabling trends, keeps `trends` set to `true`, enabling db connection keep `dbConnectionEnabled` set to `false` and so on.). Created a separate [issue](https://github.com/orgs/grafana/projects/457/views/40?pane=issue&itemId=3627315751&issue=grafana%7Coss-big-tent-squad%7C132) to fix this Fixes https://github.com/grafana/oss-big-tent-squad/issues/124 Fixes https://github.com/grafana/grafana-zabbix/issues/2004
This commit is contained in:
committed by
GitHub
parent
631d3bdc4f
commit
89ae290942
@@ -524,19 +524,28 @@ func (ds *Zabbix) GetValueMappings(ctx context.Context) ([]ValueMap, error) {
|
||||
return valuemaps, err
|
||||
}
|
||||
|
||||
func (ds *Zabbix) GetVersion(ctx context.Context) (int, error) {
|
||||
func (ds *Zabbix) GetFullVersion(ctx context.Context) (string, error) {
|
||||
result, err := ds.request(ctx, "apiinfo.version", ZabbixAPIParams{})
|
||||
if err != nil {
|
||||
return 0, err
|
||||
return "", err
|
||||
}
|
||||
|
||||
var version string
|
||||
err = convertTo(result, &version)
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
|
||||
return version, nil
|
||||
}
|
||||
|
||||
func (ds *Zabbix) GetVersion(ctx context.Context) (int, error) {
|
||||
fullStringVersion, err := ds.GetFullVersion(ctx)
|
||||
if err != nil {
|
||||
return 0, err
|
||||
}
|
||||
|
||||
version = strings.Replace(version[0:3], ".", "", 1)
|
||||
version := strings.Replace(fullStringVersion[0:3], ".", "", 1)
|
||||
versionNum, err := strconv.Atoi(version)
|
||||
return versionNum, err
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user