Home Directory Plugins Databases MySQL MySQL Replication Lag Time

Search Exchange

Search All Sites

Nagios Live Webinars

Let our experts show you how Nagios can help your organization.

Contact Us

Phone: 1-888-NAGIOS-1
Email: sales@nagios.com

Login

Remember Me

MySQL Replication Lag Time

Rating
2 votes
Favoured:
0
Hits
96453
Files:
FileDescription
check_mysqlrep.shcheck_mysqlrep.sh

Help Support Ethan Galstad's New Project:

Help Support Ethan

A Message From The Founder...

As the founder of Nagios, I'm asking for your help in a cause that's dear to my heart.

I'm launching a new project to help better the world by providing the information, ideas, and inspiration that I believe can improve the lives of people everywhere.

I know you're busy managing networks, but I would appreciate it if you would consider liking my Facebook page and showing your support for the content and messages I produce by sharing them with your friends and family.

You can learn more about my project by visiting ethangalstad.me/nagios. Thank you for your time. I wish you all the best in your endeavors, whatever they may be.

- Ethan

A shell script (/bin/sh) that connects to a specified MySQL slave database and checks the replication lag time.
Required parameters: host, user, password. Optional parameters: seconds to warn at, and seconds to be critical at. The default is to warn if replication falls more than 30 seconds behind, and go critical if replication falls more than 60 seconds behind. Also goes critical if the slave is not running, and therefore the lag time is NULL.

Suggestions welcome.
Reviews (2)
bynkadel, February 2, 2015
This is redundant: it's built into the nagios-plugins published 'check_mysql' package, which is tested and maintained. Use 'check_mysql -S' and review the options desired.
Only needs the mysql command line client, which is nice.

Needed some rework to work well, new version here:
http://pastebin.com/jkzC8pDe (full)
http://pastebin.com/dybGAjzg (diff)

Problems fixed are:
- Connection failure not handled at all
- Error messages from mysql not captured
- Garbage output when called without command line arguments
- Does not work at all because of use of "==" bashish, despite calling /bin/sh
- cut is in /usr/bin, not /bin, at least on Debian/Ubuntu

Thanks for the plugin!