Monitor MySQL: Restart when it uses excess system resources and alert me
MySQL when left running for extended periods of time can use more and more system resources, this is especially true for very busy websites where the usage can become so extreme that all the ram is used and cpu usage hits 100%. When this happens, your website will fail to load and your entire server will lock up.
daeMON can solve this by monitoring and restarting MySQL before it reaches these danger levels.
Reconfiguring the FireDaemon MySQL Service
First you need to configure your MySQL service to shutdown firedaemon if it crashes. The “Upon Program Exit” option in the “Settings” tab should set to: “Disabled” or “Shutdown FireDaemon”.

Install and Configure daeMON
1. Download and install FireDaemon.
2. Download daeMON (314KB) and unzip it into the directory of your choice (eg. C:\Program Files\daeMON).
3. Make a note of the short name of the MySQL service you want to monitor (eg. mysql).
4. Start the FireDaemon Service Manager from the Start/Programs menu or desktop icon. Click on the Create A New Service Definition button in the Toolbar or press Ctrl+N. Fill out the panel as per the screen shot below (adjust your paths and parameters to suite) – you can use the TAB or SHIFT+TAB keys to move between fields:

The working directory is where you have placed the daeMON Perl script. Note the Parameters list. This is the list of services (in startup order) that you want to monitor. Each service short name is prefixed with a -s. If you want to change the monitoring facility frequency use the -f flag.
The following settings are good in most cases:
High CPU load threshold (as a percentage): 75
High memory threshold (in MB): 1024
Monitoring frequency (in seconds): 60
Ignore high CPU/Memory for X monitored intervals (in minutes): 5
[Look in readme.txt included with Daemon for more flags and descriptions]
5. You should really change the desktop interaction flag as it’s not necessary to see what’s going on (but you can leave it on if you are curious):

6. If you want to capture the debug log output of the utility then you can enable it as per the Output Capture section in the screenshot below. If your services take quite a while to initialise then you can set the Pre-Launch delay (in the Process section). This will defer the startup of daeMON by the number of milliseconds you specify (5000 = 5s).

7. Alternately, you can make the daeMON dependent on the services it is monitoring. For example:

8. Then click the Install button and daeMON should be installed and monitoring your group of services. Should you accidently shutdown a service or a process dies, then all the services that you specified in the Parameters list will be restarted.
To find out how to receive email alerts when MySQL restarts go here.
No comments yet.
Leave a comment
Recent Posts
- Passwordless root SSH Public Key Authentication on CentOS 6
- Setting up DHCP on an Enslaved VLAN Bridge on CentOS Linux
- Identifying BlueArc Mercury M100 Hardware Revision
- BlueArc EVS Routing
- Disabling CIFS Authentication on a BlueArc EVS In Standalone Security Mode
- Running TeamSpeak 3 Server As A Service With FireDaemon
- Configuring iSCSI on CentOS 5.6
- Disable pagefile – will it increase Windows Server performance?
- How do I increase my Game Performance
- Scheduling a Service to run once per day.