I installed monit using yum install monit Code (markup): I havent been able to get it to run at all. The service list contains the following entries: Process Name = mysql Group = database Pid file = /var/run/mysqld/mysqld.pid Monitoring mode = active Start program = '/etc/init.d/mysqld start' timeout 30 second(s) Stop program = '/etc/init.d/mysqld stop' timeout 30 second(s) Existence = if does not exist 1 times within 1 cycle(s) then restart else if succeeded 1 times within 1 cycle(s) then alert Pid = if changed 1 times within 1 cycle(s) then alert Ppid = if changed 1 times within 1 cycle(s) then alert Port = if failed 54.245.117.40:3306 [DEFAULT via TCP] with timeout 5 seconds 1 times within 1 cycle(s) then restart else if succeeded 1 times within 1 cycle(s) then alert Timeout = If restarted 5 times within 5 cycle(s) then unmonitor Code (markup): Any help would be appreciated.
Check your /var/log/monit.log log file for more details. The configuration file of monit in Centos, Fedora or RHEL is /etc/monit.conf. Type the following command to edit: vi /etc/monit.conf set daemon 60 set logfile /var/log/monit.log set mailserver localhost set mail-format { from: subject: $SERVICE $EVENT at $DATE message: Monit $ACTION $SERVICE at $DATE on $HOST: $DESCRIPTION. } set alert include /etc/monit.d/* To monitor MySQL, create a file /etc/monit.d/mysql, enter: check process mysqld with pidfile /var/run/mysqld/mysqld.pid group mysql start program = "/etc/init.d/mysqld start" stop program = "/etc/init.d/mysqld stop" if failed host 127.0.0.1 port 3306 then restart if 5 restarts within 5 cycles then timeout Start monit using the following command: /etc/init.d/monit start
Thanks for the reply. I changed my mysql code to the one you provided and that didnt work but it setup the solution. I ended up typing: monit status Code (markup): Monit showed it was not monitoring the mysqld file even though I restarted the service when I updated the file. I typed in: monit monitor mysqld Code (markup): Typed in the status code again and it said that the mysqld monitoring was initializing. Waited until it was initialized. I then manually stopped mysql and monit restarted it and sent me an email. Thanks alot!