Hello community,
I am currently stuck at a problem I can't seem to solve.
I need to get all hosts which are linked to a template.
I can query the template fine, I can query hosts based on other filters fine, but I can't get it to work with template or group ids.
I am using Andrew Farleys PHP class (kudos to Mr. Farley!), the JSON Request it creates looks like this:
The template id is definitely correct. This is how I call it from PHP:
It always returns all hosts, as if I have given an empty filter. What am I doing wrong?
I also tried:
without success.
Any help is greatly appreciated!
regards
tuo
I am currently stuck at a problem I can't seem to solve.
I need to get all hosts which are linked to a template.
I can query the template fine, I can query hosts based on other filters fine, but I can't get it to work with template or group ids.
I am using Andrew Farleys PHP class (kudos to Mr. Farley!), the JSON Request it creates looks like this:
PHP Code:
Content-Type: application/json-rpc [1] => User-Agent: ZabbixAPI v1.0 - http://andrewfarley.com/zabbix_php_api ) [10036] => POST [10015] => {"auth":"5eea9eee2c313eb7b20fceff058f12c0","method":"host.get","id":1,"params":{"extendoutput":1,"filter":{"templateids":["10053"]}},"jsonrpc":"2.0"
PHP Code:
$hosts = ZabbixAPI::fetch_array('host','get',array('extendoutput'=>1, 'filter'=>array('templateids' => array($template[0]["templateid"]))));
I also tried:
PHP Code:
$hosts = ZabbixAPI::fetch_array('host','get',array('extendoutput'=>1, 'filter'=>array('templateids' => array("templateid" => $template[0]["templateid"]))));
Any help is greatly appreciated!
regards
tuo
Comment