9

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
Ankit Deshpande
  • 3,476
  • 1
  • 29
  • 42
shaone
  • 91
  • 1
  • 4
  • Try `monit monitor all` in command line. – Ajeeb.K.P Jun 02 '15 at 08:06
  • Or just `monit monitor mysql`. – Ajeeb.K.P Jun 02 '15 at 08:07
  • For me the answer at https://unix.stackexchange.com/questions/447212/how-do-i-configure-to-monit-monitor-a-process-after-it-restarts helped, i.e. using "then exec $script " instead of using "then restart" "stop/start" programs. – dr0i Dec 17 '20 at 16:40

2 Answers2

8

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
riba
  • 186
  • 2
  • 7
0

Sounds like monit might not have access to the user database group.

What does ps -eaf | grep mysql read?

Perp1exed
  • 179
  • 1
  • 10