I am trying to convert an ols script from Zabbix 1.8 to 2.X and am having some trouble.
The command below works on 1.8, but generated an error on 2.0.2
Note that the $AUTH_TOKEN has been populated in both cases ensuring this is not an authentication issue.
The error it returns on 2.0.2
Anyone have any ideas what's missing?
The command below works on 1.8, but generated an error on 2.0.2
Note that the $AUTH_TOKEN has been populated in both cases ensuring this is not an authentication issue.
Code:
API='http://#.#.#.#/zabbix/api_jsonrpc.php'
curl -i -X POST -H 'Content-Type: application/json-rpc' -d "{\"params\": {\"output\": \"extend\", \"sortfield\": \"name\"}, \"jsonrpc\": \"2.0\", \"method\": \"hostgroup.get\",\"auth\": \"$AUTH_TOKEN\", \"id\": 0}" $API
Code:
HTTP/1.1 200 OK
Date: Mon, 12 Nov 2012 20:09:35 GMT
Server: Apache/2.2.22 (Ubuntu)
X-Powered-By: PHP/5.3.10-1ubuntu3.4
Content-Length: 159
Content-Type: application/json
{"jsonrpc":"2.0","error":{"code":-32700,"message":"Parse error","data":"Invalid JSON. An error occurred on the server while parsing the JSON text."},"id":null}
Comment