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

Cannot create trigger via API.

XMLWordPrintable

    • Icon: Incident report Incident report
    • Resolution: Won't fix
    • Icon: Critical Critical
    • None
    • 2.0.3
    • API (A)

      It happened after upgrading Zabbix server to ver 2.0.3:

      I'm creating some item...

      {
      "jsonrpc": "2.0",
      "auth": "<auth>",
      "method": "item.create",
      "params": {
      "name": "TestItem",
      "key_": "web.page.regexp[ws-app.internal,services/app/monitoring/check/TestItem?disaster=(0;1),80,<Severity>.+</Severity>,100]",
      "hostid": "600100000000124",
      "type": "0",
      "value_type": "4",
      "interfaceid": "600100000000372",
      "applications": [
      "600100000000598"
      ],
      "delay": "60",
      "history": "7",
      "formula": 1
      },
      "id": 2
      }
      

      ...with success:

      {
      "jsonrpc": "2.0",
      "result": {
      "itemids": [
      "100100000023420"
      ]
      },
      "id": 2
      }
      

      Then I'm trying to create a trigger for it:

      {
      "jsonrpc": "2.0",
      "auth": "<auth>",
      "method": "trigger.create",
      "params": {
      "expression": "{us1-mvs1v5:web.page.regexp[ws-app.internal,services/app/monitoring/check/TestItem?disaster=(0;1),80,<Severity>.+</Severity>,100].str(<Severity>Disaster</Severity>)}=1",
      "description": "This is disaster."
      },
      "id": 2
      }
      

      ...and get failure:

      {
      "jsonrpc": "2.0",
      "error": {
      "code": -32602,
      "message": "Invalid params.",
      "data": "Incorrect item key \"web.page.regexp[ws-app.internal,services/app/monitoring/check/TestItem?disaster=(0;1),80,<Severity>.+</Severity>,100]\" provided for trigger expression on \"us1-mvs1v5\"."
      },
      "id": 2
      }
      

      It says that item key is incorrect but it seems not to be true. I already have item with similar key (created via UI):

      web.page.regexp[ws-app.internal,services/app/monitoring/check/TestItem?disaster=(0;999999),80,<Severity>.+</Severity>,100]

      ..and I CAN add triggers to this existing item.
      Also note that I can find item with "incorrect" key by its key:

      {
      "jsonrpc": "2.0",
      "auth": "<auth>",
      "method": "item.get",
      "params": {
      "hostids": "600100000000124",
      "filter": {
      "key_": "web.page.regexp[ws-app.internal,services/app/monitoring/check/TestItem?disaster=(0;1),80,<Severity>.+</Severity>,100]"
      }
      },
      "id": 2
      }
      

      ...with success:

      {
      "jsonrpc": "2.0",
      "result": [
      {
      "itemid": "100100000023420",
      "hostid": "600100000000124"
      }
      ],
      "id": 2
      }
      

      the host seems to be correct:

      {
      "jsonrpc": "2.0",
      "auth": "321e4491f657342f6b2afc1a875c4787",
      "method": "host.get",
      "params": {
      "output": "extend",
      "filter": {
      "host": "us1-mvs1v5"
      }
      },
      "id": 2
      }
      
      {
      "jsonrpc": "2.0",
      "result": [
      {
      "maintenances": [],
      "hostid": "600100000000124",
      "proxy_hostid": "0",
      "host": "us1-mvs1v5",
      "status": "0",
      "disable_until": "0",
      "error": "",
      "available": "1",
      "errors_from": "0",
      "lastaccess": "0",
      "ipmi_authtype": "-1",
      "ipmi_privilege": "2",
      "ipmi_username": "",
      "ipmi_password": "",
      "ipmi_disable_until": "0",
      "ipmi_available": "0",
      "snmp_disable_until": "0",
      "snmp_available": "0",
      "maintenanceid": "0",
      "maintenance_status": "0",
      "maintenance_type": "0",
      "maintenance_from": "0",
      "ipmi_errors_from": "0",
      "snmp_errors_from": "0",
      "ipmi_error": "",
      "snmp_error": "",
      "jmx_disable_until": "0",
      "jmx_available": "0",
      "jmx_errors_from": "0",
      "jmx_error": "",
      "name": "us1-mvs1v5"
      }
      ],
      "id": 2
      }
      

      Here is a comment from https://www.zabbix.com/forum/showthread.php?t=39007
      Pavels:
      Judging by the ID of the item you've created, it belongs to a different node then the host. You shouldn't be able to create such items at all. It probably has something to do your node configuration.

            Unassigned Unassigned
            astral_keks Nikita
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved: