Created
June 12, 2013 22:52
-
-
Save nz/5769833 to your computer and use it in GitHub Desktop.
My typical monit + Upstart combination.
This file contains hidden or 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
check process foobar with pidfile /var/run/foobar.pid | |
start program = "/sbin/start foobar" | |
stop program = "/sbin/stop foobar" | |
if mem usage > 2% | |
for 2 cycles | |
then restart | |
if failed host 127.0.0.1 port 8000 protocol HTTP | |
request / | |
timeout 20 second | |
then restart | |
if 2 restarts within 30 cycles then alert |
This file contains hidden or 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
description "foobar" | |
start on filesystem or runlevel [2345] | |
stop on runlevel [!2345] | |
respawn | |
respawn limit 10 5 | |
# hack to create a pid file for monit, for mem and pid checks | |
post-start script | |
echo `status foobar | sed 's/.*process //'` > /var/run/foobar.pid | |
end script | |
exec /var/apps/foobar/current/bin/foobar |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment