Triggers query mode, allow to get active triggers count, #141

This commit is contained in:
Alexander Zobnin
2017-10-22 14:30:54 +03:00
parent dacc3f3576
commit 6c64f21b1a
26 changed files with 458 additions and 88 deletions

View File

@@ -25,14 +25,16 @@ export class ZabbixQueryController extends QueryCtrl {
{value: 'num', text: 'Metrics', mode: c.MODE_METRICS},
{value: 'text', text: 'Text', mode: c.MODE_TEXT},
{value: 'itservice', text: 'IT Services', mode: c.MODE_ITSERVICE},
{value: 'itemid', text: 'Item ID', mode: c.MODE_ITEMID}
{value: 'itemid', text: 'Item ID', mode: c.MODE_ITEMID},
{value: 'triggers', text: 'Triggers', mode: c.MODE_TRIGGERS}
];
this.$scope.editorMode = {
METRICS: c.MODE_METRICS,
TEXT: c.MODE_TEXT,
ITSERVICE: c.MODE_ITSERVICE,
ITEMID: c.MODE_ITEMID
ITEMID: c.MODE_ITEMID,
TRIGGERS: c.MODE_TRIGGERS
};
this.slaPropertyList = [
@@ -43,6 +45,12 @@ export class ZabbixQueryController extends QueryCtrl {
{name: "Down time", property: "downtimeTime"}
];
this.triggerSeverity = [
{val: 0, text: 'Not classified'}, {val: 1, text:'Information'},
{val: 2, text: 'Warning'}, {val: 3, text: 'Average'},
{val: 4, text: 'High'}, {val: 5, text: 'Disaster'}
];
// Map functions for bs-typeahead
this.getGroupNames = _.bind(this.getMetricNames, this, 'groupList');
this.getHostNames = _.bind(this.getMetricNames, this, 'hostList', true);
@@ -80,8 +88,10 @@ export class ZabbixQueryController extends QueryCtrl {
'application': { 'filter': "" },
'item': { 'filter': "" },
'functions': [],
'minSeverity': 3,
'options': {
'showDisabledItems': false
'showDisabledItems': false,
'countTriggers': true
}
};
_.defaults(target, targetDefaults);
@@ -92,8 +102,8 @@ export class ZabbixQueryController extends QueryCtrl {
});
if (target.mode === c.MODE_METRICS ||
target.mode === c.MODE_TEXT) {
target.mode === c.MODE_TEXT ||
target.mode === c.MODE_TRIGGERS) {
this.initFilters();
}
else if (target.mode === c.MODE_ITSERVICE) {
@@ -103,6 +113,7 @@ export class ZabbixQueryController extends QueryCtrl {
};
this.init();
this.queryOptionsText = this.renderQueryOptionsText();
}
initFilters() {
@@ -282,7 +293,8 @@ export class ZabbixQueryController extends QueryCtrl {
renderQueryOptionsText() {
var optionsMap = {
showDisabledItems: "Show disabled items"
showDisabledItems: "Show disabled items",
countTriggers: "Count Triggers"
};
var options = [];
_.forOwn(this.target.options, (value, key) => {