Ad Widget

Collapse

Alarm if over x% of triggers are true

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Muschelpuster
    Junior Member
    • Dec 2025
    • 1

    #1

    Alarm if over x% of triggers are true

    I'm new to Zabbix and am evaluating its possibilities right now. I modified my special solution to check our SIP trunks. This is creating now hosts from its own groups and an item (Zabbix trapper) for every destination via Web API. I also create some triggers in this way and push the values into the items. So I have a no_data trigger for each item to monitor my solution. But I don't want to have an alarm for every missing value. Is there a way to create an alarm if over, e.g. 50% of these triggers are true? By creating it automatically, all triggers have a unique name scheme (Callmonitor_item-name_noData)

    Niels
  • markosa
    Senior Member
    Zabbix Certified SpecialistZabbix Certified ProfessionalZabbix Certified Expert
    • Aug 2022
    • 104

    #2
    I have solved this kind of thing by creating virtual host, which presents that kind of alarm(s), it has item(script) with following js:
    //This is script item, gets active alarm count which are "Unavailable by ICMP" for group id 28==My test group
    try {
    var req = new HttpRequest();
    var Query = {"jsonrpc": "2.0","method": "problem.get","params": {"output": "extend","search": {"name": "Unavailable by ICMP*"},"searchByAny": true,"searchWildcardsEnabled": true,"countOutput": true,"selectSuppressionData": "extend","groupids":"28","recent": false,"sortfield": ["eventid"],"sortorder": "DESC"},"id": 1};
    var authToken = "THIS.IS.MY.API.TOKEN";
    req.addHeader("Content-Type: application/json");
    req.addHeader("Authorization: Bearer " + authToken);
    reqq = req.post("https://MY.ZABBIX.INSTANCE/api_jsonrpc.php", JSON.stringify(Query));
    var data = JSON.parse(reqq);
    return JSON.stringify(data['result'])
    } catch (error) {
    Zabbix.Log(3, "Error when executing this js 'warning': "+error);
    return "";
    }

    It queries zabbix API for certain alarms, 1min interval and gets number of active ones, then that item has trigger which alerts if number of xx-host within hostgroup 'My test group' with id 28, are not responding to ping.
    In same virtual host i have item(calculated) which counts number of hosts in that 'My test group' using formula: sum(exists_foreach(/*/icmpping?[(group="My test group")]))
    I guess that using similar aproach you could get what you need.
    EDIT. I have those individual alarms set be low level(undefined/info) and that counted one is set to be higher, this aproach is still getting those individual alarms, need those too...
    Last edited by markosa; 02-12-2025, 08:43.

    Comment

    Working...