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:
@@ -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
|
||||
});
|
||||
});
|
||||
|
||||
@@ -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>
|
||||
|
||||
Reference in New Issue
Block a user