Add option for alerting to data source config.
This commit is contained in:
@@ -35,6 +35,8 @@ class ZabbixAPIDatasource {
|
||||
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
|
||||
@@ -58,9 +60,11 @@ class ZabbixAPIDatasource {
|
||||
let useTrends = (timeFrom <= useTrendsFrom) && this.trends;
|
||||
|
||||
// Get alerts for current panel
|
||||
this.alertQuery(options).then(alert => {
|
||||
this.setPanelAlertState(options.panelId, alert.state);
|
||||
});
|
||||
if (this.alertingEnabled) {
|
||||
this.alertQuery(options).then(alert => {
|
||||
this.setPanelAlertState(options.panelId, alert.state);
|
||||
});
|
||||
}
|
||||
|
||||
// Create request for each target
|
||||
let promises = _.map(options.targets, target => {
|
||||
|
||||
@@ -58,3 +58,11 @@
|
||||
</input>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="gf-form-group">
|
||||
<h3 class="page-heading">Alerting</h3>
|
||||
<gf-form-switch class="gf-form width-8"
|
||||
label="Enable alerting"
|
||||
checked="ctrl.current.jsonData.alerting">
|
||||
</gf-form-switch>
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user