The only agent that thinks for itself

Autonomous Monitoring with self-learning AI built-in, operating independently across your entire stack.

Unlimited Metrics & Logs
Machine learning & MCP
5% CPU, 150MB RAM
3GB disk, >1 year retention
800+ integrations, zero config
Dashboards, alerts out of the box
> Discover Netdata Agents

Centralized metrics streaming and storage

Aggregate metrics from multiple agents into centralized Parent nodes for unified monitoring across your infrastructure.

Stream from unlimited agents
Long-term data retention
High availability clustering
Data replication & backup
Scalable architecture
Enterprise-grade security
> Learn about Parents

Fully managed cloud platform

Access your monitoring data from anywhere with our SaaS platform. No infrastructure to manage, automatic updates, and global availability.

Zero infrastructure management
99.9% uptime SLA
Global data centers
Automatic updates & patches
Enterprise SSO & RBAC
SOC2 & ISO certified
> Explore Netdata Cloud

Deploy Netdata Cloud in your infrastructure

Run the full Netdata Cloud platform on-premises for complete data sovereignty and compliance with your security policies.

Complete data sovereignty
Air-gapped deployment
Custom compliance controls
Private network integration
Dedicated support team
Kubernetes & Docker support
> Learn about Cloud On-Premises

Powerful, intuitive monitoring interface

Modern, responsive UI built for real-time troubleshooting with customizable dashboards and advanced visualization capabilities.

Real-time chart updates
Customizable dashboards
Dark & light themes
Advanced filtering & search
Responsive on all devices
Collaboration features
> Explore Netdata UI

Monitor on the go

Native iOS and Android apps bring full monitoring capabilities to your mobile device with real-time alerts and notifications.

iOS & Android apps
Push notifications
Touch-optimized interface
Offline data access
Biometric authentication
Widget support
> Download apps

The future of infrastructure observability

See our strategic direction across AI-native observability, full-stack signals, operational intelligence, and enterprise platform maturity.

AI-native observability
Full-stack signal coverage
Operational intelligence
Enterprise platform maturity
Agent releases every 6 weeks
Cloud continuous delivery
> Explore Product Roadmap

Best energy efficiency

True real-time per-second

100% automated zero config

Centralized observability

Multi-year retention

High availability built-in

Zero maintenance

Always up-to-date

Enterprise security

Complete data control

Air-gap ready

Compliance certified

Millisecond responsiveness

Infinite zoom & pan

Works on any device

Native performance

Instant alerts

Monitor anywhere

AI-native observability

Continuous delivery

Open source foundation

80% Faster Incident Resolution

AI-powered troubleshooting from detection, to root cause and blast radius identification, to reporting.

True Real-Time and Simple, even at Scale

Linearly and infinitely scalable full-stack observability, that can be deployed even mid-crisis.

90% Cost Reduction, Full Fidelity

Instead of centralizing the data, Netdata distributes the code, eliminating pipelines and complexity.

See and Map Your Entire Network

Live topology, flow analytics, and SNMP device and trap monitoring — unified with your full-stack observability.

Control Without Surrender

SOC 2 Type 2 certified with every metric kept on your infrastructure.

Integrations

800+ collectors and notification channels, auto-discovered and ready out of the box.

800+ data collectors
Auto-discovery & zero config
Cloud, infra, app protocols
Notifications out of the box
> Explore integrations
Real Results
46% Cost Reduction

Reduced monitoring costs by 46% while cutting staff overhead by 67%.

— Leonardo Antunez, Codyas

Zero Pipeline

No data shipping. No central storage costs. Query at the edge.

From Our Users
"Out-of-the-Box"

So many out-of-the-box features! I mostly don't have to develop anything.

— Simon Beginn, LANCOM Systems

No Query Language

Point-and-click troubleshooting. No PromQL, no LogQL, no learning curve.

Enterprise Ready
67% Less Staff, 46% Cost Cut

Enterprise efficiency without enterprise complexity—real ROI from day one.

— Leonardo Antunez, Codyas

SOC 2 Type 2 Certified

Zero data egress. Only metadata reaches the cloud. Your metrics stay on your infrastructure.

Full Coverage
800+ Collectors

Auto-discovered and configured. No manual setup required.

Any Notification Channel

Slack, PagerDuty, Teams, email, webhooks—all built-in.

Built for the People Who Get Paged

Because 3am alerts deserve instant answers, not hour-long hunts.

Every Industry Has Rules. We Master Them.

See how healthcare, finance, and government teams cut monitoring costs 90% while staying audit-ready.

Monitor Any Technology. Configure Nothing.

Install the agent. It already knows your stack.
From Our Users
"A Rare Unicorn"

Netdata gives more than you invest in it. A rare unicorn that obeys the Pareto rule.

— Eduard Porquet Mateu, TMB Barcelona

99% Downtime Reduction

Reduced website downtime by 99% and cloud bill by 30% using Netdata alerts.

— Falkland Islands Government

Real Savings
30% Cloud Cost Reduction

Optimized resource allocation based on Netdata alerts cut cloud spending by 30%.

— Falkland Islands Government

46% Cost Cut

Reduced monitoring staff by 67% while cutting operational costs by 46%.

— Codyas

Real Coverage
"Plugin for Everything"

Netdata has agent capacity or a plugin for everything, including Windows and Kubernetes.

— Eduard Porquet Mateu, TMB Barcelona

"Out-of-the-Box"

So many out-of-the-box features! I mostly don't have to develop anything.

— Simon Beginn, LANCOM Systems

Real Speed
Troubleshooting in 30 Seconds

From 2-3 minutes to 30 seconds—instant visibility into any node issue.

— Matthew Artist, Nodecraft

20% Downtime Reduction

20% less downtime and 40% budget optimization from out-of-the-box monitoring.

— Simon Beginn, LANCOM Systems

Pay per Node. Unlimited Everything Else.

One price per node. Unlimited metrics, logs, users, and retention. No per-GB surprises.

Free tier—forever
No metric limits or caps
Retention you control
Cancel anytime
> See pricing plans

What's Your Monitoring Really Costing You?

Most teams overpay by 40-60%. Let's find out why.

Expose hidden metric charges
Calculate tool consolidation
Customers report 30-67% savings
Results in under 60 seconds
> See what you're really paying

Your Infrastructure Is Unique. Let's Talk.

Because monitoring 10 nodes is different from monitoring 10,000.

On-prem & air-gapped deployment
Volume pricing & agreements
Architecture review for your scale
Compliance & security support
> Start a conversation

Monitoring That Sells Itself

Deploy in minutes. Impress clients in hours. Earn recurring revenue for years.

30-second live demos close deals
Zero config = zero support burden
Competitive margins & deal protection
Response in 48 hours
> Apply to partner

Per-Second Metrics at Homelab Prices

Same engine, same dashboards, same ML. Just priced for tinkerers.

Community: Free forever · 5 nodes · non-commercial
Homelab: $90/yr · unlimited nodes · fair usage
> Get the Homelab Plan

$1,000 Per Referral. Unlimited Referrals.

Your colleagues get 10% off. You get 10% commission. Everyone wins.

10% of subscriptions, up to $1,000 each
Track earnings inside Netdata Cloud
PayPal/Venmo payouts in 3-4 weeks
No caps, no complexity
> Get your referral link
Cost Proof
40% Budget Optimization

"Netdata's significant positive impact" — LANCOM Systems

Calculate Your Savings

Compare vs Datadog, Grafana, Dynatrace

Savings Proof
46% Cost Reduction

"Cut costs by 46%, staff by 67%" — Codyas

30% Cloud Bill Savings

"Reduced cloud bill by 30%" — Falkland Islands Gov

Enterprise Proof
"Better Than Combined Alternatives"

"Better observability with Netdata than combining other tools." — TMB Barcelona

Real Engineers, <24h Response

DPA, SLAs, on-prem, volume pricing

Why Partners Win
Demo Live Infrastructure

One command, 30 seconds, real data—no sandbox needed

Zero Tickets, High Margins

Auto-config + per-node pricing = predictable profit

Homelab Ready
Free Video Course

8-episode Netdata tutorial by LearnLinux.tv

76k+ GitHub Stars

3rd most starred monitoring project

Worth Recommending
Product That Delivers

Customers report 40-67% cost cuts, 99% downtime reduction

Zero Risk to Your Rep

Free tier lets them try before they buy

AI Support Assistant, Available 24/7

Nedi has access to all official documentation, source code, and resources. Ask any question about Netdata—responds in your language.

Deployment & configuration
Troubleshooting & sizing
Alerts & notifications
Evidence-based answers
> Ask Nedi now

Never Fight Fires Alone

Docs, community, and expert help—pick your path to resolution.

Learn.netdata.cloud docs
Discord, Forums, GitHub
Premium support available
> Get answers now

60 Seconds to First Dashboard

One command to install. Zero config. 850+ integrations documented.

Linux, Windows, K8s, Docker
Auto-discovers your stack
> Read our documentation

76,000+ Engineers Strong

615+ contributors. 1.5M daily downloads. One mission: simplify observability.

Per-Second. 90% Cheaper. Data Stays Home.

Side-by-side comparisons: costs, real-time granularity, and data sovereignty for every major tool.

See why teams switch from Datadog, Prometheus, Grafana, and more.

> Browse all comparisons
Edge-Native Observability, Born Open Source
Per-second visibility, ML on every metric, and data that never leaves your infrastructure.
Founded in 2016
615+ contributors worldwide
Remote-first, engineering-driven
Open source first
> Read our story
Promises We Publish—and Prove
12 principles backed by open code, independent validation, and measurable outcomes.
Open source, peer-reviewed
Zero config, instant value
Data sovereignty by design
Aligned pricing, no surprises
> See all 12 principles
Edge-Native, AI-Ready, 100% Open
76k+ stars. Full ML, AI, and automation—GPLv3+, not premium add-ons.
76,000+ GitHub stars
GPLv3+ licensed forever
ML on every metric, included
Zero vendor lock-in
> Explore our open source
Build Real-Time Observability for the World
Remote-first team shipping per-second monitoring with ML on every metric.
Remote-first, fully distributed
Open source (76k+ stars)
Challenging technical problems
Your code on millions of systems
> See open roles
Meet the Team Behind Netdata
Conferences, meetups, and tradeshows where you can see Netdata in action and talk to the engineers who build it.
Live demos and deep dives
Book 1-on-1 meetings
Talks and panel sessions
Event recaps and photos
> See all events
Talk to a Netdata Human in <24 Hours
Sales, partnerships, press, or professional services—real engineers, fast answers.
Discuss your observability needs
Pricing and volume discounts
Partnership opportunities
Media and press inquiries
> Book a conversation
Your Data. Your Rules.
On-prem data, cloud control plane, transparent terms.
Trust & Scale
76,000+ GitHub Stars

One of the most popular open-source monitoring projects

SOC 2 Type 2 Certified

Enterprise-grade security and compliance

Data Sovereignty

Your metrics stay on your infrastructure

Validated
University of Amsterdam

"Most energy-efficient monitoring solution" — ICSOC 2023, peer-reviewed

ADASTEC (Autonomous Driving)

"Doesn't miss alerts—mission-critical trust for safety software"

Community Stats
615+ Contributors

Global community improving monitoring for everyone

1.5M+ Downloads/Day

Trusted by teams worldwide

GPLv3+ Licensed

Free forever, fully open source agent

Why Join?
Remote-First

Work from anywhere, async-friendly culture

Impact at Scale

Your work helps millions of systems

$ guides / proxysql / proxysql-backend-shunned ▌

Operations Guides

ProxySQL backend SHUNNED: why a healthy backend gets pulled out of rotation

You see status=SHUNNED on a backend in stats_mysql_connection_pool or runtime_mysql_servers. The backend itself looks healthy when you connect directly. Queries may be failing or routing to fewer backends than expected, but the MySQL server is up and accepting connections.

SHUNNED is ProxySQL’s protection mechanism, not a bug. When a backend generates mysql-shun_on_failures connection errors within one second, or when its replication lag exceeds the configured max_replication_lag, ProxySQL temporarily removes it from rotation. The backend typically returns to ONLINE on its own within mysql-shun_recovery_time_sec (default 10 seconds), provided there is activity in the connection pool for that hostgroup.

The operational question is not “why is it SHUNNED?” but “is this transient protection, or is something repeatedly triggering it?” A single SHUNNED backend is a TICKET. Zero ONLINE backends in a hostgroup is a PAGE.

What this means

ProxySQL’s monitor module continuously health-checks backends via connect, ping, read-only, and replication lag probes. The results drive status transitions in the hostgroup manager. When the monitor detects that a backend has accumulated too many failures or is too far behind on replication, it flips that backend’s status to SHUNNED.

The two triggers are distinct:

  1. Connection error threshold: If mysql-shun_on_failures (default 5) errors occur within one second, the backend is shunned. These errors come from ConnERR in stats_mysql_connection_pool: failed connect() calls, authentication failures, backend max_connections exhaustion, or network unreachability.

  2. Replication lag threshold: If max_replication_lag is set to a non-zero value in mysql_servers for a backend (default is 0, meaning disabled), and the monitor detects Seconds_Behind_Master exceeding that value, the backend is shunned until replication catches up.

Recovery is not purely timer-based. The backend is brought back ONLINE only after mysql-shun_recovery_time_sec has elapsed AND there is activity in the connection pool for the specific hostgroup. A hostgroup with no client traffic will not recover shunned nodes automatically.

flowchart TD
    A["Backend ONLINE"] -->|"ConnERR >= shun_on_failures\nwithin 1 second"| B["Backend SHUNNED"]
    A -->|"replication lag >\nmax_replication_lag"| B
    B -->|"recovery_time elapsed\nAND pool activity exists"| A
    B -->|"no pool activity\nfor hostgroup"| C["Stays SHUNNED"]
    C -->|"client traffic resumes"| A

SHUNNED prevents new connections but does NOT kill existing ones. Queries already in flight on a shunned backend continue to execute. Only the SHUNNED_REPLICATION_LAG state for Group Replication, which ProxySQL uses from v2.3.0 onward in its two-stage flow, terminates existing connections. If you see ConnUsed > 0 on a SHUNNED backend, those are queries that were routed before the status change.

Common causes

CauseWhat it looks likeFirst thing to check
Connection errors exceeding thresholdConnERR rising rapidly, then status flips to SHUNNEDmonitor.mysql_server_connect_log and monitor.mysql_server_ping_log
Replication lag exceeding max_replication_lagOnly replicas shunned, writer stays ONLINESHOW SLAVE STATUS on the affected backend
Monitor-induced flappingRapid ONLINE to SHUNNED cycling, backend healthy when checked directlyMonitor ping log for alternating success/failure pattern
MySQL wait_timeout closing pooled connectionsPeriodic ConnERR spikes matching the wait_timeout intervalBackend wait_timeout vs ProxySQL mysql-connection_max_age_ms
Stale backend entries after orchestration churnConnERR on backends that no longer existruntime_mysql_servers for entries pointing to removed hosts
Galera extra writers beyond max_writersThe writer hostgroup shows extra SHUNNED writers while a configured writer remains ONLINECompare runtime_mysql_servers statuses with runtime_mysql_galera_hostgroups.writer_hostgroup and max_writers

Quick checks

Run these against the admin interface (default port 6032). All are read-only.

# Check current backend statuses in the connection pool
mysql -u admin -padmin -h 127.0.0.1 -P 6032 \
  -e "SELECT hostgroup, srv_host, srv_port, status, ConnUsed, ConnFree, ConnOK, ConnERR FROM stats_mysql_connection_pool;"

# Check runtime server configuration including max_replication_lag
mysql -u admin -padmin -h 127.0.0.1 -P 6032 \
  -e "SELECT hostgroup_id, hostname, port, status, max_connections, max_replication_lag FROM runtime_mysql_servers;"

# Check monitor ping and connect results for recent failures
mysql -u admin -padmin -h 127.0.0.1 -P 6032 \
  -e "SELECT * FROM monitor.mysql_server_ping_log ORDER BY time_start_us DESC LIMIT 50;"
mysql -u admin -padmin -h 127.0.0.1 -P 6032 \
  -e "SELECT * FROM monitor.mysql_server_connect_log ORDER BY time_start_us DESC LIMIT 50;"

# Check replication lag readings from the monitor
mysql -u admin -padmin -h 127.0.0.1 -P 6032 \
  -e "SELECT * FROM monitor.mysql_server_replication_lag_log ORDER BY time_start_us DESC LIMIT 20;"

# Check monitor check counters (OK vs ERR rates)
mysql -u admin -padmin -h 127.0.0.1 -P 6032 \
  -e "SELECT Variable_Name, Variable_Value FROM stats_mysql_global WHERE Variable_Name LIKE 'MySQL_Monitor_%check%';"

# Check current shun-related variables
mysql -u admin -padmin -h 127.0.0.1 -P 6032 \
  -e "SELECT variable_name, variable_value FROM global_variables WHERE variable_name IN ('mysql-shun_on_failures','mysql-shun_recovery_time_sec');"

# Check queries affected by mid-flight status changes
mysql -u admin -padmin -h 127.0.0.1 -P 6032 \
  -e "SELECT Variable_Name, Variable_Value FROM stats_mysql_global WHERE Variable_Name IN ('backend_lagging_during_query','backend_offline_during_query');"

How to diagnose it

  1. Identify which backends are SHUNNED and in which hostgroups. A backend can be SHUNNED in one hostgroup but ONLINE in another if the max_replication_lag threshold differs per entry in mysql_servers. Query stats_mysql_connection_pool for the full picture, not just runtime_mysql_servers.

  2. Check whether ConnERR is the trigger. Look at ConnERR in stats_mysql_connection_pool for the affected backend. If it is rising, the shunning is error-driven. Cross-reference with monitor.mysql_server_connect_log and monitor.mysql_server_ping_log to find the specific error type: connection refused, timeout, auth failure.

  3. Check whether replication lag is the trigger. If only reader hostgroup members are SHUNNED and the writer is fine, look at monitor.mysql_server_replication_lag_log. Verify that max_replication_lag is set to a non-zero value for those backends in runtime_mysql_servers. If max_replication_lag = 0, lag checking is disabled and this is not the cause.

  4. Determine if the backend is actually unhealthy. Connect directly to the backend MySQL, bypassing ProxySQL. Run SHOW SLAVE STATUS, check SHOW PROCESSLIST, and verify the backend is accepting connections. If the backend is healthy when accessed directly but SHUNNED in ProxySQL, the issue is in the monitor path: network between proxy and backend, monitor credentials, or aggressive thresholds.

  5. Check for flapping. If the backend cycles between ONLINE and SHUNNED rapidly (more than 3 transitions in 10 minutes), look at the monitor log timestamps. Flapping indicates the monitor intervals or shun_on_failures threshold are too aggressive for the network conditions, or the backend is intermittently unresponsive to health checks while serving queries normally.

  6. Verify pool activity exists for recovery. If a backend is stuck SHUNNED longer than mysql-shun_recovery_time_sec, check whether there is actual client traffic to that hostgroup. ConnUsed == 0 and ConnFree == 0 in stats_mysql_connection_pool for that hostgroup means no traffic is reaching it, so recovery will not trigger.

  7. Check self-tuning for single-backend hostgroups. mysql-shun_recovery_time_sec self-tunes to 1 second when only one backend exists in a hostgroup and the configured value is greater than 1. If this does not work in your version, a single-writer hostgroup can experience repeated 10-second outages.

Metrics and signals to monitor

SignalWhy it mattersWarning sign
status in stats_mysql_connection_poolThe actual SHUNNED state per backendAny backend not ONLINE; zero ONLINE in a hostgroup
ConnERR per backendCumulative failed connection attempts; drives error-based shunningRising rate preceding a SHUNNED transition
MySQL_Monitor_ping_check_ERRMonitor detecting backend as unresponsiveSustained increase or spikes correlating with SHUNNED events
MySQL_Monitor_connect_check_ERRMonitor cannot establish connections to backendAny sustained failures
MySQL_Monitor_replication_lag_check_ERRReplication lag check failing or timing outCorrelates with lag-based shunning
backend_lagging_during_queryQueries that hit a backend detected as lagging after routingNon-zero values indicate stale reads may have occurred
backend_offline_during_queryQueries that failed because backend went offline mid-executionNon-zero values mean queries were killed by status changes
ConnPool_get_conn_failureA pool request found no immediately available connectionIndicates pool pressure beyond a single SHUNNED backend
Questions rateOverall query throughputSudden drop may indicate capacity loss from shunning

Fixes

When connection errors are the trigger

If ConnERR is rising, the backend is rejecting connections from ProxySQL. Common causes:

  • Backend max_connections exhausted: ProxySQL competes with direct connections, replication threads, and other proxy instances for backend MySQL connections. Check SHOW GLOBAL STATUS LIKE 'Threads_connected' on the backend against its max_connections. Adjust ProxySQL’s per-backend max_connections in mysql_servers to leave headroom.
  • Monitor credentials expired: If mysql-monitor_username or mysql-monitor_password are invalid on the backend, monitor checks fail and ProxySQL shuns the backend. Update credentials, then run LOAD MYSQL VARIABLES TO RUNTIME; SAVE MYSQL VARIABLES TO DISK;.
  • Network partition: Check connectivity from the ProxySQL host to the backend with mtr or a direct mysql client connection. Cloud networking can introduce intermittent packet loss or latency spikes that cross the shun_on_failures threshold.
  • MySQL wait_timeout closing pooled connections: If the backend closes idle connections after wait_timeout and ProxySQL tries to reuse them, the failed reuse counts as a ConnERR. Set mysql-connection_max_age_ms in ProxySQL to a value shorter than the backend’s wait_timeout (converted to milliseconds). The default of 0 means no age-based recycling.

When replication lag is the trigger

If replicas are being shunned due to lag:

  • Verify max_replication_lag is set appropriately in mysql_servers. The default of 0 disables lag checking. A value too low for your workload causes constant shunning during normal replication delay spikes.
  • Check SHOW SLAVE STATUS on the affected replica. If Seconds_Behind_Master is genuinely high, the replica cannot keep up with the write workload. This is a backend capacity issue, not a ProxySQL issue.
  • Note that Seconds_Behind_Master is unreliable during large transactions (shows 0, then jumps). If you see replicas shunned immediately after a large batch write, the lag may have been masked during the transaction.
  • For Group Replication, ProxySQL compares the backend’s max_transactions_behind table value with mysql-monitor_groupreplication_max_transactions_behind_count, constrained by mysql-monitor_groupreplication_max_transactions_behind_for_read_only. Since v2.3.0, a server first becomes SHUNNED at the configured count and becomes SHUNNED_REPLICATION_LAG—terminating its connections—at twice that count.

When the backend flaps between ONLINE and SHUNNED

Flapping means the monitor is too sensitive relative to actual backend stability:

  • Increase mysql-monitor_ping_interval (default 8000ms) to reduce check frequency. Aggressive intervals (e.g., 500ms) on a network with jitter will produce enough transient failures to cross shun_on_failures.
  • Increase mysql-shun_on_failures from the default of 5. This variable cannot be disabled by setting it to a special value. To effectively disable shunning, set it to a very large number (e.g., 10000000), but this removes the protection entirely.
  • Check whether the backend is under resource pressure during health checks. A backup, large analytical query, or ANALYZE TABLE can make the backend briefly unresponsive to mysql_ping() while still serving other queries.

When a single-backend hostgroup gets stuck

A hostgroup with only one backend is the most dangerous shunning scenario because there is nowhere to redirect traffic:

  • mysql-shun_recovery_time_sec should self-tune to 1 second for single-backend hostgroups. If this does not work in your version, a single writer can be shunned for the full 10 seconds repeatedly, causing cascading “Too many connections” errors.
  • Recovery requires pool activity. If the hostgroup has no traffic (e.g., a standby writer hostgroup), the shunned backend will not recover automatically. Consider routing a lightweight health-check query through the hostgroup periodically.
  • For Galera setups using mysql_galera_hostgroups with max_writers: extra writer-hostgroup entries are intentionally shown as SHUNNED while preserving their existing connections. shunned_automatic is an internal state, not a runtime_mysql_servers column. If the active writer fails, verify placement and promote a healthy backup manually; a 2021 issue report #3618 describes skipped automatic promotion on v2.2.x and remains open.

When you need to force a backend back online

runtime_mysql_servers reflects RUNTIME configuration; update mysql_servers and reload instead of editing it directly.

Toggle the backend status through mysql_servers to force a runtime reload that resets the monitor state:

UPDATE mysql_servers SET status='OFFLINE_SOFT'
  WHERE hostgroup_id=<hg> AND hostname='<host>' AND port=<port>;
LOAD MYSQL SERVERS TO RUNTIME;
UPDATE mysql_servers SET status='ONLINE'
  WHERE hostgroup_id=<hg> AND hostname='<host>' AND port=<port>;
LOAD MYSQL SERVERS TO RUNTIME;

WARNING: This is a temporary fix. If the underlying condition persists, the monitor will re-shun the backend on the next check cycle. Always identify and address the root cause.

Prevention

  • Tune mysql-shun_on_failures based on your network characteristics. The default of 5 failures per second is reasonable for low-latency LANs but too sensitive for cross-AZ or cross-region setups with occasional jitter.
  • Set max_replication_lag deliberately. Leaving it at 0 disables lag-based shunning entirely. Setting it too low causes unnecessary shunning. Base the value on your application’s staleness tolerance.
  • Track monitor check error rates. Monitor MySQL_Monitor_connect_check_ERR and MySQL_Monitor_ping_check_ERR. Rising error rates precede SHUNNED transitions and give you early warning.
  • Verify recovery works under low traffic. In staging environments with sparse traffic, confirm that shunned backends actually recover. If pool activity is too low, recovery never triggers.
  • Keep monitor credentials in sync. Credential rotation that updates mysql_users but not mysql-monitor_password will cause monitor check failures and spurious shunning.
  • Review replication lag check timeout. Use mysql-monitor_replication_lag_timeout (default 1000ms) and mysql-monitor_replication_lag_count (default 1). A too-short timeout can prevent ProxySQL from measuring lag reliably.

How Netdata helps

Netdata’s ProxySQL collector provides per-second visibility into the signals that drive SHUNNED transitions:

  • Backend status from stats_mysql_connection_pool: See exactly when a backend transitions to SHUNNED and how long it stays there, without polling gaps that miss transient events.
  • ConnERR rates per backend: Correlate connection error spikes with SHUNNED transitions to confirm the trigger.
  • Monitor check counters: Track MySQL_Monitor_*_check_OK and _ERR rates to detect rising failure rates before they trigger shunning.
  • backend_lagging_during_query and backend_offline_during_query: Quantify queries affected by status changes mid-flight, measuring user impact beyond the status flag.
  • ML anomaly detection: Baselines normal behavior per metric to distinguish transient SHUNNED events from sustained degradation.

Per-second granularity matters because shun and recovery events can complete within a 10-second window, making slower polling intervals miss the full cycle.