Linux MySQL server monitoring
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:
- Essential tools for monitoring and administrating MySQL Server
- How to tune MySQL server for performance
- Recover MySQL root password
- Tuning MySQL server under Sun Solaris OS
- Copy MySQL database from one server to another remote server
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!


Recent Comments
Today ~ 1 Comment
Today ~ 50 Comments
Today ~ 3 Comments
Yesterday ~ 10 Comments
Yesterday ~ 8 Comments