Skip to content

Instantly share code, notes, and snippets.

@flores
Created October 18, 2010 21:03
Show Gist options
  • Save flores/633056 to your computer and use it in GitHub Desktop.
Save flores/633056 to your computer and use it in GitHub Desktop.
# count DOWN servers by first excluding the key, frontends, and any servers that aren't "up"
# if DOWN servers exist, email the admin
wet:~# DOWN=$(./proxyctl "show stat" |egrep -v '^#|no check|FRONTEND|UP'); if [ ${#DOWN} -gt 0 ]; then echo $DOWN |mail -s "oh snap" admin@mysite.com; fi
# add it to the cron for every 5 minutes
wet:~# crontab -e
no crontab for root - using an empty one
crontab: installing new crontab
wet:~#
wet:~#
wet:~#
wet:~# crontab -l
# m h dom mon dow command
*/5 * * * * DOWN=$(./proxyctl "show stat" |egrep -v '^#|no check|FRONTEND|UP'); if [ ${#DOWN} -gt 0 ]; then echo $DOWN |mail -s "oh snap" admin@mysite.com; fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment