Ad Widget

Collapse

API Zabbix 5.0, please help

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • vraskoshnyy
    Junior Member
    • Dec 2020
    • 4

    #1

    API Zabbix 5.0, please help

    Hi. I am writing a telegram-bot on PHP, which should receive from Zabbix via API a list and number of Problems that do not have a "acknowledged" state and whose severities is from 4 to 5, including 5.
    I can easily get such a list in the web interface at


    Code:
    https://localhost/zabbix.php?action=problem.view&filter_show=3&filter_application=&filter_name=&filter_severities%5B4%5D=4&filter_severities%5B5%5D=5&filter_inventory%5B0%5D%5Bfield%5D=type&filter_inventory%5B0%5D%5Bvalue%5D=&filter_evaltype=0&filter_tags%5B0%5D%5Btag%5D=&filter_tags%5B0%5D%5Boperator%5D=0&filter_tags%5B0%5D%5Bvalue%5D=&filter_show_tags=3&filter_tag_name_format=0&filter_tag_priority=&filter_show_opdata=0&filter_unacknowledged=1&filter_set=1
    = i get 10 Problems

    But if I make a request to the API such as this

    Code:
    {
        "jsonrpc": "2.0",
        "method": "problem.get",
        "params": {
            "acknowledged": "0",
            "severities": ["4","5"],
            "suppressed": "0"
        },
        "auth": "__auth_key__",
        "id": 1
    }
    in response I get 442 Problems.

    Please help me understand why there is such a difference in the result? What am I doing wrong?

    Thank you.
  • vraskoshnyy
    Junior Member
    • Dec 2020
    • 4

    #2
    I also saw that if I add the "time_from" parameter to the API request and specify, for example, the timestamp minus 1 hour from the current time,
    then the response will contain the correct result. But how can I get the result from the API exactly the same as the web version of the Zabbix interface?

    Comment

    Working...