Check mysql-replica-status
Overview
Checks the replication status of MySQL/MariaDB. Logic is taken from MySQLTuner script, v1.9.8.
Hints:
Can also be run against standalone servers.
Fact Sheet
Check Plugin Download |
https://github.com/Linuxfabrik/monitoring-plugins/tree/main/check-plugins/mysql-replica-status |
Check Interval Recommendation |
Once a minute |
Can be called without parameters |
Yes |
Compiled for |
Linux, Windows |
Requirements |
User with SUPER, REPLICATION CLIENT and REPLICATION SLAVE privileges, locked down to |
3rd Party Python modules |
|
Help
usage: mysql-replica-status [-h] [-V] [--always-ok]
[--defaults-file DEFAULTS_FILE]
[--defaults-group DEFAULTS_GROUP]
[--severity {warn,crit}] [--timeout TIMEOUT]
Checks the replication status of MySQL/MariaDB.
options:
-h, --help show this help message and exit
-V, --version show program's version number and exit
--always-ok Always returns OK.
--defaults-file DEFAULTS_FILE
Specifies a cnf file to read parameters like user,
host and password from (instead of specifying them on
the command line), for example
`/var/spool/icinga2/.my.cnf`. Default:
/var/spool/icinga2/.my.cnf
--defaults-group DEFAULTS_GROUP
Group/section to read from in the cnf file. Default:
client
--severity {warn,crit}
Severity for alerts that do not depend on thresholds.
One of "warn" or "crit". Default: warn
--timeout TIMEOUT Network timeout in seconds. Default: 3 (seconds)
Usage Examples
./mysql-replica-status --defaults-file=/var/spool/icinga2/.my.cnf
Output:
Galera Synchronous replication: NO. Binlog format: ROW, XA support enabled: ON. Semi synchronous Primary: Not Activated. Semi synchronous Replica: Not Activated. This Replica is not running but seems to be configured [WARNING].
States
Alert with the given severity, if the replica (aka slave)…
is not running but seems to be configured
is running with the read_only option disabled
is lagging behind Primary
Perfdata / Metrics
There is no perfdata.
Credits, License
Authors: Linuxfabrik GmbH, Zurich
License: The Unlicense, see LICENSE file.
Credits:
heavily inspired by MySQLTuner (https://github.com/major/MySQLTuner-perl)