0

Im looking for the problems list (problem.get) but only the probems also listed on the dashboard itself. I've tried it with triggers etc etc, I can not filter for status anywhere. When I do problem.get I get 712 problems while there are only like 10 active now(I dont know where this list even comes from, probably history, I want to know what filters zabbix uses to get the problem list on the dashboard, its not filtered on date/time or anyting. I would like the same list as in the dashboard itself. Im looking for the JSON request that gets this information. I tried it with problems.get and also with Trigger.get (I can not filter on state/severity: problem).

{
    "jsonrpc": "2.0",
    "method": "problem.get",
    "params": {
        "output": "extend",
        "selectTags": "extend",
        "selectSuppressionData": "extend",
        "recent": "true",
        "sortfield": ["eventid"],
        "sortorder": "DESC"
    },
    "auth": "XXX",
    "id": 1
}




{
    "jsonrpc": "2.0",
    "method": "trigger.get",
    "params": {
        "output": [
            "triggerid",
            "description",
            "hosts"
        ],
        "selectHosts": ["host", "hostid"],
        "filter": {
            "status": "0",
            "value": "1",
            "priority": "2"
        },
        "sortfield": "priority",
        "sortorder": "DESC"
    },
    "auth": "xxx",
    "id": 1
}

For the triggerjson, it worked until new problems came up (its also that status,value and priority are different in some problems (i saw 0, 0, 4 and one problem 0, 1, 2 (all listed on problems in zabbix dashboard) so I dont know what to filter anymore

Anony777
  • 1
  • 1

1 Answers1

-1

On the Problems dashboard Zabbix shows problems with the active hosts only. Therefore at first get the list of needed active hosts, for example:

{
  "jsonrpc":"2.0",
  "method":"host.get",
  "params":{
    "filter":{
      "status":0
    },
    "preservekeys":"true",
    "output":[]
  },
  "auth":"XXX",
  "id":1
}

And then use resulting list of hostids in problem.get request:

{
  "jsonrpc":"2.0",
  "method":"problem.get",
  "params":{
    "severities":4,
    "hostids":["15921","15730",...]
  },
  "auth":"XXX",
  "id":2
}