Ad Widget

Collapse

"Incorrect item key" when creating trigger via API

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • astral_keks
    Junior Member
    • Feb 2013
    • 3

    #1

    "Incorrect item key" when creating trigger via API

    Hi all,
    I'm facing some strange problem. It happened after upgrading Zabbix server to ver 2.0.3:

    I’m creating some item…

    {
    "jsonrpc": "2.0",
    "auth": "ba9b77eb3552e061d1f481daf42517e0",
    "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": "ba9b77eb3552e061d1f481daf42517e0",
    "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": "ba9b77eb3552e061d1f481daf42517e0",
    "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
    }
  • Pavels
    Member
    • Oct 2011
    • 83

    #2
    Are you sure host "us1-mvs1v5" used in the expression is correct? I've tried it on 2.0.3 and 2.0.5rc1 and seems to work fine.

    Comment

    • astral_keks
      Junior Member
      • Feb 2013
      • 3

      #3
      Originally posted by Pavels
      Are you sure host "us1-mvs1v5" used in the expression is correct? I've tried it on 2.0.3 and 2.0.5rc1 and seems to work fine.
      Thanks for the reply.
      Yes, 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
      }

      Comment

      • Pavels
        Member
        • Oct 2011
        • 83

        #4
        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.

        May be you could submit a step-by-step description of how to reproduce the bug to http://support.zabbix.com?

        Comment

        • astral_keks
          Junior Member
          • Feb 2013
          • 3

          #5
          Originally posted by 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.

          May be you could submit a step-by-step description of how to reproduce the bug to http://support.zabbix.com?
          Issue has been created: https://support.zabbix.com/browse/ZBX-6450

          Comment

          Working...