Hi,
I'm trying to use new Zabbix API to create an host with Zabbix php-class API but it doesn't work:
(http://andrewfarley.com/php/zabbix-1...php-class-v1-0 )
-> List hostGroup OK:
Result:
-> Create host KO:
Result:
What's my mistake ?
Regards,
I'm trying to use new Zabbix API to create an host with Zabbix php-class API but it doesn't work:
(http://andrewfarley.com/php/zabbix-1...php-class-v1-0 )
-> List hostGroup OK:
Code:
$five_hostgroup = ZabbixAPI::fetch_array('hostgroup','get',
array('extendoutput'=>1, 'limit'=>5))
or die('Unable to get hosts: '.print_r(ZabbixAPI::getLastError(),true));
echo "<li>List hostgroups: <pre>"
.print_r($five_hostgroup, true)."</pre></li>\n";
Code:
Array
(
[0] => Array
(
[groupid] => 1
[name] => Templates
[internal] => 0
)
[1] => Array
(
[groupid] => 5
[name] => O_NETWARE
[internal] => 0
)
[...]
Code:
ZabbixAPI::query('host', 'add', array("host"=>toto,
"groupids"=>array(0=>6,1=>5)
)
)
or die('<li>Unable to create host: '.
print_r(ZabbixAPI::getLastError(),true).'</li>');
Code:
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":"7667ee5f9f6d813d5a726898f4a5c799","method":"host.add",
"id":1,"params":{"host":"toto","groupids":[6,5]},
"jsonrpc":"2.0"}
[10102] => gzip
)
Code:
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 => [COLOR="Red"]Action does not exists[/COLOR]
)
[id] => 1
)
Regards,
i'll fix my previous post.

Oups now it Work ... Sorry
Comment