MCPcopy Create free account
hub / github.com/Icinga/icinga2 / NotificationReasonApplies

Method NotificationReasonApplies

lib/icinga/checkable-notification.cpp:263–284  ·  view source on GitHub ↗

* Returns whether sending a notification of type type right now would represent *this' current state correctly. * * @param type The type of notification to send (or not to send). * * @return Whether to send the notification. */

Source from the content-addressed store, hash-verified

261 * @return Whether to send the notification.
262 */
263bool Checkable::NotificationReasonApplies(NotificationType type)
264{
265 switch (type) {
266 case NotificationProblem:
267 {
268 auto cr (GetLastCheckResult());
269 return cr && !IsStateOK(cr->GetState());
270 }
271 case NotificationRecovery:
272 {
273 auto cr (GetLastCheckResult());
274 return cr && IsStateOK(cr->GetState());
275 }
276 case NotificationFlappingStart:
277 return IsFlapping();
278 case NotificationFlappingEnd:
279 return !IsFlapping();
280 default:
281 VERIFY(!"Checkable#NotificationReasonStillApplies(): given type not implemented");
282 return false;
283 }
284}
285
286/**
287 * Checks if notifications of a given type should be suppressed for this Checkable at the moment.

Callers 1

Calls 1

GetStateMethod · 0.45

Tested by

no test coverage detected