Flapping Alerts: How to Detect and Stabilize Noisy Checks

Flapping Alerts: How to Detect and Stabilize Noisy Checks

A check that goes red at 02:14, green at 02:16, red again at 02:19 and green at 02:21 is the fastest way to teach an on-call engineer to ignore their pager. Flapping alerts are checks that keep switching between OK and failed without any real, lasting change. They are one of the most common reasons teams stop trusting their monitoring alerts. This article covers how to detect flapping, how to find its cause, and how to stabilize noisy checks without hiding real incidents.

The benefit is simple. A team that fixes its flapping checks pages less, responds faster when a page does come, and gets uptime numbers that match reality.

What Flapping Looks Like in Practice

A typical scenario looks like this. An HTTP check against an internal API runs every 60 seconds with a 5-second timeout. The API usually answers in 1.2-1.8 seconds. Every night between 01:00 and 03:00, a backup job saturates the storage, and response times rise to 4.5-6 seconds. The check passes, fails, passes and fails again for two hours, producing 30-40 notifications. Nobody acts on any of them.

By the third week, the on-call engineer has muted the channel. Then one night the API actually goes down at 02:30. The page arrives, and it gets ignored along with all the others.

That’s the real cost. The noise itself is only annoying. The damage comes from the habit it builds. Flapping turns incident detection into a guessing game.

How to Detect Flapping Alerts Systematically

Flap detection is an old idea. Nagios Core calculates a state change percentage across the last 21 check results and weights recent changes more heavily than older ones. When that percentage rises above the high threshold (the default for services in nagios.cfg is 20%), the check is marked as flapping and notifications are held back. When it falls below the low threshold (5% by default), the check counts as stable again. Icinga 2 inherited the same model, with configurable flapping_threshold_high and flapping_threshold_low attributes.

Tools without built-in flap detection still make it easy to measure. An experienced SRE first pulls 30 days of alert history and counts state transitions per check. Any check with more than 10 transitions a week and an average incident length under 5 minutes is a strong candidate. In most environments, 5-10% of checks produce well over half of all notifications. Fix those and the pager gets quiet.

A second signal is the gap between alerts and tickets. If a check has fired 200 times in a quarter and nobody has ever opened a ticket for it, it’s either flapping or monitoring something nobody cares about. Both are worth fixing.

Root Causes Worth Investigating First

Damping is a band-aid. Before touching thresholds, a seasoned engineer asks why the signal is oscillating at all. The usual causes fall into a few groups:

Thresholds set right on top of normal behavior – a CPU alert at 80% on a host that routinely runs at 75-85% during business hours.
Timeouts that are too tight – a 2-second timeout on a check whose p99 latency is 1.9 seconds.
Network path problems between the probe and the target – packet loss on a WAN link, an overloaded VPN concentrator, or a single external probe location having a bad day.
Resource contention on a schedule – backups, log rotation, antivirus scans, or cron-driven batch jobs.
Real intermittent failures – a dying NIC, a failing disk, a connection pool that runs dry under load.

The last cause is the one that matters most. Some flapping is real. A switch port that goes up and down 40 times an hour is not a monitoring problem – it’s a cable or transceiver problem, and suppressing the alert would hide a hardware fault.

Step-by-Step: Stabilizing a Noisy Check

Step 1 – Establish the baseline. Pull 2-4 weeks of history for the metric behind the check. Knowing what normal looks like by hour and weekday tells you whether the threshold is wrong or the system is. Performance baselines make this step much faster.

Step 2 – Require consecutive failures. Instead of alerting on one failed result, require 3 failures in a row on a 60-second interval. Uptime monitoring tools often call this a retry or confirmation count. Prometheus handles it with the for: clause on alerting rules, so for: 5m means the condition must hold for five minutes before the alert fires.

Step 3 – Add hysteresis. Use separate thresholds for alerting and recovery. Alert at 90% disk usage, but resolve only below 85%. In Zabbix this is a recovery expression. In Prometheus 2.42 and later, keep_firing_for keeps an alert active for a set time after the condition clears, so a value hovering around the line doesn’t open and close the same alert over and over.

Step 4 – Verify from more than one place. For external checks, require at least 2 of 3 probe locations to agree before declaring the service down. This one change removes most flapping caused by transient routing issues.

Step 5 – Use time windows for known contention. If the backup window really does slow the service, either schedule maintenance for that window or set a looser latency threshold for those hours. Don’t let a predictable event page anyone.

Step 6 – Re-measure after two weeks. Compare transition counts before and after. If the check still flaps, the cause is probably real and needs an engineering fix, not more tuning.

Common Mistakes When Fixing Noisy Checks

The most common mistake is raising the threshold until the noise stops. Pushing a memory alert from 85% to 98% does stop the flapping, but by the time it fires the OOM killer has already taken out the database. The right fix is usually a longer evaluation window, not a higher number.

The second mistake is using duration damping on checks where speed matters. A 15-minute for: clause on a payment gateway’s health check means 15 minutes of failed transactions before anyone hears about it. Different services need different damping. Critical, user-facing checks need short windows plus multi-location confirmation. Internal batch systems can tolerate much longer windows.

The third mistake is fixing flapping only after a missed incident. Teams that review their noisiest checks once a month, even for 30 minutes, rarely end up with a muted alert channel. Smarter thresholds and notification rules work best as an ongoing habit, not a one-off cleanup.

Myth: Flap Suppression Makes Monitoring Less Reliable

Some engineers resist flap detection because they believe every state change should produce a notification. The reasoning is that hiding anything means missing something.

In practice it works the other way. An alert stream that fires 300 times a week gets less attention than one that fires 15 times. Done well, flap handling doesn’t throw state changes away. It records them and sends a single notification saying “this check is unstable” instead of 40 notifications saying “down, up, down”. That’s more information, not less.

One exception applies: regulated environments where every outage must be logged for audit or SLA purposes. There, keep the raw state changes in history and suppress only the notifications. The same goes for cascading failures, where suppressing duplicate alerts should hide downstream symptoms, never the evidence.

FAQ

How many consecutive failures should a check require before alerting?
For most checks running every 60 seconds, 2-3 consecutive failures is a good starting point. Critical customer-facing services can use 2 failures plus confirmation from a second location. Internal checks can often tolerate 5 or more.

Should flapping checks be disabled until they’re fixed?
Not completely. Disable notifications if needed, but keep the check running and collecting data. The flapping history is often the best evidence for finding the root cause.

Is flapping always a monitoring configuration problem?
No. Interface flaps, intermittent disk errors, and connection pool exhaustion all produce real oscillating failures. Check the underlying hardware and logs before tuning the alert.

Final Practical Tip

Start with data, not opinions. Export last month’s alert history, sort checks by number of state transitions, and take the top five. For each one, decide whether the cause is the threshold, the timeout, the probe location, a scheduled job, or a real fault. Then apply the smallest fix that solves it.

Most teams find that fixing 5-10 checks cuts notification volume in half within a month. Once the pager goes off only for real problems, engineers start responding to it again.