Filter on previous event.check.status?

Hi Guys-

Is there a way to compare the previous check status in a filter?

I’d like to filter one handler if the event.check.status changes from 1 to 0 and another if it changes from 2 to 0. I don’t see any way to distinguish between the two cases though.


Hi @billm

The event history is accessible to filters using the event.check.history attribute, as documented here, which will return an array of hashes, each representing a previous status as documented here.


so like this?

event.check.history[1].status == x

Hey, not sure if you figured this out, but the Array index will start at [0], and I believe that first element will be the oldest check execution. Given its Javascript expression compatible, you’d want to grab the second last element in the array using the “length” method on check.history because the last element is also the most recent.

Maybe try the following as your filter expression:

event.check.history[event.check.history.length - 2].status == x
1 Like

Thanks for this. I was unsure which “direction” the array went in terms of oldest/newest.