Ad Widget

Collapse

Multiple Triggers from JSON result (table) or snmptable

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • mako
    Junior Member
    • Feb 2022
    • 3

    #1

    Multiple Triggers from JSON result (table) or snmptable

    Until today I have not found a solution for the following problem:

    I have the possibility to query an external system via SNMPTABLE or via REST/JSON for pending alarms. I have currently chosen REST. I have now created an item that filters the possible alarms with four JSONpath queries so that I only have the alarms that interest me.
    Now the item data contains a JSON array with several objects (all valid alarms).

    Example data (stripped):
    Code:
    [
    {
    "ref": 17439111,
    "severity": "WARNING",
    "timeStarted": 1630309185460,
    "timeEnded": null,
    "message": "Rx 2 level control out of range",
    "messageName": "WARNING_RX2_LEVEL_CONTROL_OUT_OF_RANGE",
    "messageCode": 2147489225,
    },
    {
    "ref": 17439108,
    "severity": "WARNING",
    "timeStarted": 1630309185381,
    "timeEnded": null,
    "message": "Rx 1 level control out of range",
    "messageName": "WARNING_RX1_LEVEL_CONTROL_OUT_OF_RANGE",
    "messageCode": 2147489224,
    },
    {
    "ref": 17439103,
    "severity": "ALARM",
    "timeStarted": 1630309185306,
    "timeEnded": null,
    "message": "Rx 2 optical power low",
    "messageName": "ALARM_RX2_OPTICAL_POWER_LOW",
    "messageCode": 3221231046,
    
    }
    ]
    How do I now create a trigger for each existing alarm? And as soon as the created alarm is no longer in the list, the trigger should be removed. Does anyone have an idea?

    The same problem also exists if the data is queried (and previously filtered) via snmptable.
  • tikkami
    Member
    • May 2018
    • 71

    #2
    I had similar case some months ago... Didn't get any help from here

    Finally I solved problem by myself.
    • I have item which holds alarm data.
    • When data changes, it will fire a trigger which runs external script.
    • Script reads value of item via api
    • Script reads also active problems to prevent double problem generation.
    • If new event is found, "ACT" message is written to trapper item.
    • Trapper item will use trigger correlation to fire a trigger.
    • Script also looks if event is removed from initial data. In that case it will write "DEACT" message to trapper item which closes to problem "


    ​​​​​
    ​​

    Comment

    • mako
      Junior Member
      • Feb 2022
      • 3

      #3
      Hi

      Thanks for your reply. That would have been the only way I would have solved it. With an external script. But my expectation was that I could solve it with Zabbix on-board tools. But either it doesn't work or we are both too stupid to find out with which function we have to do it.

      If I do it with an external script, then I can do the API query, JSON filtering, problem tracking etc. completely externally and "only" create and delete the triggers in Zabbix via API ... but somehow this doesn't feel correct ...

      Comment

      • tikkami
        Member
        • May 2018
        • 71

        #4
        At least I'm too stupid to find possible items/triggers from documentation to solve this issue.

        If JS preprocessing had possibility to take in the last and previous values, then my case could be handled from Zabbix frontend.


        Comment

        Working...