Ad Widget

Collapse

Api triggers and events...

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Shihan
    Junior Member
    • Apr 2013
    • 4

    #1

    Api triggers and events...

    Hi All,

    running on zabbix 2.0.5 from the epel archive on centos.

    Im trying to create a simple "large screen" boss display based on the current status of things in zabbix. i'm custom coding it cause screens cant quite do what I want, but im stuck with one problem. The most important part is actually the colour the screens going to look (i.e. green/yellow/red). Basically it has to look green when there are no unacknowledged (and current) problems.

    Its the last part thats really causing me greif. I can get the status of a bunch of triggers with trigger.get, what i cant seem to do is then tie that trigger to an event that was created when the trigger went to a value of 1. I can also get the status of events no problem, but an event is only a problem when the trigger that caused it is still showing an error, but the event is unacknowledged.

    Theres a selectLastEvent in trigger.get (according to the 2.0 api), which sounds perfect but that doesnt appear to return anything for me and i cant really seem to find another way around the problem... ultimately if i use event.get i'll get a lot of unacknowledged events that are no longer be a problem, and using trigger.get may return values of 1 that attach to events that have already been acknowledged. In both cases, the screen needs to be green.

    Any suggestions?
  • Pavels
    Member
    • Oct 2011
    • 83

    #2
    The "selectLastEvent" event parameter is only available from 2.0.6, the docs don't mention that yet.

    You could either maker a trigger.get request with the "withUnacknowledgedEvents" together with a the "value" filter set to 1 to retrieve all triggers in problem state with unacknowledged events, and then just display the rest of the triggers in green.

    Or you can make a separate event.get request with "acknowledged" set to false to retrieve only unacknowledged events.

    Comment

    • Shihan
      Junior Member
      • Apr 2013
      • 4

      #3
      Originally posted by Pavels
      The "selectLastEvent" event parameter is only available from 2.0.6, the docs don't mention that yet.

      You could either maker a trigger.get request with the "withUnacknowledgedEvents" together with a the "value" filter set to 1 to retrieve all triggers in problem state with unacknowledged events, and then just display the rest of the triggers in green.

      Or you can make a separate event.get request with "acknowledged" set to false to retrieve only unacknowledged events.
      I've tried that and unfortunately it doesnt really work cause in the case where an event is created, but the trigger goes back to normal fairly quickly the event goes un-ack'd (or at least will stay un-ack'd for a time)... the problem is if the trigger fires again, and the latest even is ack'd then the prior un-ack'd event makes it a "red" situation where it should be "green"..

      Thought i think i have a solution to my problem that i cant quite get to work so far. If i see a trigger that has a 1 value, i can then look for all events for that trigger (event.get & triggerids) with a time greater then the lastchange value of the trigger itself. i *think* it should work, but at the moment im doing something wrong i think.

      Comment

      • Pavels
        Member
        • Oct 2011
        • 83

        #4
        You can also try trigger.get with "withLastEventUnacknowledged" to retrieve triggers in problem state with the last event unack.

        Thought i think i have a solution to my problem that i cant quite get to work so far. If i see a trigger that has a 1 value, i can then look for all events for that trigger (event.get & triggerids) with a time greater then the lastchange value of the trigger itself. i *think* it should work, but at the moment im doing something wrong i think.
        Keep in mind, that in 2.0 after a trigger goes into problem state, Zabbix can still generate multiple UNKNOWN and PROBLEM events. If you need to retrieve the first problem event, look for the event with clock equal to trigger lastchange.

        Comment

        Working...