Skip to content

Instantly share code, notes, and snippets.

@afshinm
Last active March 2, 2017 14:52
Show Gist options
  • Save afshinm/c096a24f514fa3219260a65126a3e784 to your computer and use it in GitHub Desktop.
Save afshinm/c096a24f514fa3219260a65126a3e784 to your computer and use it in GitHub Desktop.
Monit configuration for MySQL and nginx on Ubuntu
check process mysqld with pidfile /var/run/mysqld/mysqld.pid
group database
start program = "/etc/init.d/mysql start"
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
check process nginx with pidfile /var/run/nginx.pid
start program = "/etc/init.d/nginx start"
stop program = "/etc/init.d/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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment