-
Incident report
-
Resolution: Fixed
-
Major
-
None
-
7.0.3
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(
)
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(
)
for trigger in triggers:
print(f"- {trigger['description']}")
Postman:
Get: https://xxxxxxxxxxxxxx/api_jsonrpc.php
{
"jsonrpc": "2.0",
"method": "trigger.get",
"params":
,
"auth": "xxxxxxxxxxxxxxx",
"id": 1
}
This was tested with Zabbix 7.