Take the 2-minute tour ×
Database Administrators Stack Exchange is a question and answer site for database professionals who wish to improve their database skills and learn from others in the community. It's 100% free, no registration required.

Possible Duplicate:
Monitoring replication on mysql

I am running with MySQL Master/Slave Replication on Linux.

Is there any tool/Shell script which monitors the Replication Status and send the email alerts when there is Replication failure.

share|improve this question

marked as duplicate by Jack Douglas May 10 '12 at 5:31

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

    
I just answered an identical question here dba.stackexchange.com/questions/17501/… –  Aaron Brown May 9 '12 at 23:30
add comment

2 Answers 2

Zenoss is another capable monitoring tool.

Writing a simple shell script and setting it up as a cron would also be pretty simple if you only have a couple hosts to monitor.

#!/bin/bash

host=my.db.com
user=repl_check
password=xxxx

$MSG=`mysql -h $host -u$user -p$password -e 'show slave status\G' | grep Last_SQL_Error | sed -e 's/ *Last_SQL_Error: //'`
if [ -n "$MSG" ]; then
    # email someone 
fi
share|improve this answer
add comment

If you don't have a monitoring framework in place, I would highly recommend looking into Nagios. There are others, but for the purpose of this question, Percona has many MySQL monitoring tools available. Two of them specifically monitors slave lag and slave failures. From their blog post:

The pmp-check-mysql-replication-delay plugin checks for excessive delay, and pmp-check-mysql-replication-running checks that replication is functioning correctly.

share|improve this answer
add comment

Not the answer you're looking for? Browse other questions tagged or ask your own question.