Skip to content

Instantly share code, notes, and snippets.

@adamjt
Created March 31, 2011 00:01
Show Gist options
  • Save adamjt/895555 to your computer and use it in GitHub Desktop.
Save adamjt/895555 to your computer and use it in GitHub Desktop.
monitrc for nginx
# polling interval (in seconds)
set daemon 60
set logfile <%= your_path %>/log/monit.log
set pidfile <%= your_path %>/tmp/pids/monit.pid
set statefile <%= your_path %>/tmp/monit/monit.state
set mailserver localhost
set mail-format { from: sender@yourdomain.com }
set alert recipient@yourdomain.com
set httpd port 7474 and use address 0.0.0.0
allow localhost
allow your.ip.address
allow user:password
#### nginx ####
check process nginx
with pidfile <%= your_nginx_path %>/conf/nginx.pid
start program = "<%= your_nginx_path %>/sbin/nginx"
stop program = "/bin/bash -c 'kill -s SIGTERM `cat <%= your_nginx_path %>/conf/nginx.pid` && rm <%= your_nginx_path %>/conf/nginx.pid'"
if failed host <%= host %> port <%= nginx_port %> then restart
group webserver
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment