Add select events option
Added a option to select which events should be displayed, thus giving the ability to have a trigger history, showing all the problem events as well as the OK events.
This commit is contained in:
@@ -574,7 +574,7 @@ function (angular, _) {
|
|||||||
return this.performZabbixAPIRequest('service.getsla', params);
|
return this.performZabbixAPIRequest('service.getsla', params);
|
||||||
};
|
};
|
||||||
|
|
||||||
p.getTriggers = function(limit, sortfield, groupids, hostids, applicationids, name) {
|
p.getTriggers = function(limit, sortfield, groupids, hostids, applicationids, name, showevents) {
|
||||||
var params = {
|
var params = {
|
||||||
output: 'extend',
|
output: 'extend',
|
||||||
expandDescription: true,
|
expandDescription: true,
|
||||||
@@ -582,7 +582,7 @@ function (angular, _) {
|
|||||||
monitored: true,
|
monitored: true,
|
||||||
//only_true: true,
|
//only_true: true,
|
||||||
filter: {
|
filter: {
|
||||||
value: 1
|
value: [0,1]
|
||||||
},
|
},
|
||||||
search : {
|
search : {
|
||||||
description: name
|
description: name
|
||||||
@@ -600,6 +600,8 @@ function (angular, _) {
|
|||||||
params.sortfield = sortfield;
|
params.sortfield = sortfield;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
params.filter.value = showevents;
|
||||||
|
|
||||||
return this.performZabbixAPIRequest('trigger.get', params);
|
return this.performZabbixAPIRequest('trigger.get', params);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -112,6 +112,16 @@
|
|||||||
ng-change="get_data()">
|
ng-change="get_data()">
|
||||||
</select>
|
</select>
|
||||||
</li>
|
</li>
|
||||||
|
<li class="tight-form-item" style="width: 13em">
|
||||||
|
<strong>Show events</strong>
|
||||||
|
</li>
|
||||||
|
<li>
|
||||||
|
<select class="input-medium tight-form-input"
|
||||||
|
ng-model="panel.showEvents"
|
||||||
|
ng-options="f.text for f in showEventsFields track by f.value"
|
||||||
|
ng-change="get_data()">
|
||||||
|
</select>
|
||||||
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
<div class="clearfix"></div>
|
<div class="clearfix"></div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -48,6 +48,12 @@ function (angular, app, _, $, config, PanelMeta) {
|
|||||||
{ text: 'severity', value: 'priority' }
|
{ text: 'severity', value: 'priority' }
|
||||||
];
|
];
|
||||||
|
|
||||||
|
$scope.showEventsFields = [
|
||||||
|
{ text: 'all events', value: [0,1] },
|
||||||
|
{ text: 'Ok events', value: 0 },
|
||||||
|
{ text: 'Problem events', value: 1 }
|
||||||
|
];
|
||||||
|
|
||||||
var grafanaDefaultSeverity = [
|
var grafanaDefaultSeverity = [
|
||||||
{ priority: 0, severity: 'Not classified', color: '#B7DBAB', show: true },
|
{ priority: 0, severity: 'Not classified', color: '#B7DBAB', show: true },
|
||||||
{ priority: 1, severity: 'Information', color: '#82B5D8', show: true },
|
{ priority: 1, severity: 'Information', color: '#82B5D8', show: true },
|
||||||
@@ -72,6 +78,7 @@ function (angular, app, _, $, config, PanelMeta) {
|
|||||||
limit: 10,
|
limit: 10,
|
||||||
showTriggers: 'all triggers',
|
showTriggers: 'all triggers',
|
||||||
sortTriggersBy: { text: 'last change', value: 'lastchange' },
|
sortTriggersBy: { text: 'last change', value: 'lastchange' },
|
||||||
|
showEvents: { text: 'Problem events', value: '1' },
|
||||||
triggerSeverity: grafanaDefaultSeverity
|
triggerSeverity: grafanaDefaultSeverity
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -125,7 +132,8 @@ function (angular, app, _, $, config, PanelMeta) {
|
|||||||
groupid,
|
groupid,
|
||||||
hostid,
|
hostid,
|
||||||
applicationids,
|
applicationids,
|
||||||
$scope.panel.triggers.name)
|
$scope.panel.triggers.name,
|
||||||
|
$scope.panel.showEvents.value)
|
||||||
.then(function(triggers) {
|
.then(function(triggers) {
|
||||||
var promises = _.map(triggers, function (trigger) {
|
var promises = _.map(triggers, function (trigger) {
|
||||||
var lastchange = new Date(trigger.lastchange * 1000);
|
var lastchange = new Date(trigger.lastchange * 1000);
|
||||||
|
|||||||
Reference in New Issue
Block a user