Merge branch 'develop' into panel-triggers
Conflicts: plugins/datasource-zabbix/datasource.js
This commit is contained in:
@@ -342,47 +342,65 @@ function (angular, _, dateMath) {
|
||||
var annotation = options.annotation;
|
||||
var self = this;
|
||||
|
||||
// Remove events below the chose severity
|
||||
var severities = [];
|
||||
for (var i = 5; i >= options.annotation.minseverity; i--) {
|
||||
severities.push(i);
|
||||
}
|
||||
var params = {
|
||||
output: ['triggerid', 'description'],
|
||||
output: ['triggerid', 'description', 'priority'],
|
||||
preservekeys: 1,
|
||||
filter: { 'priority': severities },
|
||||
search: {
|
||||
'description': annotation.trigger
|
||||
'description': options.annotation.trigger
|
||||
},
|
||||
searchWildcardsEnabled: true,
|
||||
expandDescription: true
|
||||
};
|
||||
if (annotation.host) {
|
||||
params.host = templateSrv.replace(annotation.host);
|
||||
if (options.annotation.host) {
|
||||
params.host = templateSrv.replace(options.annotation.host);
|
||||
}
|
||||
else if (annotation.group) {
|
||||
params.group = templateSrv.replace(annotation.group);
|
||||
else if (options.annotation.group) {
|
||||
params.group = templateSrv.replace(options.annotation.group);
|
||||
}
|
||||
|
||||
return this.zabbixAPI.performZabbixAPIRequest('trigger.get', params)
|
||||
.then(function (result) {
|
||||
if(result) {
|
||||
var objects = _.indexBy(result, 'triggerid');
|
||||
var objects = result;
|
||||
var params = {
|
||||
output: 'extend',
|
||||
time_from: from,
|
||||
time_till: to,
|
||||
objectids: _.keys(objects),
|
||||
select_acknowledges: 'extend'
|
||||
select_acknowledges: 'extend',
|
||||
selectHosts: 'extend'
|
||||
};
|
||||
|
||||
// Show problem events only
|
||||
if (!annotation.showOkEvents) {
|
||||
if (!options.annotation.showOkEvents) {
|
||||
params.value = 1;
|
||||
}
|
||||
|
||||
return self.zabbixAPI.performZabbixAPIRequest('event.get', params)
|
||||
.then(function (result) {
|
||||
var events = [];
|
||||
|
||||
_.each(result, function(e) {
|
||||
var title ='';
|
||||
if (options.annotation.showHostname) {
|
||||
title += e.hosts[0]['name'] + ': ';
|
||||
}
|
||||
title += Number(e.value) ? 'Problem' : 'OK';
|
||||
|
||||
// Hide acknowledged events
|
||||
if (e.acknowledges.length > 0 && options.annotation.showAcknowledged) { return; }
|
||||
|
||||
var formatted_acknowledges = zabbixHelperSrv.formatAcknowledges(e.acknowledges);
|
||||
events.push({
|
||||
annotation: annotation,
|
||||
annotation: options.annotation,
|
||||
time: e.clock * 1000,
|
||||
title: Number(e.value) ? 'Problem' : 'OK',
|
||||
title: title,
|
||||
text: objects[e.objectid].description + formatted_acknowledges
|
||||
});
|
||||
});
|
||||
|
||||
@@ -21,6 +21,11 @@
|
||||
</label>
|
||||
<input type="text" style="width: 25em" ng-model='currentAnnotation.trigger' placeholder="Trigger name"></input>
|
||||
</div>
|
||||
<div class="editor-option">
|
||||
<label class="small">Minimum severity
|
||||
</label>
|
||||
<select class="small" style="width: 113px" ng-init='currentAnnotation.minseverity = currentAnnotation.minseverity || 0' ng-model='currentAnnotation.minseverity' ng-options="v as k for (k, v) in {'Not classified': 0, 'Information': 1, 'Warning': 2, 'Average': 3, 'High': 4, 'Disaster': 5}" ng-change="render()"></select>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="editor-row">
|
||||
@@ -32,5 +37,17 @@
|
||||
<label for="currentAnnotation.showOkEvents" class="cr1">Show OK events
|
||||
<tip>Show events, generated when trigger release to OK state</tip>
|
||||
</label>
|
||||
<input type="checkbox" class="cr1" id="currentAnnotation.showHostname"
|
||||
ng-model="currentAnnotation.showHostname"
|
||||
ng-checked="currentAnnotation.showHostname">
|
||||
<label for="currentAnnotation.showHostname" class="cr1">Show hostname
|
||||
<tip>Show the hostname the event belongs to</tip>
|
||||
</label>
|
||||
<input type="checkbox" class="cr1" id="currentAnnotation.showAcknowledged"
|
||||
ng-model="currentAnnotation.showAcknowledged"
|
||||
ng-checked="currentAnnotation.showAcknowledged">
|
||||
<label for="currentAnnotation.showAcknowledged" class="cr1">Hide acknowledged events
|
||||
<tip>Hide events, that have been acknowledged</tip>
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user