mirror of
https://github.com/grafana/grafana.git
synced 2025-01-08 07:03:11 -06:00
use SHOW RETENTIONS to test influxdb connection (#9824)
This commit is contained in:
parent
b3a53b8c56
commit
5b38c230db
@ -190,10 +190,13 @@ export default class InfluxDatasource {
|
||||
}
|
||||
|
||||
testDatasource() {
|
||||
return this.metricFindQuery('SHOW DATABASES').then(res => {
|
||||
let found = _.find(res, {text: this.database});
|
||||
if (!found) {
|
||||
return { status: "error", message: "Could not find the specified database name." };
|
||||
var queryBuilder = new InfluxQueryBuilder({measurement: '', tags: []}, this.database);
|
||||
var query = queryBuilder.buildExploreQuery('RETENTION POLICIES');
|
||||
|
||||
return this._seriesQuery(query).then(res => {
|
||||
let error = _.get(res, 'results[0].error');
|
||||
if (error) {
|
||||
return { status: "error", message: error };
|
||||
}
|
||||
return { status: "success", message: "Data source is working" };
|
||||
}).catch(err => {
|
||||
|
Loading…
Reference in New Issue
Block a user