Question

Does anybody know for both domain & subdirectory at the same time how to set up monit?

I have already setup monit for main domain(code below) but I am stuck for the subdirectory.

check process nginx with pidfile /var/run/nginx.pid group www-data start program = “/etc/init.d/nginx start” stop program = “/etc/init.d/nginx stop” if failed host example.com port 80 protocol http then restart if 5 restarts within 5 cycles then timeout

   check process mysql with pidfile /var/run/mysqld/mysqld.pid
       start program = "/etc/init.d/mysql start"
       stop program = "/etc/init.d/mysql stop"
       if failed unixsocket /var/run/mysqld/mysqld.sock then restart
       if 5 restarts within 5 cycles then timeout

   check process php7.0-fpm with pidfile /var/run/php7.0-fpm.pid
       start program = "/etc/init.d/php7.0-fpm start"
       stop program = "/etc/init.d/php7.0-fpm stop"
       if failed host example.com port 80 protocol http then restart
       if 5 restarts within 5 cycles then timeout
Subscribe
Share

Submit an answer
You can type!ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

You need to use request like this: if failed host example.com port 80 protocol http request “/blog” then alert