I use Monit 5.27.2 and MariaDB 10.5.15 on my Debian 11 servers.
My servers are set up in Multi-Source MariaDB Replication.
Sometimes, replication stops and I am not notified. I have not seen anywhere a prepared configuration for Monit to send such alerts.
The errors are visible with the following query:
SHOW SLAVE STATUS;
With those values particularly interesting:
I have not found any way to use Monit to monitor directly the result of a SQL statement. However, it seems possible to monitor the return code of a command with versions before Monit 5.29.0 (and the output of a command after).
I can probably prepare a Bash/Shell script that will check the output of the SQL statement and then a Monit config that will send me an alert in case of issue. If I do, I will post this as an answer here. I was just wondering whether there was already a known solution to this.
I expect this to work with MySQL.
I intend to test this with those SQL queries:
STOP SLAVE;
START SLAVE;
show slave status
is just a SQL statement that returns a row of fixed headings likeSlave_IO_Running
, so it can be used as a key. – Ge