Ad Widget

Collapse

Trigger should alert on changing item

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • michaill
    Junior Member
    • May 2014
    • 18

    #1

    Trigger should alert on changing item

    Zabbix 2.4

    A custom Item returns "ok" if all apps are running and a list of non-running apps otherwise.
    E.g. "app1 app2" item value means that app1 and app2 are down.
    The trigger alerts whenever item <> "ok", that is some apps are down.
    However, the trigger should also alert whenever item value changes, as long as it's not "ok", e.g. value goes from "app1" to "app1 app2".

    How can this be implemented? The problem is that the trigger is already in PROBLEM state, so how can it alert again?
    Checking "Multiple PROBLEM events generation" in trigger config doesnt help, since I dont want the trigger to alert every time it fails, but only when the item value changes.
    I tried ({template.item.count(#1,ok,ne)} = 1) and ({template.item.change()}=1), but after correctly alerting it goes back to OK state.

    What I need is conditional Multiple PROBLEM generation, where a PROBLEM trigger can alert again, but only if a condition is satisfied.

    Any help is appreciated.
    Last edited by michaill; 15-12-2016, 07:03.
  • akbar415
    Senior Member
    • May 2015
    • 119

    #2
    Originally posted by michaill
    Zabbix 2.4

    A custom Item returns "ok" if all apps are running and a list of non-running apps otherwise.
    E.g. "app1 app2" item value means that app1 and app2 are down.
    The trigger alerts whenever item <> "ok", that is some apps are down.
    However, the trigger should also alert whenever item value changes, as long as it's not "ok", e.g. value goes from "app1" to "app1 app2".

    How can this be implemented? The problem is that the trigger is already in PROBLEM state, so how can it alert again?
    Checking "Multiple PROBLEM events generation" in trigger config doesnt help, since I dont want the trigger to alert every time it fails, but only when the item value changes.
    I tried ({template.item.count(#1,ok,ne)} = 1) and ({template.item.change()}=1), but after correctly alerting it goes back to OK state.

    What I need is conditional Multiple PROBLEM generation, where a PROBLEM trigger can alert again, but only if a condition is satisfied.

    Any help is appreciated.
    You need two triggers
    One to when change to "ok" to something else (you already do that)
    and other when change from app1 to something else except "ok"

    You can one to be the dependencie of another.

    Ex:
    The custom item change from ok to app1 >> You have the alert A
    While alert A is active the custom item chaneg from app1 to app2 then you have alert B

    Config alert A as dependece of alert B you want


    You can use the function bellow in zabbix trigger to know when custom item change
    {some.itemdiff()}=0
    That means "Difference between last and preceding values, then N=1, 0 Otherwise


    IMHO and depending on the number of apps the best aproach is create one trigger for every app you have so in the zabbix dashboard you see exactly what app(s) is(are) offline.
    You can do that using the regex function to create the trigger

    Ex:
    Name: App1 is offline
    {host1:custom_item.regexp(app1)}=0

    Name: App2 is offilne
    {host1:custom_item.regexp(app2)}=0

    So if zabbix get "app1" from your custom item this will trigger "App1 is offline"
    but if get "app1 app2" will trigger booth "App1 is offline" and "App2 is offline"
    Last edited by akbar415; 16-12-2016, 17:29. Reason: Clarify the answer

    Comment

    • michaill
      Junior Member
      • May 2014
      • 18

      #3
      Thanks for clarification

      The custom item change from ok to app1 >> You have the alert A
      While alert A is active the custom item chaneg from app1 to app2 then you have alert B
      That's much better, though the more I think about it, the more it looks like I might still have to go with

      one trigger for every app
      The problem is different apps run on different servers and I'll need a trigger for each app for each server, which is a pain to configure.
      I was hoping to have just one (or two or a few) triggers to alert for all apps on all servers.
      The custom item is actually an external check that gets apps to be checked from a config file. So I was able to have just one item on all servers instead of having an item for each app on each server.
      I wanted to do something similar for triggers.
      Last edited by michaill; 16-12-2016, 21:30.

      Comment

      Working...