I try to search hostgroup ID by the name using PHP library provided else where on this forum.
I believe my request is correct but Zabbix API returns an error. Can someone help?
Zabbix hostgroups contains (from output of my PHP):
Source code causing the problem is:
Result with debugging on is:
I believe my request is correct but Zabbix API returns an error. Can someone help?
Zabbix hostgroups contains (from output of my PHP):
Code:
[11] => Array
(
[groupid] => 13
[name] => IPX CPE routers
[internal] => 0
)
Code:
// Get hostgroupid by name "IPX CPE routers"
$ipxcpeid = ZabbixAPI::fetch_string('hostgroup','getid',array('name'=>"IPX CPE routers"))
or die('Unable to get hostgroup ID: '.print_r(ZabbixAPI::getLastError(),true));
echo "IPX CPE routers ID: $ipxcpeid\n";
Code:
Server running Zabbix API Version: 1.0
CURL URL: http://localhost/zabbix/api_jsonrpc.php
<br>CURL Options: Array
(
[19913] => 1
[13] => 30
[78] => 5
[81] =>
[64] =>
[52] => 1
[74] => 1
[10023] => Array
(
[0] => Content-Type: application/json-rpc
[1] => User-Agent: ZabbixAPI v1.0 - http://andrewfarley.com/zabbix_php_api
)
[10036] => POST
[10015] => {"auth":"d48fcf3995dd33c3bb003d4463562087","method":"hostgroup.getid","id":1,"params":{"name":"IPX CPE routers"},"jsonrpc":"2.0"}
[10102] => gzip
)
Got response from API: ({"jsonrpc":"2.0","error":{"code":-32602,"message":"Invalid params.","data":"Action does not exists"},"id":1})
Response decoded: (Array
(
[jsonrpc] => 2.0
[error] => Array
(
\[code\] => -32602
[message] => Invalid params.
[data] => Action does not exists
)
[id] => 1
)
Unable to get hostgroup ID: Array
(
\[code\] => -32602
[message] => Invalid params.
[data] => Action does not exists
)
Comment