nixCraft Poll

Topics

Linux MySQL server monitoring

Posted by Vivek Gite [Last updated: August 17, 2005]

Some time due to high load MySQL server gets killed by OS. So we need to make sure that whenever it gets killed restart the mysql server and send an email notification along with status of mysql server. This is simple and yet effective script.

Please see the monitor_mysql.bash script (download link at the end of script)

Customizing the script. Open the script in text editor such as vi, you can customize following 5 directives (read as variable):

1) MUSER="root"
Change this if your mysql admin user is not root.

2) MPASS="SET-ROOT-PASSWORD"
Setup password, this the ONLY one you need to setup.

3)MHOST="localhost"
Setup hostname if it is not localhost

4) MSTART="/etc/init.d/mysql start"
This is default on Debain Linux, you need to setup this according to your UNIX/Linux/BSD OS.

5) EMAILID="notification@somewhere-corp.com"
Set Email ID to send notification.

Once all done save the file and install script as cron job. For example run this script every minute
* * * * * /path/to/monitor_mysql.bash

Want to stay up to date with the latest Linux tips, news and announcements? Subscribe to our free e-mail newsletter or RSS feed to get all updates. You can Email this page to a friend.

You may also be interested in other helpful articles:

Leave a Reply

We encourage your comments, and suggestions. But please stay on topic, be polite, and avoid spam. Thank you very much for stopping by our site!

XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

*
To prove you're a person (not a spam script), type the security word shown in the picture. Click on the picture to hear an audio file of the word.
Click to hear an audio file of the anti-spam word

Copyright © 2004-2008 nixCraft. All rights reserved - TOS/Disclaimer - Privacy policy - Sitemap - Powered by Open source software.