3

I installed monit on my Ubuntu 14.04 server and configured it to monitor mysql with the below config in monitrc.

 check process mysqld with pidfile /var/run/mysqld/mysqld.pid
 start program = "/etc/init.d/mysql start"
 stop program = "/etc/init.d/mysql stop"

Now to test I shutdown mysql user

 service mysql stop

Monit does restart the server but the issue is that when I service status on mysql like below

 service mysql status

It shows

 mysql stop/waiting

But when I do

 ps -e | grep "mysql"

I see the mysqld service running.

Any ideas why service mysql status wont show me running?

Thanks!

salmandem
  • 31
  • 2
  • Does the mysql process you see in ps have the same pidfile as listed in /var/run/mysqld/mysqld.pid? Also should replace /etc/init.d/mysql start|stop in monit config with adequate service command. – Henrik Feb 10 '15 at 14:39
  • Yes it has the same id – salmandem Feb 10 '15 at 14:46
  • Ok, thats a good starting point :) Replace the start|stop commands as suggested, restart mysql service manually and see if monit recognizes it. Then start/stop service via monit ans see if that works. From my experience monit struggles sometimes during initial setup but works fine afterwards (I cant tell a reason for this). Also check the monit template for mysql in /etc/monit/monitrc.d/ - it covers much more than yours. – Henrik Feb 10 '15 at 14:56
  • Tried to put service command instead /etc/init.d/mysql but monit doesn't know what is service. – salmandem Feb 10 '15 at 16:12
  • replace service with /usr/bin/service (or whatever 'whereis service' hands you out) – Henrik Feb 10 '15 at 16:36

0 Answers0