Any ideas why monit will not monitor mysql in this setup??? I've gone through everything I can find here to solve the problem to no avail.
These are my versions:
Distributor ID: Ubuntu
Description: Ubuntu 14.04.2 LTS
Release: 14.04
Codename: trusty
mysql --version
Ver 14.14 Distrib 5.5.41, for debian-linux-gnu (x86_64) using readline 6.3
monit -V
This is Monit version 5.6
I've tried both of these setups:
check process mysql with pidfile /var/run/mysqld/mysqld.pid
group database
start program = "/etc/init.d/mysql start"
stop program = "/etc/init.d/mysql stop"
#if failed host 127.0.0.1 port 3306 protocol mysql then restart
if failed unixsocket /var/run/mysqld/mysqld.sock protocol MYSQL then restart
And get this:
monit status
Process 'mysql'
status Not monitored
monitoring status Not monitored
Can confirm:
/var/run/mysqld/mysqld.pid
reads the same as
ps -e | grep "mysql"
Log:
/var/log/monit.log
shows no errors
Monit is running as root:
ps -eaf | grep monit
root 4549 1 0 05:18 ? 00:00:00 /usr/bin/monit -c /etc/monit/monitrc
root 5248 12440 0 05:53 pts/0 00:00:00 grep --color=auto monit
How to monitor? Monit is controlled via an easy to configure control file with a simple syntax. The file is called monitrc and resides in your home directory. An example monitrc file is included with the Monit download.
By default, it is set up to check that services are running every 2 minutes and stores its log file in “/var/log/monit.
Now, If we want Monit to also start at boot so I need to edit the service configuration file at /etc/default/monit and ensure “START” is set to “yes”. And that's it. It will automatically restart any service or script.
as already mentioned, this should do:
monit monitor mysql
sometimes the "timeout" statement can disable monitoring in case of too many restart errors, I do not recommend using statements like this:
if X restarts within Y cycles then timeout
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With