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
You should follow me on twitter here or grab rss feed to keep track of new changes.
Featured Articles:
- 30 Handy Bash Shell Aliases For Linux / Unix / Mac OS X
- Top 30 Nmap Command Examples For Sys/Network Admins
- 25 PHP Security Best Practices For Sys Admins
- 20 Linux System Monitoring Tools Every SysAdmin Should Know
- 20 Linux Server Hardening Security Tips
- Linux: 20 Iptables Examples For New SysAdmins
- Top 20 OpenSSH Server Best Security Practices
- Top 20 Nginx WebServer Best Security Practices
- 20 Examples: Make Sure Unix / Linux Configuration Files Are Free From Syntax Errors
- 15 Greatest Open Source Terminal Applications Of 2012

- My 10 UNIX Command Line Mistakes
- Top 10 Open Source Web-Based Project Management Software
- Top 5 Email Client For Linux, Mac OS X, and Windows Users
- The Novice Guide To Buying A Linux Laptop











{ 0 comments… add one now }