Skip to content

Instantly share code, notes, and snippets.

@mario21ic
Created June 4, 2017 19:07
Show Gist options
  • Save mario21ic/796e474bfede7cf00b0a0ec0b5ccc001 to your computer and use it in GitHub Desktop.
Save mario21ic/796e474bfede7cf00b0a0ec0b5ccc001 to your computer and use it in GitHub Desktop.
Monit files to configuration: apache, httpd, nginx, mysql and sshd
check process apache with pidfile /run/apache2.pid
start program = "/etc/init.d/apache2 start" with timeout 60 seconds
stop program = "/etc/init.d/apache2 stop"
check process httpd with pidfile /var/run/httpd.pid
group apache
start program = "/etc/init.d/httpd start"
stop program = "/etc/init.d/httpd stop"
if failed host 127.0.0.1 port 80
protocol http then restart
if 5 restarts within 5 cycles then timeout
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
check process nginx with pidfile /var/run/nginx.pid
start program = "/etc/init.d/nginx start"
stop program = "/etc/init.d/nginx stop"
check process sshd with pidfile /var/run/sshd.pid
start program "/etc/init.d/sshd start"
stop program "/etc/init.d/sshd stop"
if failed host 127.0.0.1 port 22 protocol ssh then restart
if 5 restarts within 5 cycles then timeout
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment