Skip to main content

monitoring - Monit issues with mysql Ubuntu server 12.04

itemprop="text">

I've installed Monit on Ubuntu server
12.04 but Im having issues getting mysql monitoring to work at all. Here is what I have
done so
far.



#/etc/default/monit
startup=1


#/etc/mysql/my.cnf
pid-file
= /var/run/mysqld/mysqld.pid

#/etc/monit/monitrc
set
daemon 60
check process mysql with pidfile
/var/run/mysqld/mysqld.pid
group mysql
start program =
"/etc/init.d/mysql start" with timeout 30 seconds
stop program =
"/etc/init.d/mysql stop"

if failed host 127.0.0.1 port 3306 then
restart
if 5 restarts within 5 cycles then
timeout


The mysqld.pid
file is being created as expected but monit cannot access it. Here are the permissions
for mysqld.pid



-rw-rw---- 1 mysql
mysql 6 2014-06-02 11:36 mysqld.pid



Here is the status
for monit




#monit
status
Process 'mysql'
status not monitored
monitoring
status not monitored
data collected Mon Jun 2 23:49:37
2014


And here are the
errors Im seeing in the monit
log




Jun 2 23:47:07
MySQL-Dev monit[13034]: 'mysql' process is not running
Jun 2 23:47:07
MySQL-Dev monit[13034]: 'mysql' trying to restart
Jun 2 23:47:07 MySQL-Dev
monit[13034]: monit: Error opening the pidfile '/var/run/mysqld/mysqld.pid' --
Permission denied
Jun 2 23:47:07 MySQL-Dev monit[13034]: monit: Error opening
the pidfile '/var/run/mysqld/mysqld.pid' -- Permission denied
Jun 2 23:47:07
MySQL-Dev monit[13034]: 'mysql' start: /etc/init.d/mysql
Jun 2 23:47:07
MySQL-Dev monit[13034]: monit: Error opening the pidfile '/var/run/mysqld/mysqld.pid' --
Permission denied
Jun 2 23:47:37 MySQL-Dev monit[13034]: last message repeated
31 times
Jun 2 23:47:37 MySQL-Dev monit[13034]: 'mysql' failed to
start
Jun 2 23:48:37 MySQL-Dev monit[13034]: 'mysql' service timed out and
will not be checked
anymore



Im
not sure what to do at this point and I have not been able to find anything online that
addresses my specific issue.


itemprop="text">
class="normal">Answer



If you
run monit as root, it should be able to access this pid file. Please check if your not
running monit with another user.



#
ps -eaf | grep monit
root XXXX 1 0 Jun20 ? 00:00:08 /usr/sbin/monit -c
/etc/monit/monitrc -s
/var/lib/monit/monit.state


Comments