Add Min severity option to datasource config.
This commit is contained in:
5
dist/datasource-zabbix/datasource.js
vendored
5
dist/datasource-zabbix/datasource.js
vendored
@@ -223,6 +223,7 @@ System.register(['lodash', 'app/core/utils/datemath', './utils', './migrations',
|
|||||||
// Alerting options
|
// Alerting options
|
||||||
this.alertingEnabled = instanceSettings.jsonData.alerting;
|
this.alertingEnabled = instanceSettings.jsonData.alerting;
|
||||||
this.addThresholds = instanceSettings.jsonData.addThresholds;
|
this.addThresholds = instanceSettings.jsonData.addThresholds;
|
||||||
|
this.alertingMinSeverity = instanceSettings.jsonData.alertingMinSeverity || 2;
|
||||||
|
|
||||||
this.zabbix = new Zabbix(this.url, this.username, this.password, this.basicAuth, this.withCredentials, this.cacheTTL);
|
this.zabbix = new Zabbix(this.url, this.username, this.password, this.basicAuth, this.withCredentials, this.cacheTTL);
|
||||||
|
|
||||||
@@ -609,6 +610,10 @@ System.register(['lodash', 'app/core/utils/datemath', './utils', './migrations',
|
|||||||
|
|
||||||
return _this7.zabbix.getAlerts(itemids);
|
return _this7.zabbix.getAlerts(itemids);
|
||||||
}).then(function (triggers) {
|
}).then(function (triggers) {
|
||||||
|
triggers = _.filter(triggers, function (trigger) {
|
||||||
|
return trigger.priority >= _this7.alertingMinSeverity;
|
||||||
|
});
|
||||||
|
|
||||||
if (!triggers || triggers.length === 0) {
|
if (!triggers || triggers.length === 0) {
|
||||||
return {};
|
return {};
|
||||||
}
|
}
|
||||||
|
|||||||
2
dist/datasource-zabbix/datasource.js.map
vendored
2
dist/datasource-zabbix/datasource.js.map
vendored
File diff suppressed because one or more lines are too long
11
dist/datasource-zabbix/partials/config.html
vendored
11
dist/datasource-zabbix/partials/config.html
vendored
@@ -70,4 +70,15 @@
|
|||||||
label="Add thresholds"
|
label="Add thresholds"
|
||||||
checked="ctrl.current.jsonData.addThresholds">
|
checked="ctrl.current.jsonData.addThresholds">
|
||||||
</gf-form-switch>
|
</gf-form-switch>
|
||||||
|
<div class="gf-form max-width-20">
|
||||||
|
<span class="gf-form-label width-8">Min severity</span>
|
||||||
|
<div class="gf-form-select-wrapper max-width-16">
|
||||||
|
<select class="gf-form-input" ng-model="ctrl.current.jsonData.alertingMinSeverity"
|
||||||
|
ng-options="s.val as s.text for s in [
|
||||||
|
{val: 0, text: 'Not classified'}, {val: 1, text:'Information'},
|
||||||
|
{val: 2, text: 'Warning'}, {val: 3, text: 'Average'},
|
||||||
|
{val: 4, text: 'High'}, {val: 5, text: 'Disaster'}]">
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
5
dist/test/datasource-zabbix/datasource.js
vendored
5
dist/test/datasource-zabbix/datasource.js
vendored
@@ -81,6 +81,7 @@ var ZabbixAPIDatasource = function () {
|
|||||||
// Alerting options
|
// Alerting options
|
||||||
this.alertingEnabled = instanceSettings.jsonData.alerting;
|
this.alertingEnabled = instanceSettings.jsonData.alerting;
|
||||||
this.addThresholds = instanceSettings.jsonData.addThresholds;
|
this.addThresholds = instanceSettings.jsonData.addThresholds;
|
||||||
|
this.alertingMinSeverity = instanceSettings.jsonData.alertingMinSeverity || 2;
|
||||||
|
|
||||||
this.zabbix = new Zabbix(this.url, this.username, this.password, this.basicAuth, this.withCredentials, this.cacheTTL);
|
this.zabbix = new Zabbix(this.url, this.username, this.password, this.basicAuth, this.withCredentials, this.cacheTTL);
|
||||||
|
|
||||||
@@ -498,6 +499,10 @@ var ZabbixAPIDatasource = function () {
|
|||||||
|
|
||||||
return _this7.zabbix.getAlerts(itemids);
|
return _this7.zabbix.getAlerts(itemids);
|
||||||
}).then(function (triggers) {
|
}).then(function (triggers) {
|
||||||
|
triggers = _lodash2.default.filter(triggers, function (trigger) {
|
||||||
|
return trigger.priority >= _this7.alertingMinSeverity;
|
||||||
|
});
|
||||||
|
|
||||||
if (!triggers || triggers.length === 0) {
|
if (!triggers || triggers.length === 0) {
|
||||||
return {};
|
return {};
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -39,6 +39,7 @@ class ZabbixAPIDatasource {
|
|||||||
// Alerting options
|
// Alerting options
|
||||||
this.alertingEnabled = instanceSettings.jsonData.alerting;
|
this.alertingEnabled = instanceSettings.jsonData.alerting;
|
||||||
this.addThresholds = instanceSettings.jsonData.addThresholds;
|
this.addThresholds = instanceSettings.jsonData.addThresholds;
|
||||||
|
this.alertingMinSeverity = instanceSettings.jsonData.alertingMinSeverity || 2;
|
||||||
|
|
||||||
this.zabbix = new Zabbix(this.url, this.username, this.password, this.basicAuth, this.withCredentials, this.cacheTTL);
|
this.zabbix = new Zabbix(this.url, this.username, this.password, this.basicAuth, this.withCredentials, this.cacheTTL);
|
||||||
|
|
||||||
@@ -433,6 +434,10 @@ class ZabbixAPIDatasource {
|
|||||||
return this.zabbix.getAlerts(itemids);
|
return this.zabbix.getAlerts(itemids);
|
||||||
})
|
})
|
||||||
.then(triggers => {
|
.then(triggers => {
|
||||||
|
triggers = _.filter(triggers, trigger => {
|
||||||
|
return trigger.priority >= this.alertingMinSeverity;
|
||||||
|
});
|
||||||
|
|
||||||
if (!triggers || triggers.length === 0) {
|
if (!triggers || triggers.length === 0) {
|
||||||
return {};
|
return {};
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -70,4 +70,15 @@
|
|||||||
label="Add thresholds"
|
label="Add thresholds"
|
||||||
checked="ctrl.current.jsonData.addThresholds">
|
checked="ctrl.current.jsonData.addThresholds">
|
||||||
</gf-form-switch>
|
</gf-form-switch>
|
||||||
|
<div class="gf-form max-width-20">
|
||||||
|
<span class="gf-form-label width-8">Min severity</span>
|
||||||
|
<div class="gf-form-select-wrapper max-width-16">
|
||||||
|
<select class="gf-form-input" ng-model="ctrl.current.jsonData.alertingMinSeverity"
|
||||||
|
ng-options="s.val as s.text for s in [
|
||||||
|
{val: 0, text: 'Not classified'}, {val: 1, text:'Information'},
|
||||||
|
{val: 2, text: 'Warning'}, {val: 3, text: 'Average'},
|
||||||
|
{val: 4, text: 'High'}, {val: 5, text: 'Disaster'}]">
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
Reference in New Issue
Block a user