Ad Widget

Collapse

Zabbix API configuration.import problem

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • ysmolyaninov
    Junior Member
    • Nov 2013
    • 2

    #1

    Zabbix API configuration.import problem

    Hi

    I'm using zabbix API for dynamic adjusting configuration on automatic deployments. I wrote a script, that generates an xml with configuration (it's a valid xml, I'm able to import it manually) but when trying to upload it using API I face with unexpected problem.
    With the following command
    import=`curl -s POST -H 'Content-Type: application/json-rpc' -d \
    "{\
    \"jsonrpc\":\"2.0\",\
    \"method\":\"configuration.import\",\
    \"params\":{\"format\":\"xml\",\"rules\":{\
    \"templates\":{\"createMissing\":true,\"updateExis ting\":true},\
    \"items\":{\"createMissing\": true,\"updateExisting\":true}},\
    \"source\": @template.xml)},\"auth\":\"$AUTH_TOKEN\",\"id\":12 1}" $API`
    I get
    {"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}

    JSON seems to be valid - if I use some inline xml instead of @template.xml it works greate, but I can't use it for half-megabyte xml.
Working...