Add monitoring basics

This commit is contained in:
2013-04-17 16:25:38 +02:00
parent b6a65d981f
commit 80057b0bf5
10 changed files with 104 additions and 0 deletions
+15
View File
@@ -0,0 +1,15 @@
check process <%= application %>_unicorn with pidfile <%= unicorn_pid %>
start program = "/etc/init.d/unicorn_<%= application %> start"
stop program = "/etc/init.d/unicorn_<%= application %> stop"
<% unicorn_workers.times do |n| %>
<% pid = unicorn_pid.sub(".pid", ".#{n}.pid") %>
check process <%= application %>_unicorn_worker_<%= n %> with pidfile <%= pid %>
start program = "/bin/true"
stop program = "/usr/bin/test -s <%= pid %> && /bin/kill -QUIT `cat <%= pid %>`"
if mem > 200.0 MB for 1 cycles then restart
if cpu > 50% for 3 cycles then restart
if 5 restarts within 5 cycles then timeout
alert foo@example.com only on { pid }
if changed pid 2 times within 60 cycles then alert
<% end %>