In this recipe, we'll learn how to use Nagios Core's state flapping detection and handling to avoid sending excessive notifications when a host or service changes its state too frequently. This is useful in circumstances where a host or service is changing between OK
to WARNING
to CRITICAL
states too frequently within the last 21 checks. If the percentage of state changes is too high, Nagios Core will suppress further notifications and add an icon and comment to the host or service showing that it is flapping.
Flap detection is normally enabled in the QuickStart configuration for Nagios Core, and is part of the sample generic-host
host template and the generic-service
service template. It's therefore likely that it's already enabled on most servers, and we only need to check that it's still working.