Merge branch 'master' into refactor
This commit is contained in:
@@ -28,7 +28,7 @@ class ZabbixAPIDatasource {
|
||||
this.basicAuth = instanceSettings.basicAuth;
|
||||
this.withCredentials = instanceSettings.withCredentials;
|
||||
|
||||
const jsonData = instanceSettings.jsonData;
|
||||
const jsonData = instanceSettings.jsonData || {};
|
||||
|
||||
// Zabbix API credentials
|
||||
this.username = jsonData.username;
|
||||
@@ -48,6 +48,9 @@ class ZabbixAPIDatasource {
|
||||
this.addThresholds = jsonData.addThresholds;
|
||||
this.alertingMinSeverity = jsonData.alertingMinSeverity || c.SEV_WARNING;
|
||||
|
||||
// Other options
|
||||
this.disableReadOnlyUsersAck = jsonData.disableReadOnlyUsersAck;
|
||||
|
||||
// Direct DB Connection options
|
||||
let dbConnectionOptions = jsonData.dbConnection || {};
|
||||
this.enableDirectDBConnection = dbConnectionOptions.enable;
|
||||
@@ -206,11 +209,7 @@ class ZabbixAPIDatasource {
|
||||
|
||||
return getHistoryPromise
|
||||
.then(timeseries => this.applyDataProcessingFunctions(timeseries, target))
|
||||
.then(timeseries => downsampleSeries(timeseries, options))
|
||||
.catch(error => {
|
||||
console.log(error);
|
||||
return [];
|
||||
});
|
||||
.then(timeseries => downsampleSeries(timeseries, options));
|
||||
}
|
||||
|
||||
getTrendValueType(target) {
|
||||
|
||||
@@ -126,3 +126,11 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="gf-form-group">
|
||||
<h3 class="page-heading">Other</h3>
|
||||
<gf-form-switch class="gf-form" label-class="width-20"
|
||||
label="Disable acknowledges for read-only users"
|
||||
checked="ctrl.current.jsonData.disableReadOnlyUsersAck">
|
||||
</gf-form-switch>
|
||||
</div>
|
||||
|
||||
@@ -203,7 +203,7 @@ function buildSQLTrendsQuery(itemids, table, timeFrom, timeTill, intervalSec, ag
|
||||
function buildMysqlHistoryQuery(itemids, table, timeFrom, timeTill, intervalSec, aggFunction) {
|
||||
let time_expression = `clock DIV ${intervalSec} * ${intervalSec}`;
|
||||
let query = `
|
||||
SELECT itemid AS metric, ${time_expression} AS time_sec, ${aggFunction}(value) AS value
|
||||
SELECT CAST(itemid AS CHAR) AS metric, ${time_expression} AS time_sec, ${aggFunction}(value) AS value
|
||||
FROM ${table}
|
||||
WHERE itemid IN (${itemids})
|
||||
AND clock > ${timeFrom} AND clock < ${timeTill}
|
||||
@@ -216,7 +216,7 @@ function buildMysqlHistoryQuery(itemids, table, timeFrom, timeTill, intervalSec,
|
||||
function buildMysqlTrendsQuery(itemids, table, timeFrom, timeTill, intervalSec, aggFunction, valueColumn) {
|
||||
let time_expression = `clock DIV ${intervalSec} * ${intervalSec}`;
|
||||
let query = `
|
||||
SELECT itemid AS metric, ${time_expression} AS time_sec, ${aggFunction}(${valueColumn}) AS value
|
||||
SELECT CAST(itemid AS CHAR) AS metric, ${time_expression} AS time_sec, ${aggFunction}(${valueColumn}) AS value
|
||||
FROM ${table}
|
||||
WHERE itemid IN (${itemids})
|
||||
AND clock > ${timeFrom} AND clock < ${timeTill}
|
||||
@@ -226,7 +226,7 @@ function buildMysqlTrendsQuery(itemids, table, timeFrom, timeTill, intervalSec,
|
||||
return query;
|
||||
}
|
||||
|
||||
const TEST_MYSQL_QUERY = `SELECT itemid AS metric, clock AS time_sec, value_avg AS value FROM trends_uint LIMIT 1`;
|
||||
const TEST_MYSQL_QUERY = `SELECT CAST(itemid AS CHAR) AS metric, clock AS time_sec, value_avg AS value FROM trends_uint LIMIT 1`;
|
||||
|
||||
////////////////
|
||||
// PostgreSQL //
|
||||
|
||||
@@ -49,13 +49,7 @@ class ZabbixAlertingService {
|
||||
}
|
||||
|
||||
getPanelModels() {
|
||||
return _.flatten(_.map(this.dashboardSrv.dash.rows, row => {
|
||||
if (row.collapse) {
|
||||
return [];
|
||||
} else {
|
||||
return row.panels;
|
||||
}
|
||||
}));
|
||||
return _.filter(this.dashboardSrv.dash.panels, panel => panel.type !== 'row');
|
||||
}
|
||||
|
||||
getPanelModel(panelId) {
|
||||
|
||||
Reference in New Issue
Block a user