Filter based on 'since' for CRITICAL/UNKNOWN etc

Hello,
Is it possible to filter based on the ‘since’ attribute for hosts and services? - e.g. I’d like to list all services that have been CRITICAL for at least a week.
image

Is this possible with icingaweb2? If not, is there an alternative method you’d suggest?
Thanks!
Will.

This should work for the time:
Service Last State Change < 2022-01-21 00:00:00

There is Service Last Hard State Change as well.

1 Like

That rather begs the question of how to tell Icinga to use “today minus 7
days” in the comparison, since a fixed date won’t be useful for very long.

Any idea how to accomplish that?

Antony.

@Pooh I didn’t assume programmatic access. If you’re generating a link to icingaweb2 (e.g. /monitoring/list/services?service_last_state_change>2022-01-28%2011%3A30%3A00&modifyFilter=1) it should be easy enough to generate the proper date string dynamically relative to when it is requested and put it in the request’s query string.

import datetime
(datetime.datetime.now() - datetime.timedelta(days=7)).isoformat()

Hm, I suppose I was thinking too much about setting this up as an Icinga
Notification.

I agree, if you’re requesting a URL externally, creating a datestamp to put in
the query is trivial.

Antony.

Have you tried -7 days? Or last week? :sweat_smile:

1 Like

2w or 7d seems to work for me!

Thank you for everyone’s help! :smiley: