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

API Items.create() seems to be not working

XMLWordPrintable

    • Icon: Incident report Incident report
    • Resolution: Cannot Reproduce
    • Icon: Blocker Blocker
    • None
    • 1.9.9 (beta)
    • Documentation (D)
    • None
    • RHEL 5
      Java 1.6

      I am trying to create group, host, application and items. From the documentation 2.0, I am unable to create items. Here is the link for doc http://www.zabbix.com/documentation/2.0/manual/appendix/api/item/create
      Here is what I am sending
      2012-03-02 10:27:32,479 [main] TRACE com.sabre.zabbix.util.ZabbixApiUtil - Writing json command {
      "jsonrpc" : "2.0",
      "method" : "item.create",
      "params" :

      { "description" : "ERR_TIMEOUT", "key_" : "ERR_TIMEOUT", "hostid" : "10056", "type" : "0", "applications" : [ "[242]" ], "delay" : 30 }

      ,
      "id" : "2",
      "auth" : "ec1135440d2b385edcbecffe8a14f074"
      }
      2012-03-02 10:27:32,494 [main] TRACE com.sabre.zabbix.util.ZabbixApiUtil - Received json response {
      "jsonrpc" : "2.0",
      "error" :

      { "code" : -32602, "message" : "Invalid params.", "data" : "Incorrect arguments passed to function" }

      ,
      "id" : "2"
      }

      I also not able to get the application id correctly with application.get eventhough it is finding the application.exists. I am able to see in the Zabbix Server dashboard.
      public static String[] getAppNameIds(String url, String authId, String[] appNames){
      JsonGenerator jg = null;
      try{
      StringWriter sw = new StringWriter();
      jg = writePrefix(sw, "application.get");
      jg.writeFieldName("search");
      jg.writeStartArray();
      for(String appName : appNames)

      { jg.writeString(appName); }

      jg.writeEndArray();

      jg.writeStringField("output", "extend");
      writePostfix(jg, "2", authId);

      String json = sw.toString();
      String rc = ZabbixApiUtil.sendCommand(url, json);

      return (String[]) getRepeatingObjectValue(rc, "result", "applicationid");
      }catch(Exception e)

      { throw new IllegalArgumentException(e); }

      finally

      { cleanup(jg); }

      }
      The result doesn't have my application from the list.

      Thanks
      Jawed

            Unassigned Unassigned
            jkhan Jawed Khan
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved: