Monitoring mysql slave with nagios

I found a little nifty tool for monitoring mysql replication with nagios at http://opensource.fotango.com/~jeb/. Jeb’s tool did whereupon I searched for and it did even some things more. The check_replication.pl script compares the positions of master and save and therefor it needed connections to both the master an the slave.

Since I’m unsing mysql 4.1.7 (or hight in the future), I wanted to use a simple solution that just monitors the slave and don’t connects and requests the master. Thanks to the new mysql 4.1.7 there’s the “show slave status” statement that features the variable “Seconds_Behind_Master” that was usefull for the simple solution that I had in mind.

Update: 11.01.2005: added support to detect Slave_IO_Running and Slave_SQL_Running critical states

Here’s the source that was inspired and based ob jebs perl script. Enjoy it if this fits your need, too:
check_mysql_seconds_behind_master.pl

1 comment Write a comment

  1. Just for the benefit of anyone Googling for this, you can monitor the MySQL slave status by passing the -S option to the usual check_mysql Nagios plugin (and use -w and -c to set the warning and critical thresholds of seconds behind master).