fix(monitoring): exclude Donor state from MySQLGaleraOutOfSync alert (#3629)

Signed-off-by: Mohammed Naser <mnaser@vexxhost.com>
This commit is contained in:
Mohammed Naser authored and GitHub committed 2026-02-17 10:54:59 -05:00
1 parent e86a6dd37f
commit 6a3395c5ef
6 files changed
+185 -33

No files matched your search

@@ -51,6 +51,9 @@ When adding words to the vocabulary:
- Capitalize proper nouns (e.g., `Neutron` not `neutron`).
- Entries must be sorted in lexicographic (byte) order. The
`file-contents-sorter` pre-commit hook enforces this automatically.
In byte order, all uppercase letters sort before all lowercase
letters (e.g., `Z` before `a`), and within the same case, entries
sort alphabetically (e.g., `Galera` before `Glance`).
## Release notes
@@ -17,6 +17,7 @@ Cinder
DNS
FQDN
FQDNs
Galera
Glance
Goldpinger
Grafana
+60
View File
@@ -689,6 +689,66 @@ experiencing network issues.
kubectl debug node/<affected-node> -it --image=busybox -- \
cat /host/var/log/syslog | tail -100
``MySQLGaleraOutOfSync``
========================
This alert fires when a Percona XtraDB Cluster (PXC) Galera node has a
``wsrep_local_state`` that's not 4 (Synced) and not 2 (Donor), while
``wsrep_desync`` isn't enabled. The alert excludes state 2 (Donor) because
it's a normal transient state during donor operations for State Snapshot
Transfer (SST) or PXC operator backups. The separate
``MySQLGaleraDonorFallingBehind`` alert covers problematic donor
scenarios.
This is a cause-based alert because no reasonable symptom-based proxy exists
for a Galera node losing cluster sync. The cluster may continue to serve
requests with the remaining nodes, but the reduced quorum margin increases
the risk of a full outage if another node fails.
**Likely Root Causes**
- A node remains in the Joining state (1) and can't complete SST.
- A node completed SST but hasn't finished catching up (state 3,
Joined) for an extended period.
- Network partitioning prevents the node from rejoining the cluster.
- Corrupted Galera cache or write-set replication failure.
**Diagnostic and Remediation Steps**
1. Check the current ``wsrep_local_state`` on the affected node:
.. code-block:: console
kubectl -n openstack exec -it percona-xtradb-pxc-0 -- \
mysql -e "SHOW STATUS LIKE 'wsrep_local_state%';"
2. Check overall cluster status:
.. code-block:: console
kubectl -n openstack exec -it percona-xtradb-pxc-0 -- \
mysql -e "SHOW STATUS LIKE 'wsrep_cluster%';"
3. Review the PXC pod logs for the affected replica:
.. code-block:: console
kubectl -n openstack logs percona-xtradb-pxc-<N> --tail=200
4. If the node remains in Joining state, it may need an SST restart.
Delete the affected pod to trigger a fresh SST:
.. code-block:: console
kubectl -n openstack delete pod percona-xtradb-pxc-<N>
5. Verify that no PXC backup runs at the moment (a backup puts a node
into Donor state, which the ``MySQLGaleraDonorFallingBehind`` alert covers):
.. code-block:: console
kubectl -n openstack get pxc-backup
``NginxIngressCriticalErrorBudgetBurn``
=======================================
@@ -0,0 +1,10 @@
---
fixes:
- |
The ``MySQLGaleraOutOfSync`` alert no longer fires false positives during
Percona XtraDB Cluster (PXC) operator backups. The patched expression
excludes Galera Donor state
(``wsrep_local_state=2``), which is a normal transient state when a node
serves as a donor for State Snapshot Transfer. The separate
``MySQLGaleraDonorFallingBehind`` alert still covers problematic donor
scenarios.
@@ -109,42 +109,64 @@ local mixins = {
},
},
memcached: (import 'vendor/github.com/grafana/jsonnet-libs/memcached-mixin/mixin.libsonnet'),
mysqld: (import 'vendor/github.com/prometheus/mysqld_exporter/mysqld-mixin/mixin.libsonnet') + {
prometheusAlerts+:: {
groups+: [
{
name: 'mysqld-extras',
rules: [
{
alert: 'MysqlTooManyConnections',
'for': '1m',
expr: |||
max_over_time(mysql_global_status_threads_connected[1m]) / mysql_global_variables_max_connections * 100 > 80
|||,
labels: {
severity: 'warning',
mysqld:
local base = (import 'vendor/github.com/prometheus/mysqld_exporter/mysqld-mixin/mixin.libsonnet');
base {
prometheusAlerts:: {
groups: [
if group.name == 'GaleraAlerts' then group {
rules: [
if rule.alert == 'MySQLGaleraOutOfSync' then {
alert: 'MySQLGaleraOutOfSync',
'for': '15m',
expr: |||
(mysql_global_status_wsrep_local_state != 4 and mysql_global_status_wsrep_local_state != 2 and mysql_global_variables_wsrep_desync == 0)
|||,
labels: { severity: 'warning' },
annotations: {
summary: 'Percona XtraDB Cluster: Galera node not in sync with cluster',
description: 'The Galera node {{ $labels.instance }} has wsrep_local_state={{ $value }} which is not the expected value of 4 (Synced). The node is not in Donor state (2) and wsrep_desync is not enabled, indicating an unexpected loss of cluster sync. Normal behavior is wsrep_local_state=4 for all nodes not actively serving as SST donors.',
runbook_url: 'https://vexxhost.github.io/atmosphere/admin/monitoring.html#mysqlgaleraoutofsync',
},
} else rule
for rule in group.rules
],
} else group
for group in base.prometheusAlerts.groups
] + [
{
name: 'mysqld-extras',
rules: [
{
alert: 'MysqlTooManyConnections',
'for': '1m',
expr: |||
max_over_time(mysql_global_status_threads_connected[1m]) / mysql_global_variables_max_connections * 100 > 80
|||,
labels: {
severity: 'warning',
},
},
},
{
alert: 'MysqlHighThreadsRunning',
'for': '1m',
expr: |||
max_over_time(mysql_global_status_threads_running[1m]) / mysql_global_variables_max_connections * 100 > 60
|||,
labels: {
severity: 'warning',
{
alert: 'MysqlHighThreadsRunning',
'for': '1m',
expr: |||
max_over_time(mysql_global_status_threads_running[1m]) / mysql_global_variables_max_connections * 100 > 60
|||,
labels: {
severity: 'warning',
},
},
},
{
alert: 'MysqlSlowQueries',
'for': '2m',
expr: |||
increase(mysql_global_status_slow_queries[1m]) > 0
|||,
labels: {
severity: 'warning',
{
alert: 'MysqlSlowQueries',
'for': '2m',
expr: |||
increase(mysql_global_status_slow_queries[1m]) > 0
|||,
labels: {
severity: 'warning',
},
},
},
{
alert: 'MysqlClusterDown',
'for': '5m',
@@ -709,3 +709,59 @@ tests:
summary: "NGINX Ingress: low-level 5xx errors eroding error budget"
description: "The service placement-api error rate is 0.2% over the last 3 days, which exceeds the 0.1% burn-rate threshold (1x against 99.9% SLO). At this rate, the 30-day error budget exhausts before the window resets."
runbook_url: "https://vexxhost.github.io/atmosphere/admin/monitoring.html#nginxingresslowerrorbudgetburn"
# MySQLGaleraOutOfSync - should NOT fire when node is in Synced state (4)
- interval: 1m
input_series:
- series: 'mysql_global_status_wsrep_local_state{instance="percona-xtradb-pxc-0",job="pxc"}'
values: '4x20'
- series: 'mysql_global_variables_wsrep_desync{instance="percona-xtradb-pxc-0",job="pxc"}'
values: '0x20'
alert_rule_test:
- eval_time: 15m
alertname: MySQLGaleraOutOfSync
exp_alerts: []
# MySQLGaleraOutOfSync - should NOT fire when node is in Donor state (2) during backup
- interval: 1m
input_series:
- series: 'mysql_global_status_wsrep_local_state{instance="percona-xtradb-pxc-2",job="pxc"}'
values: '2x20'
- series: 'mysql_global_variables_wsrep_desync{instance="percona-xtradb-pxc-2",job="pxc"}'
values: '0x20'
alert_rule_test:
- eval_time: 15m
alertname: MySQLGaleraOutOfSync
exp_alerts: []
# MySQLGaleraOutOfSync - should NOT fire when wsrep_desync is enabled
- interval: 1m
input_series:
- series: 'mysql_global_status_wsrep_local_state{instance="percona-xtradb-pxc-1",job="pxc"}'
values: '1x20'
- series: 'mysql_global_variables_wsrep_desync{instance="percona-xtradb-pxc-1",job="pxc"}'
values: '1x20'
alert_rule_test:
- eval_time: 15m
alertname: MySQLGaleraOutOfSync
exp_alerts: []
# MySQLGaleraOutOfSync - should fire when node is in Joining state (1)
- interval: 1m
input_series:
- series: 'mysql_global_status_wsrep_local_state{instance="percona-xtradb-pxc-1",job="pxc"}'
values: '1x20'
- series: 'mysql_global_variables_wsrep_desync{instance="percona-xtradb-pxc-1",job="pxc"}'
values: '0x20'
alert_rule_test:
- eval_time: 15m
alertname: MySQLGaleraOutOfSync
exp_alerts:
- exp_labels:
severity: P3
instance: percona-xtradb-pxc-1
job: pxc
exp_annotations:
summary: "Percona XtraDB Cluster: Galera node not in sync with cluster"
description: "The Galera node percona-xtradb-pxc-1 has wsrep_local_state=1 which is not the expected value of 4 (Synced). The node is not in Donor state (2) and wsrep_desync is not enabled, indicating an unexpected loss of cluster sync. Normal behavior is wsrep_local_state=4 for all nodes not actively serving as SST donors."
runbook_url: "https://vexxhost.github.io/atmosphere/admin/monitoring.html#mysqlgaleraoutofsync"