Option to show hostname in annotation

A new checkbox in the annotation configuration form allows
to prefix the hostname to the title used in the annotation.

This option is relevant for people not stating the hostname
in their triggers. Within Zabbix, the hostname would be shown
redundantly everywhere, except in notifications.
This commit is contained in:
Volker Fröhlich
2015-11-27 13:45:21 +01:00
parent 2cab3d0de0
commit 9dac49a3dc
2 changed files with 16 additions and 2 deletions

View File

@@ -365,7 +365,8 @@ function (angular, _, dateMath) {
time_from: from,
time_till: to,
objectids: _.keys(objects),
select_acknowledges: 'extend'
select_acknowledges: 'extend',
selectHosts: 'extend'
};
// Show problem events only
@@ -376,12 +377,19 @@ function (angular, _, dateMath) {
return self.zabbixAPI.performZabbixAPIRequest('event.get', params)
.then(function (result) {
var events = [];
var title ='';
if (options.annotation.showHostname) {
title += e.hosts[0]['name'] + ': ';
}
title += Number(e.value) ? 'Problem' : 'OK';
_.each(result, function(e) {
var formatted_acknowledges = zabbixHelperSrv.formatAcknowledges(e.acknowledges);
events.push({
annotation: options.annotation,
time: e.clock * 1000,
title: Number(e.value) ? 'Problem' : 'OK',
title: title,
text: objects[e.objectid].description + formatted_acknowledges
});
});

View File

@@ -32,5 +32,11 @@
<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>
</div>
</div>