influxdb connector WIP
This commit is contained in:
@@ -1,8 +1,10 @@
|
||||
import _ from 'lodash';
|
||||
import * as utils from '../utils';
|
||||
import responseHandler from '../responseHandler';
|
||||
import DBConnector from './connectors/dbConnector';
|
||||
import { ZabbixAPIConnector } from './connectors/zabbix_api/zabbixAPIConnector';
|
||||
import { SQLConnector } from './connectors/sql/sqlConnector';
|
||||
import { InfluxDBConnector } from './connectors/influxdb/influxdbConnector';
|
||||
import { CachingProxy } from './proxy/cachingProxy';
|
||||
import { ZabbixNotImplemented } from './connectors/dbConnector';
|
||||
|
||||
@@ -48,19 +50,27 @@ export class Zabbix {
|
||||
|
||||
this.zabbixAPI = new ZabbixAPIConnector(url, username, password, zabbixVersion, basicAuth, withCredentials, backendSrv);
|
||||
|
||||
this.proxyfyRequests();
|
||||
this.cacheRequests();
|
||||
this.bindRequests();
|
||||
|
||||
if (enableDirectDBConnection) {
|
||||
let dbConnectorOptions = {
|
||||
datasourceId: dbConnectionDatasourceId,
|
||||
datasourceName: dbConnectionDatasourceName
|
||||
};
|
||||
this.dbConnector = new SQLConnector(dbConnectorOptions, backendSrv, datasourceSrv);
|
||||
this.getHistoryDB = this.cachingProxy.proxyfyWithCache(this.dbConnector.getHistory, 'getHistory', this.dbConnector);
|
||||
this.getTrendsDB = this.cachingProxy.proxyfyWithCache(this.dbConnector.getTrends, 'getTrends', this.dbConnector);
|
||||
this.dbConnector = new DBConnector(dbConnectorOptions, backendSrv, datasourceSrv);
|
||||
this.dbConnector.loadDBDataSource().then(ds => {
|
||||
if (ds.type === 'influxdb') {
|
||||
this.dbConnector = new InfluxDBConnector(dbConnectorOptions, backendSrv, datasourceSrv);
|
||||
} else {
|
||||
this.dbConnector = new SQLConnector(dbConnectorOptions, backendSrv, datasourceSrv);
|
||||
}
|
||||
}).then(() => {
|
||||
this.getHistoryDB = this.cachingProxy.proxyfyWithCache(this.dbConnector.getHistory, 'getHistory', this.dbConnector);
|
||||
this.getTrendsDB = this.cachingProxy.proxyfyWithCache(this.dbConnector.getTrends, 'getTrends', this.dbConnector);
|
||||
});
|
||||
}
|
||||
|
||||
this.proxyfyRequests();
|
||||
this.cacheRequests();
|
||||
this.bindRequests();
|
||||
}
|
||||
|
||||
proxyfyRequests() {
|
||||
|
||||
Reference in New Issue
Block a user