Add acknowledges to annotations. Add wildcards to triggers search.
This commit is contained in:
@@ -617,31 +617,37 @@ function (angular, _, kbn) {
|
|||||||
search: {
|
search: {
|
||||||
'description': annotation.query
|
'description': annotation.query
|
||||||
},
|
},
|
||||||
|
searchWildcardsEnabled: true,
|
||||||
|
expandDescription: true
|
||||||
};
|
};
|
||||||
|
|
||||||
return this.performZabbixAPIRequest('trigger.get', params)
|
return this.performZabbixAPIRequest('trigger.get', params)
|
||||||
.then(function (result) {
|
.then(function (result) {
|
||||||
if(result) {
|
if(result) {
|
||||||
var obs = {};
|
var objects = _.indexBy(result, 'triggerid');
|
||||||
obs = _.indexBy(result, 'triggerid');
|
|
||||||
|
|
||||||
var params = {
|
var params = {
|
||||||
output: 'extend',
|
output: 'extend',
|
||||||
sortorder: 'DESC',
|
|
||||||
time_from: from,
|
time_from: from,
|
||||||
time_till: to,
|
time_till: to,
|
||||||
objectids: _.keys(obs)
|
objectids: _.keys(objects),
|
||||||
|
select_acknowledges: 'extend'
|
||||||
};
|
};
|
||||||
|
|
||||||
return self.performZabbixAPIRequest('event.get', params)
|
return self.performZabbixAPIRequest('event.get', params)
|
||||||
.then(function (result) {
|
.then(function (result) {
|
||||||
var events = [];
|
var events = [];
|
||||||
_.each(result, function(e) {
|
_.each(result, function(e) {
|
||||||
|
var formatted_acknowledges = '\n';
|
||||||
|
var acknowledges = _.each(_.map(e.acknowledges, function (ack) {
|
||||||
|
return ack.name + ' ' + ack.surname + '(' + ack.alias + '): ' + ack.message;
|
||||||
|
}), function (ack) {
|
||||||
|
formatted_acknowledges = formatted_acknowledges.concat(ack, '\n')
|
||||||
|
});
|
||||||
events.push({
|
events.push({
|
||||||
annotation: annotation,
|
annotation: annotation,
|
||||||
time: e.clock * 1000,
|
time: e.clock * 1000,
|
||||||
title: obs[e.objectid].description,
|
title: Number(e.value) ? 'Problem' : 'OK',
|
||||||
text: e.eventid,
|
text: objects[e.objectid].description + (acknowledges.length ? formatted_acknowledges : ''),
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
return events;
|
return events;
|
||||||
|
|||||||
Reference in New Issue
Block a user