Check mysql-replica-status
Overview
Checks the replication status of MySQL/MariaDB. Logic is taken from MySQLTuner script, v1.9.8.
Hints:
On RHEL 7+, one way to install the Python MySQL Connector is via
pip install pymysql
Can also be run against standalone servers.
Compared to check_mysql / MySQLTuner this check currently:
supports only simple login with username/password (not via SSL/TLS)
does not support a connection via socket
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 |
Available for |
Python 3, Windows |
Requirements |
Python module |
Help
usage: mysql-replica-status [-h] [-V] [--always-ok] [-H HOSTNAME]
[-p PASSWORD] [--port PORT]
[--severity {warn,crit}] [-u USERNAME]
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.
-H HOSTNAME, --hostname HOSTNAME
MySQL/MariaDB hostname. Default: 127.0.0.1
-p PASSWORD, --password PASSWORD
Use the indicated password to authenticate the
connection. Default:
--port PORT MySQL/MariaDB port. Default: 3306
--severity {warn,crit}
Severity for alerts that do not depend on thresholds.
One of "warn" or "crit". Default: warn
-u USERNAME, --username USERNAME
MySQL/MariaDB username. Default: root
Usage Examples
./mysql-replica-status --hostname localhost --username root --password mypassword
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)