diff --git a/zabbix/datasource.js b/zabbix/datasource.js index 8305127..d62b75b 100644 --- a/zabbix/datasource.js +++ b/zabbix/datasource.js @@ -286,7 +286,7 @@ function (angular, _, kbn) { } // Get groups else if (parts.length === 1) { - return zabbix.findZabbixGroup(template.group).then(function (result) { + return zabbix.getGroupByName(template.group).then(function (result) { return _.map(result, function (hostgroup) { return { text: hostgroup.name, diff --git a/zabbix/zabbixAPIWrapper.js b/zabbix/zabbixAPIWrapper.js index 65e5242..eae7ea5 100644 --- a/zabbix/zabbixAPIWrapper.js +++ b/zabbix/zabbixAPIWrapper.js @@ -307,6 +307,24 @@ function (angular, _) { }; + /** + * Search group by name. + * + * @param {string} group group name + * @return {array} groups + */ + this.searchGroup = function (group) { + var params = { + output: ['name'], + search: { + name: group + }, + searchWildcardsEnabled: true + }; + return this.performZabbixAPIRequest('hostgroup.get', params); + }; + + /** * Get hosts by names *