Hello,
I updated zabbix with 1.8.4, I am using php scripts to do various things through APIs using zabbix-1-8-api-php-class-v1-0 from Andrew Farley. I can't get working one of them which creates macros at host level.
API complains that macro begins with { ??
Thanks for help
Alain
–
Below is the php code ...........
ZabbixAPI::query('usermacro','massAdd',array('host s'=>array('hostid'=>"$hid"),'macros'=>array('macro '=>"{\$ALERTLOGPATH}",'value'=>"/usr/lib/oracle/xe/app/oracle/admin/XE/bdump/alert_XE.log")))
or die('Unable to update: '.print_r(ZabbixAPI::getLastError(),true));
Below is the Debug Output .............
CURL URL: https://server/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":"b1a6055e545c63fa7bcf6b6d97051396","method ":"usermacro.massAdd","id":1,"params":{"hosts":
,"macros":{"macro":"{$ALERTLOGPATH} ","value":"eeeeeeeee"}},"jsonrpc":"2.0"}
[10102] => gzip
)
Got response from API: ({"jsonrpc":"2.0","error":{"code":-32602,"message":"Invalid params.","data":"[ CUserMacro::massAdd ] [
,"id":1})
Response decoded: (Array
(
[jsonrpc] => 2.0
[error] => Array
(
[code] => -32602
[message] => Invalid params.
[data] => [ CUserMacro::massAdd ] [{]: Wrong macro
)
[id] => 1
)