Ad Widget

Collapse

trigger.get returns incorrect value for acknkowledge through Zabbix API

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Maxxon
    Junior Member
    • Mar 2013
    • 1

    #1

    trigger.get returns incorrect value for acknkowledge through Zabbix API

    Hello!

    I use Zabbix 2.0.3 in my environment and want to get the current problems via Zabbix API using another application (like a watcher), written on Java.

    I created a table in my application and trying to populate it with unacknowledged problems and with acknowledged problems using separate queries.
    Here are my JSON requests samples:

    for unacknowledged problems:
    Code:
    { "jsonrpc": "2.0",
        "method": "trigger.get",
        "params": {
            "output": [
                "triggerid",
                "description",
                "extend",
                "lastchange",
                "status",
                "priority"
            ],
            "monitored": true,
            "expandDescription": 1,
            "only_true": true,
            "withUnacknowledgedEvents": true,
            "hostids": ["10207","10243","10242"]
        }, "auth":"3fa96915d9432af7396754df0dc76872",  "id":1}
    for acknowledged problems:
    Code:
    {    "jsonrpc": "2.0",
        "method": "trigger.get",
        "params": {
            "output": [
                "triggerid",
                "description",
                "extend",
                "lastchange",
                "status",
                "priority"
            ],
            "monitored": true,
            "expandDescription": 1,
            "only_true": true,
            "withAcknowledgedEvents": true,
            "hostids": ["10207","10243","10242"]
        }, "auth":"3fa96915d9432af7396754df0dc76872",  "id":1}
    Unfortunately, both queries returns incorrect values of acknowledgement to me for actual problems. I see that issues with a lowest priority and last changed date about 3 months ago are interpreted as acknowledged, but Zabbix Dashboard show that they're not acknowledged. Also, if i perform acknowledgment for "fresh" issues, Zabbix API does not provide any changes to me.

    Is there are anybody who used the schema like that and know how fix this issue? Do I need to use another Zabbix API methods or it is known (and already registered in bugtracker) Zabbix bug?

    Also, is anybody know how to get with Zabbix API the latest acknowledgement messages for actual issue?
  • bbrendon
    Senior Member
    • Sep 2005
    • 870

    #2
    Did you ever figure this out? I'm trying to do something similar and so far I've been unsuccessful.
    Unofficial Zabbix Expert
    Blog, Corporate Site

    Comment

    • bbrendon
      Senior Member
      • Sep 2005
      • 870

      #3
      Figured it out. This shows unacknowledged events. I think it could use a bit more tuning, but it works.

      Code:
      $json = {
        jsonrpc=> '2.0',
        method => 'trigger.get',
        params => {
          output => ['extend','triggerid','description','value'],
          only_true => ['true'],
          monitored => ['true'],
          expandData => ['true'],
          withUnacknowledgedEvents => ['true'],
          filter => {
             value => ['1'],
          },
        },
        id => 2,
        auth => "$authID",
      };
      Unofficial Zabbix Expert
      Blog, Corporate Site

      Comment

      Working...