Skip to content

Instantly share code, notes, and snippets.

@iamkingsleyf
Forked from tomazzaman/hhvm.conf
Created October 7, 2015 03:27
Show Gist options
  • Save iamkingsleyf/a42732daf1412c18b2c8 to your computer and use it in GitHub Desktop.
Save iamkingsleyf/a42732daf1412c18b2c8 to your computer and use it in GitHub Desktop.
Monit configurations for commonly used services
check process hhvm with pidfile /var/run/hhvm/pid
group hhvm
start program = "/usr/sbin/service hhvm start" with timeout 60 seconds
stop program = "/usr/sbin/service hhvm stop"
if failed unixsocket /var/run/hhvm/hhvm.sock then restart
if mem > 400.0 MB for 1 cycles then restart
if 5 restarts with 5 cycles then timeout
check process mysqld with pidfile /var/run/mysqld/mysqld.pid
group mysql
start program = "/usr/sbin/service mysql start"
stop program = "/usr/sbin/service mysql stop"
if failed host localhost port 3306 protocol mysql with timeout 15 seconds for 3 times within 4 cycles then restart
if failed unixsocket /var/run/mysqld/mysqld.sock protocol mysql for 3 times within 4 cycles then restart
if 5 restarts with 5 cycles then timeout
check process nginx with pidfile /var/run/nginx.pid
group nginx
start program = "/usr/sbin/service nginx start"
stop program = "/usr/sbin/service nginx stop"
if failed host 127.0.0.1 port 80 then restart
if cpu is greater than 40% for 2 cycles then alert
if cpu > 60% for 5 cycles then restart
if 10 restarts within 10 cycles then timeout
check process php5-fpm with pidfile /var/run/php5-fpm.pid
group phpcgi
start program = "/usr/sbin/service php5-fpm start"
stop program = "/usr/sbin/service php5-fpm stop"
if failed unixsocket /var/run/php5-fpm.sock then restart
if 3 restarts within 5 cycles then timeout
check process redis-server with pidfile /var/run/redis/redis-server.pid
group redis
start program = "/usr/sbin/service redis-server start"
stop program = "/usr/sbin/service redis-server stop"
if 2 restarts within 3 cycles then timeout
if totalmem > 100 Mb then alert
if children > 255 for 5 cycles then stop
if cpu usage > 95% for 3 cycles then restart
if failed host 127.0.0.1 port 6379 then restart
if 5 restarts within 5 cycles then timeout
check system server
if memory > 85% 2 times within 3 cycles then alert
if cpu(user) > 75% for 2 cycles then alert
if cpu(system) > 65% for 2 cycles then alert
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment