datasource: implement itemid query mode

This commit is contained in:
Alexander Zobnin
2017-07-25 18:40:13 +03:00
parent a48da2cda6
commit fc1748a087
24 changed files with 373 additions and 214 deletions

View File

@@ -165,10 +165,7 @@ function ZabbixAPIServiceFactory(alertSrv, zabbixAPICoreService) {
sortfield: 'name',
webitems: true,
filter: {},
selectHosts: [
'hostid',
'name'
]
selectHosts: ['hostid', 'name']
};
if (hostids) {
params.hostids = hostids;
@@ -186,16 +183,25 @@ function ZabbixAPIServiceFactory(alertSrv, zabbixAPICoreService) {
}
return this.request('item.get', params)
.then(expandItems);
.then(utils.expandItems);
}
function expandItems(items) {
_.forEach(items, item => {
item.item = item.name;
item.name = utils.expandItemName(item.item, item.key_);
return item;
});
return items;
}
getItemsByIDs(itemids) {
var params = {
itemids: itemids,
output: [
'name', 'key_',
'value_type',
'hostid',
'status',
'state'
],
webitems: true,
selectHosts: ['hostid', 'name']
};
return this.request('item.get', params)
.then(utils.expandItems);
}
getMacros(hostids) {