diff --git a/zabbix/datasource.js b/zabbix/datasource.js index af924a2..c97e901 100644 --- a/zabbix/datasource.js +++ b/zabbix/datasource.js @@ -247,7 +247,9 @@ function (angular, _, kbn) { output: ['name', 'host'], sortfield: 'name', // Return only hosts that have items with numeric type of information. - with_simple_graph_items: true + with_simple_graph_items: true, + // Return only monitored hosts. + monitored_hosts: true }; // Return only hosts in given group if (groupids) { @@ -285,6 +287,8 @@ function (angular, _, kbn) { filter: { value_type: [0,3] }, + // Return only enabled items + monitored: true, searchByAny: true }; if (hostids) { diff --git a/zabbix/queryCtrl.js b/zabbix/queryCtrl.js index 5c43b3b..3c3401b 100644 --- a/zabbix/queryCtrl.js +++ b/zabbix/queryCtrl.js @@ -222,14 +222,16 @@ function (angular, _) { var name = item.name; var key = item.key_; - // extract params from key: - // "system.cpu.util[,system,avg1]" --> ["", "system", "avg1"] - var key_params = key.substring(key.indexOf('[') + 1, key.lastIndexOf(']')).split(','); + if (key) { + // extract params from key: + // "system.cpu.util[,system,avg1]" --> ["", "system", "avg1"] + var key_params = key.substring(key.indexOf('[') + 1, key.lastIndexOf(']')).split(','); - // replace item parameters - for (var i = key_params.length; i >= 1; i--) { - name = name.replace('$' + i, key_params[i - 1]); - }; + // replace item parameters + for (var i = key_params.length; i >= 1; i--) { + name = name.replace('$' + i, key_params[i - 1]); + }; + } return name; };