Skip to content

Instantly share code, notes, and snippets.

@sandipransing
Created February 4, 2011 10:09
Show Gist options
  • Select an option

  • Save sandipransing/810949 to your computer and use it in GitHub Desktop.

Select an option

Save sandipransing/810949 to your computer and use it in GitHub Desktop.
rails.monitrc
check process nginx with pidfile /opt/nginx/logs/nginx.pid
start program = "/opt/nginx/sbin/nginx"
stop program = "/opt/nginx/sbin/nginx -s stop"
if cpu is greater than 70% for 3 cycles then alert
if cpu > 80% for 5 cycles then restart
if 10 restarts within 10 cycles then timeout
check process sphinx with pidfile /home/josh/shared/pids/searchd.pid
stop program = "/bin/bash -c 'cd /home/josh/current && /usr/bin/rake RAILS_ENV=production ts:stop'"
start program = "/bin/bash -c 'cd /home/josh/current && /usr/bin/rake RAILS_ENV=production ts:start'"
if totalmem > 85.0 MB for 3 cycles then restart
if cpu usage > 95% for 3 cycles then restart
check process dj with pidfile /home/josh/shared/pids/delayed_job.pid
stop program = "/etc/init.d/delayed_job stop"
start program = "/etc/init.d/delayed_job start"
if totalmem > 100.0 MB for 3 cycles then restart
if cpu usage > 95% for 3 cycles then restart
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment