Created
December 14, 2012 16:28
-
-
Save technopagan/4286696 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
############################################################################### | |
## Basic Configuration | |
############################################################################### | |
# Start Monit as background daemon and delay 1st check (in seconds) after boot | |
set daemon 60 | |
with start delay 120 | |
# Mail configuration | |
set mailserver localhost | |
set alert [email protected] only on { timeout, nonexist } | |
############################################################################### | |
## Monitor Services | |
############################################################################### | |
# NGINX | |
check process nginx with pidfile /var/run/nginx.pid | |
group webserver | |
start program = "/etc/init.d/nginx start" | |
stop program = "/etc/init.d/nginx stop" | |
if failed host localhost port 8080 protocol http | |
and request "/humans.txt" | |
then restart | |
if 3 restarts within 5 cycles then alert | |
# PHP5-FPM | |
check process php5-fpm with pidfile /var/run/php5-fpm.pid | |
group webserver | |
start program = "/etc/init.d/php5-fpm start" | |
stop program = "/etc/init.d/php5-fpm stop" | |
if failed host localhost port 8080 protocol http | |
and request '/ping' | |
with timeout 30 seconds for 5 cycles | |
then restart | |
if 3 restarts within 5 cycles then alert | |
depends on nginx | |
# Varnish | |
check process varnish with pidfile /var/run/varnishd.pid | |
group webserver | |
start program = "/etc/init.d/varnish start" | |
stop program = "/etc/init.d/varnish stop" | |
if failed host localhost port 80 protocol http | |
and request "/" | |
then restart | |
if 3 restarts within 5 cycles then alert | |
depends on nginx | |
depends on php5-fpm |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Configuration for PHP-FPM service monitoring at /ping | |
location /ping { | |
access_log off; | |
allow 127.0.0.1; # localhost | |
allow ::1; # IPv6 localhost | |
deny all; | |
fastcgi_split_path_info ^(.+.php)(.*)$; | |
fastcgi_pass unix:/var/run/php-fpm.socket; | |
fastcgi_index index.php; | |
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; | |
include fastcgi_params; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment