Ad Widget

Collapse

zabbix 2.0 api configuration import error

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • billb
    Junior Member
    • Nov 2012
    • 14

    #1

    zabbix 2.0 api configuration import error

    Hi
    I am trying to import a template from one exported through the UI. If I import it through the UI it works perfectly. Using the API I get the error:

    jsonrpc":"2.0","error":{"code":-32500,"message":"Application error.","data":""},"id":1


    This is how I am trying to import:

    {
    "jsonrpc": "2.0",
    "method": "configuration.import",
    "params": {
    "format": "xml"
    },
    "rules": {
    "templates": {
    "createMissing": true,
    "updateExisting": true
    },
    "source": "<?xmlversion=\"1.0\"encoding=\"UTF-8\"?><zabbix_export><version>2.0</version><date>2014-04-23T13:12:15Z</date><groups><group><name>Templates</name></group></groups><templates><template><template>template-service</template><name>template-service</name><groups><group><name>Templates</name></group></groups><applications/><items><item><name>Javaserviceisnotrunningon{HOST NAME}</name><type>0</type><snmp_community/><multiplier>0</multiplier><snmp_oid/><key>proc.num[&quot;java&quot;,,,]</key><delay>120</delay><history>7</history><trends>365</trends><status>1</status><value_type>3</value_type><allowed_hosts/><units/><delta>0</delta><snmpv3_securityname/><snmpv3_securitylevel>0</snmpv3_securitylevel><snmpv3_authpassphrase/><snmpv3_privpassphrase/><formula>1</formula><delay_flex/><params/><ipmi_sensor/><data_type>0</data_type><authtype>0</authtype><username/><password/><publickey/><privatekey/><port/><description/><inventory_link>0</inventory_link><applications/><valuemap/></item><item><name>Javaserviceopenfiles</name><type>0</type><snmp_community/><multiplier>0</multiplier><snmp_oid/><key>javaservice.open_files</key><delay>30</delay><history>90</history><trends>365</trends><status>0</status><value_type>3</value_type><allowed_hosts/><units/><delta>0</delta><snmpv3_securityname/><snmpv3_securitylevel>0</snmpv3_securitylevel><snmpv3_authpassphrase/><snmpv3_privpassphrase/><formula>1</formula><delay_flex/><params/><ipmi_sensor/><data_type>0</data_type><authtype>0</authtype><username/><password/><publickey/><privatekey/><port/><description/><inventory_link>0</inventory_link><applications/><valuemap/></item><item><name>serviceroviorunning</name><type>0</type><snmp_community/><multiplier>0</multiplier><snmp_oid/><key>net.tcp.listen[9000]</key><delay>120</delay><history>7</history><trends>365</trends><status>0</status><value_type>3</value_type><allowed_hosts/><units/><delta>0</delta><snmpv3_securityname/><snmpv3_securitylevel>0</snmpv3_securitylevel><snmpv3_authpassphrase/><snmpv3_privpassphrase/><formula>1</formula><delay_flex/><params/><ipmi_sensor/><data_type>0</data_type><authtype>0</authtype><username/><password/><publickey/><privatekey/><port/><description/><inventory_link>0</inventory_link><applications/><valuemap/></item></items><discovery_rules/><macros/><templates/><screens/></template></templates><triggers><trigger><expression>{template-serviceroc.num[&quot;java&quot;,,,].max(#2)}=0</expression><name>RovioJavaserviceisnotrunningon{HO STNAME}</name><url/><status>1</status><priority>4</priority><description/><type>0</type><dependencies/></trigger><trigger><expression>{template-service:net.tcp.listen[9000].max(#2)}=0</expression><name>Rovioserviceisdownon{HOSTNAME}</name><url/><status>0</status><priority>4</priority><description/><type>0</type><dependencies/></trigger></triggers></zabbix_export>"
    },
    "auth": "271839c3db7204ae185deb188715c7ff",
    "id": 1
    }
  • billb
    Junior Member
    • Nov 2012
    • 14

    #2
    I have figured out the error:

    The xml I export starts with <?xmlversion=\"1.0\"encoding=\"UTF-8\"?>

    wheras I need to comment this out somehow to:

    <!--?xml version=\"1.0\" encoding=\"UTF-8\"?-->


    Any ideas why I cannot use the configuration import with the first xml version?

    Comment

    Working...