Uploaded image for project: 'ZABBIX BUGS AND ISSUES'
  1. ZABBIX BUGS AND ISSUES
  2. ZBX-7425

Zabbix API configuration.import problem

XMLWordPrintable

    • Icon: Incident report Incident report
    • Resolution: Won't fix
    • Icon: Trivial Trivial
    • None
    • None
    • API (A)
    • None
    • zabbix 2.0.9

      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.

            Unassigned Unassigned
            y.smolyaninov Yaroslav
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved: