Monitor Percona XtraDB Cluster on OpenBSD 7.5
Key wsrep variables
SHOW STATUS LIKE 'wsrep_%';
| Variable |
Healthy value |
wsrep_cluster_size |
= number of nodes |
wsrep_cluster_status |
Primary |
wsrep_connected |
ON |
wsrep_ready |
ON |
wsrep_local_state_comment |
Synced |
wsrep_flow_control_paused |
< 0.1 |
Replication lag
SHOW STATUS LIKE 'wsrep_local_recv_queue_avg';
-- > 0 means node is behind
PMM (Percona Monitoring and Management)
# RHEL / AlmaLinux:
dnf install -y pmm2-client
pmm-admin config --server-insecure-tls --server-url=https://admin:[email protected]
pmm-admin add mysql --username=pmm --password=PMMpass! --service-name=pxc-node1
Shell health-check cron
#!/bin/bash
STATUS=$(mysql -u monitor -pPass -e "SHOW STATUS LIKE 'wsrep_cluster_status';" 2>/dev/null | awk '/wsrep_cluster_status/{print $2}')
[ "$STATUS" != "Primary" ] && echo "PXC not Primary: $STATUS" | mail -s "PXC Alert" [email protected]
*/5 * * * * root /usr/local/bin/check_pxc.sh