Fixed annotations.
This commit is contained in:
@@ -334,7 +334,7 @@ export class ZabbixAPIDatasource {
|
|||||||
var to = Math.ceil(dateMath.parse(options.rangeRaw.to) / 1000);
|
var to = Math.ceil(dateMath.parse(options.rangeRaw.to) / 1000);
|
||||||
var annotation = options.annotation;
|
var annotation = options.annotation;
|
||||||
var self = this;
|
var self = this;
|
||||||
var showEvents = annotation.showOkEvents ? [0, 1] : 1;
|
var showOkEvents = annotation.showOkEvents ? [0, 1] : 1;
|
||||||
|
|
||||||
var buildQuery = self.queryProcessor.buildTriggerQuery(this.templateSrv.replace(annotation.group),
|
var buildQuery = self.queryProcessor.buildTriggerQuery(this.templateSrv.replace(annotation.group),
|
||||||
this.templateSrv.replace(annotation.host),
|
this.templateSrv.replace(annotation.host),
|
||||||
@@ -343,7 +343,7 @@ export class ZabbixAPIDatasource {
|
|||||||
return self.zabbixAPI.getTriggers(query.groupids,
|
return self.zabbixAPI.getTriggers(query.groupids,
|
||||||
query.hostids,
|
query.hostids,
|
||||||
query.applicationids,
|
query.applicationids,
|
||||||
showEvents)
|
true)
|
||||||
.then(function(triggers) {
|
.then(function(triggers) {
|
||||||
|
|
||||||
// Filter triggers by description
|
// Filter triggers by description
|
||||||
@@ -363,17 +363,7 @@ export class ZabbixAPIDatasource {
|
|||||||
});
|
});
|
||||||
|
|
||||||
var objectids = _.map(triggers, 'triggerid');
|
var objectids = _.map(triggers, 'triggerid');
|
||||||
var params = {
|
return self.zabbixAPI.getEvents(objectids, from, to, showOkEvents)
|
||||||
output: 'extend',
|
|
||||||
time_from: from,
|
|
||||||
time_till: to,
|
|
||||||
objectids: objectids,
|
|
||||||
select_acknowledges: 'extend',
|
|
||||||
selectHosts: 'extend',
|
|
||||||
value: showEvents
|
|
||||||
};
|
|
||||||
|
|
||||||
return self.zabbixAPI.request('event.get', params)
|
|
||||||
.then(function (events) {
|
.then(function (events) {
|
||||||
var indexedTriggers = _.indexBy(triggers, 'triggerid');
|
var indexedTriggers = _.indexBy(triggers, 'triggerid');
|
||||||
|
|
||||||
|
|||||||
@@ -8,7 +8,7 @@
|
|||||||
</li>
|
</li>
|
||||||
<li>
|
<li>
|
||||||
<input type="text"
|
<input type="text"
|
||||||
ng-model="annotation.group"
|
ng-model="ctrl.annotation.group"
|
||||||
class="input-large tight-form-input">
|
class="input-large tight-form-input">
|
||||||
</li>
|
</li>
|
||||||
<li class="tight-form-item" style="width: 50px">
|
<li class="tight-form-item" style="width: 50px">
|
||||||
@@ -16,7 +16,7 @@
|
|||||||
</li>
|
</li>
|
||||||
<li>
|
<li>
|
||||||
<input type="text"
|
<input type="text"
|
||||||
ng-model="annotation.host"
|
ng-model="ctrl.annotation.host"
|
||||||
class="input-large tight-form-input last">
|
class="input-large tight-form-input last">
|
||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
@@ -29,7 +29,7 @@
|
|||||||
</li>
|
</li>
|
||||||
<li>
|
<li>
|
||||||
<input type="text"
|
<input type="text"
|
||||||
ng-model="annotation.application"
|
ng-model="ctrl.annotation.application"
|
||||||
class="input-large tight-form-input">
|
class="input-large tight-form-input">
|
||||||
</li>
|
</li>
|
||||||
<li class="tight-form-item" style="width: 50px">
|
<li class="tight-form-item" style="width: 50px">
|
||||||
@@ -37,7 +37,7 @@
|
|||||||
</li>
|
</li>
|
||||||
<li>
|
<li>
|
||||||
<input type="text"
|
<input type="text"
|
||||||
ng-model="annotation.trigger"
|
ng-model="ctrl.annotation.trigger"
|
||||||
class="input-large tight-form-input last">
|
class="input-large tight-form-input last">
|
||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
@@ -52,10 +52,10 @@
|
|||||||
<div class="editor-option">
|
<div class="editor-option">
|
||||||
<label class="small">Minimum severity
|
<label class="small">Minimum severity
|
||||||
</label>
|
</label>
|
||||||
<select class="small" style="width: 113px" ng-init='annotation.minseverity = annotation.minseverity || 0' ng-model='annotation.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>
|
<select class="small" style="width: 113px" ng-init='ctrl.annotation.minseverity = ctrl.annotation.minseverity || 0' ng-model='ctrl.annotation.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>
|
||||||
<editor-opt-bool text="Show OK events" model="annotation.showOkEvents"></editor-opt-bool>
|
<editor-opt-bool text="Show OK events" model="ctrl.annotation.showOkEvents"></editor-opt-bool>
|
||||||
<editor-opt-bool text="Hide acknowledged events" model="annotation.hideAcknowledged"></editor-opt-bool>
|
<editor-opt-bool text="Hide acknowledged events" model="ctrl.annotation.hideAcknowledged"></editor-opt-bool>
|
||||||
<editor-opt-bool text="Show hostname" model="annotation.showHostname"></editor-opt-bool>
|
<editor-opt-bool text="Show hostname" model="ctrl.annotation.showHostname"></editor-opt-bool>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -312,7 +312,7 @@ function ZabbixAPIService($q, alertSrv, zabbixAPICoreService) {
|
|||||||
return this.request('service.getsla', params);
|
return this.request('service.getsla', params);
|
||||||
}
|
}
|
||||||
|
|
||||||
getTriggers(groupids, hostids, applicationids, showEvents) {
|
getTriggers(groupids, hostids, applicationids, showAll) {
|
||||||
var params = {
|
var params = {
|
||||||
output: 'extend',
|
output: 'extend',
|
||||||
groupids: groupids,
|
groupids: groupids,
|
||||||
@@ -332,13 +332,27 @@ function ZabbixAPIService($q, alertSrv, zabbixAPICoreService) {
|
|||||||
selectLastEvent: 'extend'
|
selectLastEvent: 'extend'
|
||||||
};
|
};
|
||||||
|
|
||||||
if (showEvents) {
|
if (showAll) {
|
||||||
params.filter.value = showEvents;
|
params.filter = {};
|
||||||
}
|
}
|
||||||
|
|
||||||
return this.request('trigger.get', params);
|
return this.request('trigger.get', params);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
getEvents(objectids, from, to, showOkEvents) {
|
||||||
|
var params = {
|
||||||
|
output: 'extend',
|
||||||
|
time_from: from,
|
||||||
|
time_till: to,
|
||||||
|
objectids: objectids,
|
||||||
|
select_acknowledges: 'extend',
|
||||||
|
selectHosts: 'extend',
|
||||||
|
value: showOkEvents
|
||||||
|
};
|
||||||
|
|
||||||
|
return this.request('event.get', params);
|
||||||
|
}
|
||||||
|
|
||||||
getAcknowledges(eventids) {
|
getAcknowledges(eventids) {
|
||||||
var params = {
|
var params = {
|
||||||
output: 'extend',
|
output: 'extend',
|
||||||
|
|||||||
Reference in New Issue
Block a user