@@ -230,6 +230,16 @@ func (client *Client) checkMissedChanges(ctx context.Context, objType string, ca
230
230
return fmt .Errorf ("querying API delivered a wrong object type %q" , objQueriesResult .Type )
231
231
}
232
232
233
+ // Downtime suppresses all kind of events on that checkable, so skip it if it's in downtime.
234
+ if objQueriesResult .Attrs .DowntimeDepth > 0 {
235
+ continue
236
+ }
237
+
238
+ // If the checkable is not in downtime but in flapping state, all other states/events become irrelevant as well.
239
+ if objQueriesResult .Attrs .IsFlapping {
240
+ continue
241
+ }
242
+
233
243
// Only process HARD states
234
244
if objQueriesResult .Attrs .StateType == StateTypeSoft {
235
245
client .Logger .Debugf ("Skipping SOFT event, %#v" , objQueriesResult .Attrs )
@@ -428,7 +438,20 @@ func (client *Client) listenEventStream() error {
428
438
)
429
439
switch respT := resp .(type ) {
430
440
case * StateChange :
431
- // Only process HARD states
441
+ // Ignore any state changes while in downtime
442
+ if respT .DowntimeDepth > 0 {
443
+ stateType := "HARD"
444
+ if respT .StateType == StateTypeSoft {
445
+ stateType = "SOFT"
446
+ }
447
+
448
+ client .Logger .Debugf ("Skipping %q state change while in downtime, %#v" , stateType , respT )
449
+ continue
450
+ }
451
+
452
+ // Only process HARD states.
453
+ // The checkable might also be in the flapping state, but Icinga 2 doesn't expose "is_flapping" to the
454
+ // event streams for state change. So, the only thing we can do here is to ignore soft state changes.
432
455
if respT .StateType == StateTypeSoft {
433
456
client .Logger .Debugf ("Skipping SOFT State Change, %#v" , respT )
434
457
continue
0 commit comments