From ff3fe7f2194c015be79acc68232e30c942b4fb57 Mon Sep 17 00:00:00 2001 From: Alexander Zobnin Date: Fri, 29 May 2015 21:51:23 +0300 Subject: [PATCH] Metrics search for multiple hosts. --- zabbix/datasource.js | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/zabbix/datasource.js b/zabbix/datasource.js index ba4f11e..9dc4370 100644 --- a/zabbix/datasource.js +++ b/zabbix/datasource.js @@ -288,6 +288,10 @@ function (angular, _, kbn) { if (applicationids) { params.applicationids = applicationids; } + // Return host property for multiple hosts + if (!hostids || (_.isArray(hostids) && hostids.length > 1)) { + params.selectHosts = ['name']; + } return this.performZabbixAPIRequest('item.get', params); }; @@ -429,9 +433,9 @@ function (angular, _, kbn) { return self.performItemSuggestQuery(hostids, applicationids, groupids) .then(function (result) { return _.map(result, function (item) { + var itemname = expandItemName(item) return { - //text: item.key_, - text: expandItemName(item), + text: (item.hosts ? item.hosts[0].name + ': ' : '') + itemname, expandable: false }; });