use SHOW RETENTIONS to test influxdb connection (#9824)

This commit is contained in:
Dan Cech 2017-11-08 20:33:15 +01:00 committed by Torkel Ödegaard
parent b3a53b8c56
commit 5b38c230db

View File

@ -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 => {