Hi everyone,
I am struggling with the Zabbix API (v7.0/7.4). I am trying to build a bash script that fetches only the currently active problems as seen in the Zabbix Dashboard "Current problems" widget.
In my Zabbix Frontend (Global View), I only see one active warning (High memory usage). However, my API script returns nine results, including "Not running" and "Restarted" messages that are NOT visible in my current dashboard view.
I've tried a debug script to check the acknowledged and suppressed status of these triggers. Here is the output:
Observations:
Some "Not running" messages have acknowledged: "1", but they still show up in the API result.
suppressed is returning null (probably because I am using trigger.get instead of problem.get).
My Dashboard is clean, but the API seems to ignore the filters that make the Dashboard "clean".
The code I am currently using:
My Question:
What do I need to change in my API request to get exactly and only the same active problems that are visible in the "Current problems" dashboard widget? Should I switch to problem.get, and if so, how do I correctly filter for "unsuppressed" and "globally visible" issues?
Thanks in advance for your help!
I am struggling with the Zabbix API (v7.0/7.4). I am trying to build a bash script that fetches only the currently active problems as seen in the Zabbix Dashboard "Current problems" widget.
In my Zabbix Frontend (Global View), I only see one active warning (High memory usage). However, my API script returns nine results, including "Not running" and "Restarted" messages that are NOT visible in my current dashboard view.
I've tried a debug script to check the acknowledged and suppressed status of these triggers. Here is the output:
Code:
david@iobroker:~$ ./test_zabbix.sh --- Diagnose: Aktive Trigger-Details ---
{
"host": "Proxmox_Home",
"msg": "Proxmox VE: LXC [pve/Llm] has been restarted",
"prio": "1",
"acknowledged": "0",
"suppressed": null
}
{
"host": "Proxmox_Home",
"msg": "Proxmox VE: LXC [pve/cloudflare (lxc/116)]: Not running",
"prio": "3",
"acknowledged": "1",
"suppressed": null
}
... (several more "Not running" messages with ack 0 or 1) ...
{
"host": "Proxmox_Home",
"msg": "Proxmox VE: VM [pve/PBS (qemu/114)] high memory usage",
"prio": "2",
"acknowledged": "0",
"suppressed": null
}
Some "Not running" messages have acknowledged: "1", but they still show up in the API result.
suppressed is returning null (probably because I am using trigger.get instead of problem.get).
My Dashboard is clean, but the API seems to ignore the filters that make the Dashboard "clean".
The code I am currently using:
Code:
curl -s -X POST "$ZABBIX_URL" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer $TOKEN" \
-d '{
"jsonrpc": "2.0",
"method": "trigger.get",
"params": {
"output": ["triggerid", "description", "priority"],
"selectHosts": ["name"],
"selectLastEvent": ["acknowledged", "suppressed"],
"only_true": true,
"monitored": true,
"expandDescription": true
},
"id": 1
}'
What do I need to change in my API request to get exactly and only the same active problems that are visible in the "Current problems" dashboard widget? Should I switch to problem.get, and if so, how do I correctly filter for "unsuppressed" and "globally visible" issues?
Thanks in advance for your help!
Comment