friky.com
← Back to archive

Post

How to send you an email with your mysql slave seconds behind master value

2015-07-14 Agustí Pons Original post

It's dead simple, just schedule a crontab with this line:

mysql -u root -p -e "show slave status \G"|grep Seconds | mail -s "Seconds behind master"

This will query the slave status, grep the most important line and send you an email.

Hope this help