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

Using python Zabbix_Utils, the triggers.get API call always returns all triggers regardless of the host and hostids parameters.

XMLWordPrintable

    • Icon: Incident report Incident report
    • Resolution: Fixed
    • Icon: Major Major
    • None
    • 7.0.3
    • API (A)

      When making the triggers.get API call and passing a host or hostids as parameters, it returns all triggers configured in Zabbix instead of filtering those that belong to the specified host. When testing the same method through Postman, it works correctly and only returns the triggers for the host provided as a parameter.

      Attached are scripts to reproduce the error.
      Python Using host
      from zabbix_utils import ZabbixAPI

      zabbix_url = "xxxxxxxxxxxxxx"
      api_key = "xxxxxxxxxxxxxxxx"
      zapi = ZabbixAPI(url=zabbix_url, token=api_key)
      hostname= "xxxxxxxxxxx"
      triggers = zapi.trigger.get(

      { "host": hostname, "output": "extend", }

      )
      for trigger in triggers:
      print(f"- {trigger['description']}")

      Python Using host
      from zabbix_utils import ZabbixAPI

      zabbix_url = "xxxxxxxxxxxxxx"
      api_key = "xxxxxxxxxxxxxxxx"
      zapi = ZabbixAPI(url=zabbix_url, token=api_key)
      hostname= "xxxxxxxxxxx"

      hosts = zapi.host.get({"filter": {"host": hostname}})
      host_id = hosts[0]['hostid']
      triggers = zapi.trigger.get(

      { "hostids": host_id, "output": "extend", }

      )
      for trigger in triggers:
      print(f"- {trigger['description']}")

      Postman:
      Get: https://xxxxxxxxxxxxxx/api_jsonrpc.php
      {
      "jsonrpc": "2.0",
      "method": "trigger.get",
      "params":

      { "host": "xxxxxxxxxxxx", "output": "extend" }

      ,
      "auth": "xxxxxxxxxxxxxxx",
      "id": 1
      }

      This was tested with Zabbix 7.

            zabbix.support Zabbix Support Team
            jcayrbp Juan Carlos Angelucci
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: