Gracefully handling reboot?

Issue #665 closed
Danila Vershinin created an issue

I have a few services monitored via Monit.

Sample configuration for MySQL:

check process mysqld with pidfile "/var/run/mysqld/mysqld.pid"
start program = "/usr/sbin/service mysql start"
stop program = "/usr/sbin/service mysql stop"
if cpu > 90% for 2 cycles then alert
if cpu > 90% for 5 cycles then restart
if memory usage > 85% then alert
#if failed port 3306 protocol mysql then restart
if failed unixsocket /var/lib/mysql/mysql.sock then restart
if 5 restarts within 5 cycles then timeout

Problem: after rebooting server, Monit starts its checks "too early". This results in a handful of emails sent in this order:

1. Subject: Does not exist (mysqld) 
Action: restart
process is not running
2. Subject: Exists (mysqld)
Action: alert
process is running with pid 4079

Any way I can have Monit actually wait after server reboot for all services to get online before starting with its checks?

Comments (3)

  1. Log in to comment