Merge branch 'it-services'
This commit is contained in:
80
dist/datasource-zabbix/datasource.js
vendored
80
dist/datasource-zabbix/datasource.js
vendored
@@ -321,14 +321,7 @@ System.register(['lodash', 'app/core/utils/datemath', './utils', './migrations',
|
||||
|
||||
// IT services mode
|
||||
else if (target.mode === c.MODE_ITSERVICE) {
|
||||
// Don't show undefined and hidden targets
|
||||
if (target.hide || !target.itservice || !target.slaProperty) {
|
||||
return [];
|
||||
}
|
||||
|
||||
return _this.zabbix.getSLA(target.itservice.serviceid, timeRange).then(function (slaObject) {
|
||||
return responseHandler.handleSLAResponse(target.itservice, target.slaProperty, slaObject);
|
||||
});
|
||||
return _this.queryITServiceData(target, timeRange, options);
|
||||
}
|
||||
});
|
||||
|
||||
@@ -485,15 +478,54 @@ System.register(['lodash', 'app/core/utils/datemath', './utils', './migrations',
|
||||
}
|
||||
});
|
||||
}
|
||||
}, {
|
||||
key: 'queryITServiceData',
|
||||
value: function queryITServiceData(target, timeRange, options) {
|
||||
var _this4 = this;
|
||||
|
||||
// Don't show undefined and hidden targets
|
||||
if (target.hide || !target.itservice && !target.itServiceFilter || !target.slaProperty) {
|
||||
return [];
|
||||
}
|
||||
|
||||
var itServiceIds = [];
|
||||
var itServices = [];
|
||||
var itServiceFilter = void 0;
|
||||
var isOldVersion = target.itservice && !target.itServiceFilter;
|
||||
|
||||
if (isOldVersion) {
|
||||
// Backward compatibility
|
||||
itServiceFilter = '/.*/';
|
||||
} else {
|
||||
itServiceFilter = this.replaceTemplateVars(target.itServiceFilter, options.scopedVars);
|
||||
}
|
||||
|
||||
return this.zabbix.getITServices(itServiceFilter).then(function (itservices) {
|
||||
itServices = itservices;
|
||||
if (isOldVersion) {
|
||||
itServices = _.filter(itServices, { 'serviceid': target.itservice.serviceid });
|
||||
}
|
||||
|
||||
itServiceIds = _.map(itServices, 'serviceid');
|
||||
return itServiceIds;
|
||||
}).then(function (serviceids) {
|
||||
return _this4.zabbix.getSLA(serviceids, timeRange);
|
||||
}).then(function (slaResponse) {
|
||||
return _.map(itServiceIds, function (serviceid) {
|
||||
var itservice = _.find(itServices, { 'serviceid': serviceid });
|
||||
return responseHandler.handleSLAResponse(itservice, target.slaProperty, slaResponse);
|
||||
});
|
||||
});
|
||||
}
|
||||
}, {
|
||||
key: 'testDatasource',
|
||||
value: function testDatasource() {
|
||||
var _this4 = this;
|
||||
var _this5 = this;
|
||||
|
||||
var zabbixVersion = void 0;
|
||||
return this.zabbix.getVersion().then(function (version) {
|
||||
zabbixVersion = version;
|
||||
return _this4.zabbix.login();
|
||||
return _this5.zabbix.login();
|
||||
}).then(function () {
|
||||
return {
|
||||
status: "success",
|
||||
@@ -519,14 +551,14 @@ System.register(['lodash', 'app/core/utils/datemath', './utils', './migrations',
|
||||
}, {
|
||||
key: 'metricFindQuery',
|
||||
value: function metricFindQuery(query) {
|
||||
var _this5 = this;
|
||||
var _this6 = this;
|
||||
|
||||
var result = void 0;
|
||||
var parts = [];
|
||||
|
||||
// Split query. Query structure: group.host.app.item
|
||||
_.each(utils.splitTemplateQuery(query), function (part) {
|
||||
part = _this5.replaceTemplateVars(part, {});
|
||||
part = _this6.replaceTemplateVars(part, {});
|
||||
|
||||
// Replace wildcard to regex
|
||||
if (part === '*') {
|
||||
@@ -563,7 +595,7 @@ System.register(['lodash', 'app/core/utils/datemath', './utils', './migrations',
|
||||
}, {
|
||||
key: 'annotationQuery',
|
||||
value: function annotationQuery(options) {
|
||||
var _this6 = this;
|
||||
var _this7 = this;
|
||||
|
||||
var timeFrom = Math.ceil(dateMath.parse(options.rangeRaw.from) / 1000);
|
||||
var timeTo = Math.ceil(dateMath.parse(options.rangeRaw.to) / 1000);
|
||||
@@ -581,7 +613,7 @@ System.register(['lodash', 'app/core/utils/datemath', './utils', './migrations',
|
||||
return getTriggers.then(function (triggers) {
|
||||
|
||||
// Filter triggers by description
|
||||
var triggerName = _this6.replaceTemplateVars(annotation.trigger, {});
|
||||
var triggerName = _this7.replaceTemplateVars(annotation.trigger, {});
|
||||
if (utils.isRegex(triggerName)) {
|
||||
triggers = _.filter(triggers, function (trigger) {
|
||||
return utils.buildRegex(triggerName).test(trigger.description);
|
||||
@@ -598,7 +630,7 @@ System.register(['lodash', 'app/core/utils/datemath', './utils', './migrations',
|
||||
});
|
||||
|
||||
var objectids = _.map(triggers, 'triggerid');
|
||||
return _this6.zabbix.getEvents(objectids, timeFrom, timeTo, showOkEvents).then(function (events) {
|
||||
return _this7.zabbix.getEvents(objectids, timeFrom, timeTo, showOkEvents).then(function (events) {
|
||||
var indexedTriggers = _.keyBy(triggers, 'triggerid');
|
||||
|
||||
// Hide acknowledged events if option enabled
|
||||
@@ -632,23 +664,23 @@ System.register(['lodash', 'app/core/utils/datemath', './utils', './migrations',
|
||||
}, {
|
||||
key: 'alertQuery',
|
||||
value: function alertQuery(options) {
|
||||
var _this7 = this;
|
||||
var _this8 = this;
|
||||
|
||||
var enabled_targets = filterEnabledTargets(options.targets);
|
||||
var getPanelItems = _.map(enabled_targets, function (t) {
|
||||
var target = _.cloneDeep(t);
|
||||
_this7.replaceTargetVariables(target, options);
|
||||
return _this7.zabbix.getItemsFromTarget(target, { itemtype: 'num' });
|
||||
_this8.replaceTargetVariables(target, options);
|
||||
return _this8.zabbix.getItemsFromTarget(target, { itemtype: 'num' });
|
||||
});
|
||||
|
||||
return Promise.all(getPanelItems).then(function (results) {
|
||||
var items = _.flatten(results);
|
||||
var itemids = _.map(items, 'itemid');
|
||||
|
||||
return _this7.zabbix.getAlerts(itemids);
|
||||
return _this8.zabbix.getAlerts(itemids);
|
||||
}).then(function (triggers) {
|
||||
triggers = _.filter(triggers, function (trigger) {
|
||||
return trigger.priority >= _this7.alertingMinSeverity;
|
||||
return trigger.priority >= _this8.alertingMinSeverity;
|
||||
});
|
||||
|
||||
if (!triggers || triggers.length === 0) {
|
||||
@@ -676,12 +708,12 @@ System.register(['lodash', 'app/core/utils/datemath', './utils', './migrations',
|
||||
}, {
|
||||
key: 'replaceTargetVariables',
|
||||
value: function replaceTargetVariables(target, options) {
|
||||
var _this8 = this;
|
||||
var _this9 = this;
|
||||
|
||||
var parts = ['group', 'host', 'application', 'item'];
|
||||
_.forEach(parts, function (p) {
|
||||
if (target[p] && target[p].filter) {
|
||||
target[p].filter = _this8.replaceTemplateVars(target[p].filter, options.scopedVars);
|
||||
target[p].filter = _this9.replaceTemplateVars(target[p].filter, options.scopedVars);
|
||||
}
|
||||
});
|
||||
target.textFilter = this.replaceTemplateVars(target.textFilter, options.scopedVars);
|
||||
@@ -689,9 +721,9 @@ System.register(['lodash', 'app/core/utils/datemath', './utils', './migrations',
|
||||
_.forEach(target.functions, function (func) {
|
||||
func.params = _.map(func.params, function (param) {
|
||||
if (typeof param === 'number') {
|
||||
return +_this8.templateSrv.replace(param.toString(), options.scopedVars);
|
||||
return +_this9.templateSrv.replace(param.toString(), options.scopedVars);
|
||||
} else {
|
||||
return _this8.templateSrv.replace(param, options.scopedVars);
|
||||
return _this9.templateSrv.replace(param, options.scopedVars);
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
2
dist/datasource-zabbix/datasource.js.map
vendored
2
dist/datasource-zabbix/datasource.js.map
vendored
File diff suppressed because one or more lines are too long
@@ -20,24 +20,26 @@
|
||||
<div class="gf-form-inline" ng-show="ctrl.target.mode == 1">
|
||||
<div class="gf-form max-width-20">
|
||||
<label class="gf-form-label query-keyword width-7">IT Service</label>
|
||||
<div class="gf-form-select-wrapper max-width-20">
|
||||
<select class="gf-form-input"
|
||||
ng-change="ctrl.selectITService()"
|
||||
ng-model="ctrl.target.itservice"
|
||||
bs-tooltip="ctrl.target.itservice.name.length > 25 ? ctrl.target.itservice.name : ''"
|
||||
ng-options="itservice.name for itservice in ctrl.itserviceList track by itservice.name">
|
||||
<option value="">-- Select IT service --</option>
|
||||
</select>
|
||||
</div>
|
||||
<input type="text"
|
||||
ng-model="ctrl.target.itServiceFilter"
|
||||
bs-typeahead="ctrl.getITServices"
|
||||
ng-blur="ctrl.onTargetBlur()"
|
||||
data-min-length=0
|
||||
data-items=100
|
||||
class="gf-form-input"
|
||||
ng-class="{
|
||||
'zbx-variable': ctrl.isVariable(ctrl.target.itServiceFilter),
|
||||
'zbx-regex': ctrl.isRegex(ctrl.target.itServiceFilter)
|
||||
}">
|
||||
</input>
|
||||
</div>
|
||||
<div class="gf-form">
|
||||
<label class="gf-form-label query-keyword">IT service property</label>
|
||||
<label class="gf-form-label query-keyword">Property</label>
|
||||
<div class="gf-form-select-wrapper">
|
||||
<select class="gf-form-input"
|
||||
ng-change="ctrl.selectITService()"
|
||||
ng-model="ctrl.target.slaProperty"
|
||||
ng-options="slaProperty.name for slaProperty in ctrl.slaPropertyList track by slaProperty.name">
|
||||
<option value="">-- Property --</option>
|
||||
ng-change="ctrl.onTargetBlur()"
|
||||
ng-model="ctrl.target.slaProperty"
|
||||
ng-options="slaProperty.name for slaProperty in ctrl.slaPropertyList track by slaProperty.name">
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
66
dist/datasource-zabbix/query.controller.js
vendored
66
dist/datasource-zabbix/query.controller.js
vendored
@@ -1,9 +1,9 @@
|
||||
'use strict';
|
||||
|
||||
System.register(['app/plugins/sdk', 'angular', 'lodash', './constants', './utils', './metricFunctions', './migrations', './add-metric-function.directive', './metric-function-editor.directive', './css/query-editor.css!'], function (_export, _context) {
|
||||
System.register(['app/plugins/sdk', 'lodash', './constants', './utils', './metricFunctions', './migrations', './add-metric-function.directive', './metric-function-editor.directive', './css/query-editor.css!'], function (_export, _context) {
|
||||
"use strict";
|
||||
|
||||
var QueryCtrl, angular, _, c, utils, metricFunctions, migrations, _createClass, ZabbixQueryController;
|
||||
var QueryCtrl, _, c, utils, metricFunctions, migrations, _createClass, ZabbixQueryController;
|
||||
|
||||
function _classCallCheck(instance, Constructor) {
|
||||
if (!(instance instanceof Constructor)) {
|
||||
@@ -38,8 +38,6 @@ System.register(['app/plugins/sdk', 'angular', 'lodash', './constants', './utils
|
||||
return {
|
||||
setters: [function (_appPluginsSdk) {
|
||||
QueryCtrl = _appPluginsSdk.QueryCtrl;
|
||||
}, function (_angular) {
|
||||
angular = _angular.default;
|
||||
}, function (_lodash) {
|
||||
_ = _lodash.default;
|
||||
}, function (_constants) {
|
||||
@@ -91,11 +89,14 @@ System.register(['app/plugins/sdk', 'angular', 'lodash', './constants', './utils
|
||||
2: { value: 'text', text: 'Text', mode: c.MODE_TEXT }
|
||||
};
|
||||
|
||||
_this.slaPropertyList = [{ name: "Status", property: "status" }, { name: "SLA", property: "sla" }, { name: "OK time", property: "okTime" }, { name: "Problem time", property: "problemTime" }, { name: "Down time", property: "downtimeTime" }];
|
||||
|
||||
// Map functions for bs-typeahead
|
||||
_this.getGroupNames = _.bind(_this.getMetricNames, _this, 'groupList');
|
||||
_this.getHostNames = _.bind(_this.getMetricNames, _this, 'hostList', true);
|
||||
_this.getApplicationNames = _.bind(_this.getMetricNames, _this, 'appList');
|
||||
_this.getItemNames = _.bind(_this.getMetricNames, _this, 'itemList');
|
||||
_this.getITServices = _.bind(_this.getMetricNames, _this, 'itServiceList');
|
||||
|
||||
// Update metric suggestion when template variable was changed
|
||||
$rootScope.$on('template-variable-value-updated', function () {
|
||||
@@ -122,14 +123,14 @@ System.register(['app/plugins/sdk', 'angular', 'lodash', './constants', './utils
|
||||
|
||||
// Load default values
|
||||
var targetDefaults = {
|
||||
mode: c.MODE_METRICS,
|
||||
group: { filter: "" },
|
||||
host: { filter: "" },
|
||||
application: { filter: "" },
|
||||
item: { filter: "" },
|
||||
functions: [],
|
||||
options: {
|
||||
showDisabledItems: false
|
||||
'mode': c.MODE_METRICS,
|
||||
'group': { 'filter': "" },
|
||||
'host': { 'filter': "" },
|
||||
'application': { 'filter': "" },
|
||||
'item': { 'filter': "" },
|
||||
'functions': [],
|
||||
'options': {
|
||||
'showDisabledItems': false
|
||||
}
|
||||
};
|
||||
_.defaults(target, targetDefaults);
|
||||
@@ -141,13 +142,10 @@ System.register(['app/plugins/sdk', 'angular', 'lodash', './constants', './utils
|
||||
|
||||
if (target.mode === c.MODE_METRICS || target.mode === c.MODE_TEXT) {
|
||||
|
||||
this.downsampleFunctionList = [{ name: "avg", value: "avg" }, { name: "min", value: "min" }, { name: "max", value: "max" }, { name: "sum", value: "sum" }, { name: "count", value: "count" }];
|
||||
|
||||
this.initFilters();
|
||||
} else if (target.mode === c.MODE_ITSERVICE) {
|
||||
this.slaPropertyList = [{ name: "Status", property: "status" }, { name: "SLA", property: "sla" }, { name: "OK time", property: "okTime" }, { name: "Problem time", property: "problemTime" }, { name: "Down time", property: "downtimeTime" }];
|
||||
this.itserviceList = [{ name: "test" }];
|
||||
this.updateITServiceList();
|
||||
_.defaults(target, { slaProperty: { name: "SLA", property: "sla" } });
|
||||
this.suggestITServices();
|
||||
}
|
||||
};
|
||||
|
||||
@@ -230,6 +228,16 @@ System.register(['app/plugins/sdk', 'angular', 'lodash', './constants', './utils
|
||||
return items;
|
||||
});
|
||||
}
|
||||
}, {
|
||||
key: 'suggestITServices',
|
||||
value: function suggestITServices() {
|
||||
var _this6 = this;
|
||||
|
||||
return this.zabbix.getITService().then(function (itservices) {
|
||||
_this6.metric.itServiceList = itservices;
|
||||
return itservices;
|
||||
});
|
||||
}
|
||||
}, {
|
||||
key: 'isRegex',
|
||||
value: function isRegex(str) {
|
||||
@@ -259,11 +267,11 @@ System.register(['app/plugins/sdk', 'angular', 'lodash', './constants', './utils
|
||||
}, {
|
||||
key: 'isContainsVariables',
|
||||
value: function isContainsVariables() {
|
||||
var _this6 = this;
|
||||
var _this7 = this;
|
||||
|
||||
return _.some(['group', 'host', 'application'], function (field) {
|
||||
if (_this6.target[field] && _this6.target[field].filter) {
|
||||
return utils.isTemplateVariable(_this6.target[field].filter, _this6.templateSrv.variables);
|
||||
if (_this7.target[field] && _this7.target[field].filter) {
|
||||
return utils.isTemplateVariable(_this7.target[field].filter, _this7.templateSrv.variables);
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
@@ -357,24 +365,6 @@ System.register(['app/plugins/sdk', 'angular', 'lodash', './constants', './utils
|
||||
this.target.mode = mode;
|
||||
this.init();
|
||||
}
|
||||
}, {
|
||||
key: 'updateITServiceList',
|
||||
value: function updateITServiceList() {
|
||||
var _this7 = this;
|
||||
|
||||
this.zabbix.getITService().then(function (iteservices) {
|
||||
_this7.itserviceList = [];
|
||||
_this7.itserviceList = _this7.itserviceList.concat(iteservices);
|
||||
});
|
||||
}
|
||||
}, {
|
||||
key: 'selectITService',
|
||||
value: function selectITService() {
|
||||
if (!_.isEqual(this.oldTarget, this.target) && _.isEmpty(this.target.errors)) {
|
||||
this.oldTarget = angular.copy(this.target);
|
||||
this.panelCtrl.refresh();
|
||||
}
|
||||
}
|
||||
}]);
|
||||
|
||||
return ZabbixQueryController;
|
||||
|
||||
File diff suppressed because one or more lines are too long
7
dist/datasource-zabbix/zabbix.js
vendored
7
dist/datasource-zabbix/zabbix.js
vendored
@@ -186,6 +186,13 @@ System.register(['angular', 'lodash', './utils', './zabbixAPI.service.js', './za
|
||||
return filterByQuery(items, itemFilter);
|
||||
});
|
||||
}
|
||||
}, {
|
||||
key: 'getITServices',
|
||||
value: function getITServices(itServiceFilter) {
|
||||
return this.cachingProxy.getITServices().then(function (itServices) {
|
||||
return findByFilter(itServices, itServiceFilter);
|
||||
});
|
||||
}
|
||||
}, {
|
||||
key: 'getTriggers',
|
||||
value: function getTriggers(groupFilter, hostFilter, appFilter, options) {
|
||||
|
||||
2
dist/datasource-zabbix/zabbix.js.map
vendored
2
dist/datasource-zabbix/zabbix.js.map
vendored
File diff suppressed because one or more lines are too long
@@ -46,7 +46,8 @@ System.register(['angular', 'lodash'], function (_export, _context) {
|
||||
history: {},
|
||||
trends: {},
|
||||
macros: {},
|
||||
globalMacros: {}
|
||||
globalMacros: {},
|
||||
itServices: {}
|
||||
};
|
||||
|
||||
this.historyPromises = {};
|
||||
@@ -72,6 +73,9 @@ System.register(['angular', 'lodash'], function (_export, _context) {
|
||||
this.itemPromises = {};
|
||||
this.getItemsOnce = callAPIRequestOnce(_.bind(this.zabbixAPI.getItems, this.zabbixAPI), this.itemPromises, getRequestHash);
|
||||
|
||||
this.itServicesPromises = {};
|
||||
this.getITServicesOnce = callAPIRequestOnce(_.bind(this.zabbixAPI.getITService, this.zabbixAPI), this.itServicesPromises, getRequestHash);
|
||||
|
||||
this.macroPromises = {};
|
||||
this.getMacrosOnce = callAPIRequestOnce(_.bind(this.zabbixAPI.getMacros, this.zabbixAPI), this.macroPromises, getRequestHash);
|
||||
|
||||
@@ -126,6 +130,11 @@ System.register(['angular', 'lodash'], function (_export, _context) {
|
||||
var params = [hostids, appids, itemtype];
|
||||
return this.proxyRequest(this.getItemsOnce, params, this.cache.items);
|
||||
}
|
||||
}, {
|
||||
key: 'getITServices',
|
||||
value: function getITServices() {
|
||||
return this.proxyRequest(this.getITServicesOnce, [], this.cache.itServices);
|
||||
}
|
||||
}, {
|
||||
key: 'getMacros',
|
||||
value: function getMacros(hostids) {
|
||||
|
||||
File diff suppressed because one or more lines are too long
80
dist/test/datasource-zabbix/datasource.js
vendored
80
dist/test/datasource-zabbix/datasource.js
vendored
@@ -181,14 +181,7 @@ var ZabbixAPIDatasource = function () {
|
||||
|
||||
// IT services mode
|
||||
else if (target.mode === c.MODE_ITSERVICE) {
|
||||
// Don't show undefined and hidden targets
|
||||
if (target.hide || !target.itservice || !target.slaProperty) {
|
||||
return [];
|
||||
}
|
||||
|
||||
return _this.zabbix.getSLA(target.itservice.serviceid, timeRange).then(function (slaObject) {
|
||||
return _responseHandler2.default.handleSLAResponse(target.itservice, target.slaProperty, slaObject);
|
||||
});
|
||||
return _this.queryITServiceData(target, timeRange, options);
|
||||
}
|
||||
});
|
||||
|
||||
@@ -345,6 +338,45 @@ var ZabbixAPIDatasource = function () {
|
||||
}
|
||||
});
|
||||
}
|
||||
}, {
|
||||
key: 'queryITServiceData',
|
||||
value: function queryITServiceData(target, timeRange, options) {
|
||||
var _this4 = this;
|
||||
|
||||
// Don't show undefined and hidden targets
|
||||
if (target.hide || !target.itservice && !target.itServiceFilter || !target.slaProperty) {
|
||||
return [];
|
||||
}
|
||||
|
||||
var itServiceIds = [];
|
||||
var itServices = [];
|
||||
var itServiceFilter = void 0;
|
||||
var isOldVersion = target.itservice && !target.itServiceFilter;
|
||||
|
||||
if (isOldVersion) {
|
||||
// Backward compatibility
|
||||
itServiceFilter = '/.*/';
|
||||
} else {
|
||||
itServiceFilter = this.replaceTemplateVars(target.itServiceFilter, options.scopedVars);
|
||||
}
|
||||
|
||||
return this.zabbix.getITServices(itServiceFilter).then(function (itservices) {
|
||||
itServices = itservices;
|
||||
if (isOldVersion) {
|
||||
itServices = _lodash2.default.filter(itServices, { 'serviceid': target.itservice.serviceid });
|
||||
}
|
||||
|
||||
itServiceIds = _lodash2.default.map(itServices, 'serviceid');
|
||||
return itServiceIds;
|
||||
}).then(function (serviceids) {
|
||||
return _this4.zabbix.getSLA(serviceids, timeRange);
|
||||
}).then(function (slaResponse) {
|
||||
return _lodash2.default.map(itServiceIds, function (serviceid) {
|
||||
var itservice = _lodash2.default.find(itServices, { 'serviceid': serviceid });
|
||||
return _responseHandler2.default.handleSLAResponse(itservice, target.slaProperty, slaResponse);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Test connection to Zabbix API
|
||||
@@ -354,12 +386,12 @@ var ZabbixAPIDatasource = function () {
|
||||
}, {
|
||||
key: 'testDatasource',
|
||||
value: function testDatasource() {
|
||||
var _this4 = this;
|
||||
var _this5 = this;
|
||||
|
||||
var zabbixVersion = void 0;
|
||||
return this.zabbix.getVersion().then(function (version) {
|
||||
zabbixVersion = version;
|
||||
return _this4.zabbix.login();
|
||||
return _this5.zabbix.login();
|
||||
}).then(function () {
|
||||
return {
|
||||
status: "success",
|
||||
@@ -398,14 +430,14 @@ var ZabbixAPIDatasource = function () {
|
||||
}, {
|
||||
key: 'metricFindQuery',
|
||||
value: function metricFindQuery(query) {
|
||||
var _this5 = this;
|
||||
var _this6 = this;
|
||||
|
||||
var result = void 0;
|
||||
var parts = [];
|
||||
|
||||
// Split query. Query structure: group.host.app.item
|
||||
_lodash2.default.each(utils.splitTemplateQuery(query), function (part) {
|
||||
part = _this5.replaceTemplateVars(part, {});
|
||||
part = _this6.replaceTemplateVars(part, {});
|
||||
|
||||
// Replace wildcard to regex
|
||||
if (part === '*') {
|
||||
@@ -447,7 +479,7 @@ var ZabbixAPIDatasource = function () {
|
||||
}, {
|
||||
key: 'annotationQuery',
|
||||
value: function annotationQuery(options) {
|
||||
var _this6 = this;
|
||||
var _this7 = this;
|
||||
|
||||
var timeFrom = Math.ceil(dateMath.parse(options.rangeRaw.from) / 1000);
|
||||
var timeTo = Math.ceil(dateMath.parse(options.rangeRaw.to) / 1000);
|
||||
@@ -465,7 +497,7 @@ var ZabbixAPIDatasource = function () {
|
||||
return getTriggers.then(function (triggers) {
|
||||
|
||||
// Filter triggers by description
|
||||
var triggerName = _this6.replaceTemplateVars(annotation.trigger, {});
|
||||
var triggerName = _this7.replaceTemplateVars(annotation.trigger, {});
|
||||
if (utils.isRegex(triggerName)) {
|
||||
triggers = _lodash2.default.filter(triggers, function (trigger) {
|
||||
return utils.buildRegex(triggerName).test(trigger.description);
|
||||
@@ -482,7 +514,7 @@ var ZabbixAPIDatasource = function () {
|
||||
});
|
||||
|
||||
var objectids = _lodash2.default.map(triggers, 'triggerid');
|
||||
return _this6.zabbix.getEvents(objectids, timeFrom, timeTo, showOkEvents).then(function (events) {
|
||||
return _this7.zabbix.getEvents(objectids, timeFrom, timeTo, showOkEvents).then(function (events) {
|
||||
var indexedTriggers = _lodash2.default.keyBy(triggers, 'triggerid');
|
||||
|
||||
// Hide acknowledged events if option enabled
|
||||
@@ -523,23 +555,23 @@ var ZabbixAPIDatasource = function () {
|
||||
}, {
|
||||
key: 'alertQuery',
|
||||
value: function alertQuery(options) {
|
||||
var _this7 = this;
|
||||
var _this8 = this;
|
||||
|
||||
var enabled_targets = filterEnabledTargets(options.targets);
|
||||
var getPanelItems = _lodash2.default.map(enabled_targets, function (t) {
|
||||
var target = _lodash2.default.cloneDeep(t);
|
||||
_this7.replaceTargetVariables(target, options);
|
||||
return _this7.zabbix.getItemsFromTarget(target, { itemtype: 'num' });
|
||||
_this8.replaceTargetVariables(target, options);
|
||||
return _this8.zabbix.getItemsFromTarget(target, { itemtype: 'num' });
|
||||
});
|
||||
|
||||
return Promise.all(getPanelItems).then(function (results) {
|
||||
var items = _lodash2.default.flatten(results);
|
||||
var itemids = _lodash2.default.map(items, 'itemid');
|
||||
|
||||
return _this7.zabbix.getAlerts(itemids);
|
||||
return _this8.zabbix.getAlerts(itemids);
|
||||
}).then(function (triggers) {
|
||||
triggers = _lodash2.default.filter(triggers, function (trigger) {
|
||||
return trigger.priority >= _this7.alertingMinSeverity;
|
||||
return trigger.priority >= _this8.alertingMinSeverity;
|
||||
});
|
||||
|
||||
if (!triggers || triggers.length === 0) {
|
||||
@@ -570,12 +602,12 @@ var ZabbixAPIDatasource = function () {
|
||||
}, {
|
||||
key: 'replaceTargetVariables',
|
||||
value: function replaceTargetVariables(target, options) {
|
||||
var _this8 = this;
|
||||
var _this9 = this;
|
||||
|
||||
var parts = ['group', 'host', 'application', 'item'];
|
||||
_lodash2.default.forEach(parts, function (p) {
|
||||
if (target[p] && target[p].filter) {
|
||||
target[p].filter = _this8.replaceTemplateVars(target[p].filter, options.scopedVars);
|
||||
target[p].filter = _this9.replaceTemplateVars(target[p].filter, options.scopedVars);
|
||||
}
|
||||
});
|
||||
target.textFilter = this.replaceTemplateVars(target.textFilter, options.scopedVars);
|
||||
@@ -583,9 +615,9 @@ var ZabbixAPIDatasource = function () {
|
||||
_lodash2.default.forEach(target.functions, function (func) {
|
||||
func.params = _lodash2.default.map(func.params, function (param) {
|
||||
if (typeof param === 'number') {
|
||||
return +_this8.templateSrv.replace(param.toString(), options.scopedVars);
|
||||
return +_this9.templateSrv.replace(param.toString(), options.scopedVars);
|
||||
} else {
|
||||
return _this8.templateSrv.replace(param, options.scopedVars);
|
||||
return _this9.templateSrv.replace(param, options.scopedVars);
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
78
dist/test/datasource-zabbix/query.controller.js
vendored
78
dist/test/datasource-zabbix/query.controller.js
vendored
@@ -9,10 +9,6 @@ var _createClass = function () { function defineProperties(target, props) { for
|
||||
|
||||
var _sdk = require('app/plugins/sdk');
|
||||
|
||||
var _angular = require('angular');
|
||||
|
||||
var _angular2 = _interopRequireDefault(_angular);
|
||||
|
||||
var _lodash = require('lodash');
|
||||
|
||||
var _lodash2 = _interopRequireDefault(_lodash);
|
||||
@@ -70,11 +66,14 @@ var ZabbixQueryController = exports.ZabbixQueryController = function (_QueryCtrl
|
||||
2: { value: 'text', text: 'Text', mode: c.MODE_TEXT }
|
||||
};
|
||||
|
||||
_this.slaPropertyList = [{ name: "Status", property: "status" }, { name: "SLA", property: "sla" }, { name: "OK time", property: "okTime" }, { name: "Problem time", property: "problemTime" }, { name: "Down time", property: "downtimeTime" }];
|
||||
|
||||
// Map functions for bs-typeahead
|
||||
_this.getGroupNames = _lodash2.default.bind(_this.getMetricNames, _this, 'groupList');
|
||||
_this.getHostNames = _lodash2.default.bind(_this.getMetricNames, _this, 'hostList', true);
|
||||
_this.getApplicationNames = _lodash2.default.bind(_this.getMetricNames, _this, 'appList');
|
||||
_this.getItemNames = _lodash2.default.bind(_this.getMetricNames, _this, 'itemList');
|
||||
_this.getITServices = _lodash2.default.bind(_this.getMetricNames, _this, 'itServiceList');
|
||||
|
||||
// Update metric suggestion when template variable was changed
|
||||
$rootScope.$on('template-variable-value-updated', function () {
|
||||
@@ -101,14 +100,14 @@ var ZabbixQueryController = exports.ZabbixQueryController = function (_QueryCtrl
|
||||
|
||||
// Load default values
|
||||
var targetDefaults = {
|
||||
mode: c.MODE_METRICS,
|
||||
group: { filter: "" },
|
||||
host: { filter: "" },
|
||||
application: { filter: "" },
|
||||
item: { filter: "" },
|
||||
functions: [],
|
||||
options: {
|
||||
showDisabledItems: false
|
||||
'mode': c.MODE_METRICS,
|
||||
'group': { 'filter': "" },
|
||||
'host': { 'filter': "" },
|
||||
'application': { 'filter': "" },
|
||||
'item': { 'filter': "" },
|
||||
'functions': [],
|
||||
'options': {
|
||||
'showDisabledItems': false
|
||||
}
|
||||
};
|
||||
_lodash2.default.defaults(target, targetDefaults);
|
||||
@@ -120,13 +119,10 @@ var ZabbixQueryController = exports.ZabbixQueryController = function (_QueryCtrl
|
||||
|
||||
if (target.mode === c.MODE_METRICS || target.mode === c.MODE_TEXT) {
|
||||
|
||||
this.downsampleFunctionList = [{ name: "avg", value: "avg" }, { name: "min", value: "min" }, { name: "max", value: "max" }, { name: "sum", value: "sum" }, { name: "count", value: "count" }];
|
||||
|
||||
this.initFilters();
|
||||
} else if (target.mode === c.MODE_ITSERVICE) {
|
||||
this.slaPropertyList = [{ name: "Status", property: "status" }, { name: "SLA", property: "sla" }, { name: "OK time", property: "okTime" }, { name: "Problem time", property: "problemTime" }, { name: "Down time", property: "downtimeTime" }];
|
||||
this.itserviceList = [{ name: "test" }];
|
||||
this.updateITServiceList();
|
||||
_lodash2.default.defaults(target, { slaProperty: { name: "SLA", property: "sla" } });
|
||||
this.suggestITServices();
|
||||
}
|
||||
};
|
||||
|
||||
@@ -212,6 +208,16 @@ var ZabbixQueryController = exports.ZabbixQueryController = function (_QueryCtrl
|
||||
return items;
|
||||
});
|
||||
}
|
||||
}, {
|
||||
key: 'suggestITServices',
|
||||
value: function suggestITServices() {
|
||||
var _this6 = this;
|
||||
|
||||
return this.zabbix.getITService().then(function (itservices) {
|
||||
_this6.metric.itServiceList = itservices;
|
||||
return itservices;
|
||||
});
|
||||
}
|
||||
}, {
|
||||
key: 'isRegex',
|
||||
value: function isRegex(str) {
|
||||
@@ -246,11 +252,11 @@ var ZabbixQueryController = exports.ZabbixQueryController = function (_QueryCtrl
|
||||
}, {
|
||||
key: 'isContainsVariables',
|
||||
value: function isContainsVariables() {
|
||||
var _this6 = this;
|
||||
var _this7 = this;
|
||||
|
||||
return _lodash2.default.some(['group', 'host', 'application'], function (field) {
|
||||
if (_this6.target[field] && _this6.target[field].filter) {
|
||||
return utils.isTemplateVariable(_this6.target[field].filter, _this6.templateSrv.variables);
|
||||
if (_this7.target[field] && _this7.target[field].filter) {
|
||||
return utils.isTemplateVariable(_this7.target[field].filter, _this7.templateSrv.variables);
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
@@ -353,38 +359,6 @@ var ZabbixQueryController = exports.ZabbixQueryController = function (_QueryCtrl
|
||||
this.target.mode = mode;
|
||||
this.init();
|
||||
}
|
||||
|
||||
/////////////////
|
||||
// IT Services //
|
||||
/////////////////
|
||||
|
||||
/**
|
||||
* Update list of IT services
|
||||
*/
|
||||
|
||||
}, {
|
||||
key: 'updateITServiceList',
|
||||
value: function updateITServiceList() {
|
||||
var _this7 = this;
|
||||
|
||||
this.zabbix.getITService().then(function (iteservices) {
|
||||
_this7.itserviceList = [];
|
||||
_this7.itserviceList = _this7.itserviceList.concat(iteservices);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Call when IT service is selected.
|
||||
*/
|
||||
|
||||
}, {
|
||||
key: 'selectITService',
|
||||
value: function selectITService() {
|
||||
if (!_lodash2.default.isEqual(this.oldTarget, this.target) && _lodash2.default.isEmpty(this.target.errors)) {
|
||||
this.oldTarget = _angular2.default.copy(this.target);
|
||||
this.panelCtrl.refresh();
|
||||
}
|
||||
}
|
||||
}]);
|
||||
|
||||
return ZabbixQueryController;
|
||||
|
||||
7
dist/test/datasource-zabbix/zabbix.js
vendored
7
dist/test/datasource-zabbix/zabbix.js
vendored
@@ -201,6 +201,13 @@ function ZabbixFactory(zabbixAPIService, ZabbixCachingProxy, ZabbixDBConnector)
|
||||
return filterByQuery(items, itemFilter);
|
||||
});
|
||||
}
|
||||
}, {
|
||||
key: 'getITServices',
|
||||
value: function getITServices(itServiceFilter) {
|
||||
return this.cachingProxy.getITServices().then(function (itServices) {
|
||||
return findByFilter(itServices, itServiceFilter);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Build query - convert target filters to array of Zabbix items
|
||||
|
||||
@@ -39,7 +39,8 @@ function ZabbixCachingProxyFactory() {
|
||||
history: {},
|
||||
trends: {},
|
||||
macros: {},
|
||||
globalMacros: {}
|
||||
globalMacros: {},
|
||||
itServices: {}
|
||||
};
|
||||
|
||||
this.historyPromises = {};
|
||||
@@ -65,6 +66,9 @@ function ZabbixCachingProxyFactory() {
|
||||
this.itemPromises = {};
|
||||
this.getItemsOnce = callAPIRequestOnce(_lodash2.default.bind(this.zabbixAPI.getItems, this.zabbixAPI), this.itemPromises, getRequestHash);
|
||||
|
||||
this.itServicesPromises = {};
|
||||
this.getITServicesOnce = callAPIRequestOnce(_lodash2.default.bind(this.zabbixAPI.getITService, this.zabbixAPI), this.itServicesPromises, getRequestHash);
|
||||
|
||||
this.macroPromises = {};
|
||||
this.getMacrosOnce = callAPIRequestOnce(_lodash2.default.bind(this.zabbixAPI.getMacros, this.zabbixAPI), this.macroPromises, getRequestHash);
|
||||
|
||||
@@ -125,6 +129,11 @@ function ZabbixCachingProxyFactory() {
|
||||
var params = [hostids, appids, itemtype];
|
||||
return this.proxyRequest(this.getItemsOnce, params, this.cache.items);
|
||||
}
|
||||
}, {
|
||||
key: 'getITServices',
|
||||
value: function getITServices() {
|
||||
return this.proxyRequest(this.getITServicesOnce, [], this.cache.itServices);
|
||||
}
|
||||
}, {
|
||||
key: 'getMacros',
|
||||
value: function getMacros(hostids) {
|
||||
|
||||
@@ -126,15 +126,7 @@ class ZabbixAPIDatasource {
|
||||
|
||||
// IT services mode
|
||||
else if (target.mode === c.MODE_ITSERVICE) {
|
||||
// Don't show undefined and hidden targets
|
||||
if (target.hide || !target.itservice || !target.slaProperty) {
|
||||
return [];
|
||||
}
|
||||
|
||||
return this.zabbix.getSLA(target.itservice.serviceid, timeRange)
|
||||
.then(slaObject => {
|
||||
return responseHandler.handleSLAResponse(target.itservice, target.slaProperty, slaObject);
|
||||
});
|
||||
return this.queryITServiceData(target, timeRange, options);
|
||||
}
|
||||
});
|
||||
|
||||
@@ -276,6 +268,45 @@ class ZabbixAPIDatasource {
|
||||
});
|
||||
}
|
||||
|
||||
queryITServiceData(target, timeRange, options) {
|
||||
// Don't show undefined and hidden targets
|
||||
if (target.hide || (!target.itservice && !target.itServiceFilter) || !target.slaProperty) {
|
||||
return [];
|
||||
}
|
||||
|
||||
let itServiceIds = [];
|
||||
let itServices = [];
|
||||
let itServiceFilter;
|
||||
let isOldVersion = target.itservice && !target.itServiceFilter;
|
||||
|
||||
if (isOldVersion) {
|
||||
// Backward compatibility
|
||||
itServiceFilter = '/.*/';
|
||||
} else {
|
||||
itServiceFilter = this.replaceTemplateVars(target.itServiceFilter, options.scopedVars);
|
||||
}
|
||||
|
||||
return this.zabbix.getITServices(itServiceFilter)
|
||||
.then(itservices => {
|
||||
itServices = itservices;
|
||||
if (isOldVersion) {
|
||||
itServices = _.filter(itServices, {'serviceid': target.itservice.serviceid});
|
||||
}
|
||||
|
||||
itServiceIds = _.map(itServices, 'serviceid');
|
||||
return itServiceIds;
|
||||
})
|
||||
.then(serviceids => {
|
||||
return this.zabbix.getSLA(serviceids, timeRange);
|
||||
})
|
||||
.then(slaResponse => {
|
||||
return _.map(itServiceIds, serviceid => {
|
||||
let itservice = _.find(itServices, {'serviceid': serviceid});
|
||||
return responseHandler.handleSLAResponse(itservice, target.slaProperty, slaResponse);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Test connection to Zabbix API
|
||||
* @return {object} Connection status and Zabbix API version
|
||||
|
||||
@@ -20,24 +20,26 @@
|
||||
<div class="gf-form-inline" ng-show="ctrl.target.mode == 1">
|
||||
<div class="gf-form max-width-20">
|
||||
<label class="gf-form-label query-keyword width-7">IT Service</label>
|
||||
<div class="gf-form-select-wrapper max-width-20">
|
||||
<select class="gf-form-input"
|
||||
ng-change="ctrl.selectITService()"
|
||||
ng-model="ctrl.target.itservice"
|
||||
bs-tooltip="ctrl.target.itservice.name.length > 25 ? ctrl.target.itservice.name : ''"
|
||||
ng-options="itservice.name for itservice in ctrl.itserviceList track by itservice.name">
|
||||
<option value="">-- Select IT service --</option>
|
||||
</select>
|
||||
</div>
|
||||
<input type="text"
|
||||
ng-model="ctrl.target.itServiceFilter"
|
||||
bs-typeahead="ctrl.getITServices"
|
||||
ng-blur="ctrl.onTargetBlur()"
|
||||
data-min-length=0
|
||||
data-items=100
|
||||
class="gf-form-input"
|
||||
ng-class="{
|
||||
'zbx-variable': ctrl.isVariable(ctrl.target.itServiceFilter),
|
||||
'zbx-regex': ctrl.isRegex(ctrl.target.itServiceFilter)
|
||||
}">
|
||||
</input>
|
||||
</div>
|
||||
<div class="gf-form">
|
||||
<label class="gf-form-label query-keyword">IT service property</label>
|
||||
<label class="gf-form-label query-keyword">Property</label>
|
||||
<div class="gf-form-select-wrapper">
|
||||
<select class="gf-form-input"
|
||||
ng-change="ctrl.selectITService()"
|
||||
ng-model="ctrl.target.slaProperty"
|
||||
ng-options="slaProperty.name for slaProperty in ctrl.slaPropertyList track by slaProperty.name">
|
||||
<option value="">-- Property --</option>
|
||||
ng-change="ctrl.onTargetBlur()"
|
||||
ng-model="ctrl.target.slaProperty"
|
||||
ng-options="slaProperty.name for slaProperty in ctrl.slaPropertyList track by slaProperty.name">
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
import {QueryCtrl} from 'app/plugins/sdk';
|
||||
import angular from 'angular';
|
||||
import _ from 'lodash';
|
||||
import * as c from './constants';
|
||||
import * as utils from './utils';
|
||||
@@ -28,11 +27,20 @@ export class ZabbixQueryController extends QueryCtrl {
|
||||
2: {value: 'text', text: 'Text', mode: c.MODE_TEXT}
|
||||
};
|
||||
|
||||
this.slaPropertyList = [
|
||||
{name: "Status", property: "status"},
|
||||
{name: "SLA", property: "sla"},
|
||||
{name: "OK time", property: "okTime"},
|
||||
{name: "Problem time", property: "problemTime"},
|
||||
{name: "Down time", property: "downtimeTime"}
|
||||
];
|
||||
|
||||
// Map functions for bs-typeahead
|
||||
this.getGroupNames = _.bind(this.getMetricNames, this, 'groupList');
|
||||
this.getHostNames = _.bind(this.getMetricNames, this, 'hostList', true);
|
||||
this.getApplicationNames = _.bind(this.getMetricNames, this, 'appList');
|
||||
this.getItemNames = _.bind(this.getMetricNames, this, 'itemList');
|
||||
this.getITServices = _.bind(this.getMetricNames, this, 'itServiceList');
|
||||
|
||||
// Update metric suggestion when template variable was changed
|
||||
$rootScope.$on('template-variable-value-updated', () => this.onVariableChange());
|
||||
@@ -57,14 +65,14 @@ export class ZabbixQueryController extends QueryCtrl {
|
||||
|
||||
// Load default values
|
||||
var targetDefaults = {
|
||||
mode: c.MODE_METRICS,
|
||||
group: { filter: "" },
|
||||
host: { filter: "" },
|
||||
application: { filter: "" },
|
||||
item: { filter: "" },
|
||||
functions: [],
|
||||
options: {
|
||||
showDisabledItems: false
|
||||
'mode': c.MODE_METRICS,
|
||||
'group': { 'filter': "" },
|
||||
'host': { 'filter': "" },
|
||||
'application': { 'filter': "" },
|
||||
'item': { 'filter': "" },
|
||||
'functions': [],
|
||||
'options': {
|
||||
'showDisabledItems': false
|
||||
}
|
||||
};
|
||||
_.defaults(target, targetDefaults);
|
||||
@@ -77,26 +85,11 @@ export class ZabbixQueryController extends QueryCtrl {
|
||||
if (target.mode === c.MODE_METRICS ||
|
||||
target.mode === c.MODE_TEXT) {
|
||||
|
||||
this.downsampleFunctionList = [
|
||||
{name: "avg", value: "avg"},
|
||||
{name: "min", value: "min"},
|
||||
{name: "max", value: "max"},
|
||||
{name: "sum", value: "sum"},
|
||||
{name: "count", value: "count"}
|
||||
];
|
||||
|
||||
this.initFilters();
|
||||
}
|
||||
else if (target.mode === c.MODE_ITSERVICE) {
|
||||
this.slaPropertyList = [
|
||||
{name: "Status", property: "status"},
|
||||
{name: "SLA", property: "sla"},
|
||||
{name: "OK time", property: "okTime"},
|
||||
{name: "Problem time", property: "problemTime"},
|
||||
{name: "Down time", property: "downtimeTime"}
|
||||
];
|
||||
this.itserviceList = [{name: "test"}];
|
||||
this.updateITServiceList();
|
||||
_.defaults(target, {slaProperty: {name: "SLA", property: "sla"}});
|
||||
this.suggestITServices();
|
||||
}
|
||||
};
|
||||
|
||||
@@ -173,6 +166,14 @@ export class ZabbixQueryController extends QueryCtrl {
|
||||
});
|
||||
}
|
||||
|
||||
suggestITServices() {
|
||||
return this.zabbix.getITService()
|
||||
.then(itservices => {
|
||||
this.metric.itServiceList = itservices;
|
||||
return itservices;
|
||||
});
|
||||
}
|
||||
|
||||
isRegex(str) {
|
||||
return utils.isRegex(str);
|
||||
}
|
||||
@@ -293,30 +294,6 @@ export class ZabbixQueryController extends QueryCtrl {
|
||||
this.target.mode = mode;
|
||||
this.init();
|
||||
}
|
||||
|
||||
/////////////////
|
||||
// IT Services //
|
||||
/////////////////
|
||||
|
||||
/**
|
||||
* Update list of IT services
|
||||
*/
|
||||
updateITServiceList() {
|
||||
this.zabbix.getITService().then((iteservices) => {
|
||||
this.itserviceList = [];
|
||||
this.itserviceList = this.itserviceList.concat(iteservices);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Call when IT service is selected.
|
||||
*/
|
||||
selectITService() {
|
||||
if (!_.isEqual(this.oldTarget, this.target) && _.isEmpty(this.target.errors)) {
|
||||
this.oldTarget = angular.copy(this.target);
|
||||
this.panelCtrl.refresh();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Set templateUrl as static property
|
||||
|
||||
@@ -148,6 +148,11 @@ function ZabbixFactory(zabbixAPIService, ZabbixCachingProxy, ZabbixDBConnector)
|
||||
.then(items => filterByQuery(items, itemFilter));
|
||||
}
|
||||
|
||||
getITServices(itServiceFilter) {
|
||||
return this.cachingProxy.getITServices()
|
||||
.then(itServices => findByFilter(itServices, itServiceFilter));
|
||||
}
|
||||
|
||||
/**
|
||||
* Build query - convert target filters to array of Zabbix items
|
||||
*/
|
||||
|
||||
@@ -23,7 +23,8 @@ function ZabbixCachingProxyFactory() {
|
||||
history: {},
|
||||
trends: {},
|
||||
macros: {},
|
||||
globalMacros: {}
|
||||
globalMacros: {},
|
||||
itServices: {}
|
||||
};
|
||||
|
||||
this.historyPromises = {};
|
||||
@@ -56,6 +57,10 @@ function ZabbixCachingProxyFactory() {
|
||||
this.getItemsOnce = callAPIRequestOnce(_.bind(this.zabbixAPI.getItems, this.zabbixAPI),
|
||||
this.itemPromises, getRequestHash);
|
||||
|
||||
this.itServicesPromises = {};
|
||||
this.getITServicesOnce = callAPIRequestOnce(_.bind(this.zabbixAPI.getITService, this.zabbixAPI),
|
||||
this.itServicesPromises, getRequestHash);
|
||||
|
||||
this.macroPromises = {};
|
||||
this.getMacrosOnce = callAPIRequestOnce(_.bind(this.zabbixAPI.getMacros, this.zabbixAPI),
|
||||
this.macroPromises, getRequestHash);
|
||||
@@ -111,6 +116,10 @@ function ZabbixCachingProxyFactory() {
|
||||
return this.proxyRequest(this.getItemsOnce, params, this.cache.items);
|
||||
}
|
||||
|
||||
getITServices() {
|
||||
return this.proxyRequest(this.getITServicesOnce, [], this.cache.itServices);
|
||||
}
|
||||
|
||||
getMacros(hostids) {
|
||||
// Merge global macros and host macros
|
||||
let promises = [
|
||||
|
||||
Reference in New Issue
Block a user