Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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
@ianxzone

This comment has been minimized.

Copy link

commented Jan 6, 2017

hello sir, sorry i have question about hhvm

i not have file
pid in the path,
check process hhvm with pidfile /var/run/hhvm/pid
just have file sock
/var/run/hhvm/sock

can you tell me where i or how i can get this file pid?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.