Add option for alerting to data source config.

This commit is contained in:
Alexander Zobnin
2017-03-05 14:09:02 +03:00
parent f805213b02
commit ca63fbe5a3
6 changed files with 38 additions and 10 deletions

View File

@@ -209,6 +209,8 @@ System.register(['lodash', 'jquery', 'app/core/utils/datemath', './utils', './mi
var ttl = instanceSettings.jsonData.cacheTTL || '1h';
this.cacheTTL = utils.parseInterval(ttl);
this.alertingEnabled = instanceSettings.jsonData.alerting;
this.zabbix = new Zabbix(this.url, this.username, this.password, this.basicAuth, this.withCredentials, this.cacheTTL);
// Use custom format for template variables
@@ -238,9 +240,11 @@ System.register(['lodash', 'jquery', 'app/core/utils/datemath', './utils', './mi
var useTrends = timeFrom <= useTrendsFrom && this.trends;
// Get alerts for current panel
this.alertQuery(options).then(function (alert) {
_this.setPanelAlertState(options.panelId, alert.state);
});
if (this.alertingEnabled) {
this.alertQuery(options).then(function (alert) {
_this.setPanelAlertState(options.panelId, alert.state);
});
}
// Create request for each target
var promises = _.map(options.targets, function (target) {