Created
September 16, 2016 17:32
-
-
Save abdul/a3df70d4379f62a0b202d20c6631a83e to your computer and use it in GitHub Desktop.
monit http check
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
## http-check | |
check program http-check with path "/etc/monit/http-check.sh" | |
start program = "/etc/init.d/php5-fpm start" | |
stop program = "/etc/init.d/php5-fpm stop" | |
if status !=0 then alert | |
if status !=0 then restart | |
if 5 restarts within 5 cycles then timeout |
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
#!/bin/bash | |
# source: /etc/monit/bin/http-check.sh | |
url="http://www.example.com" | |
response=$(curl -s -o /dev/null -I -w "%{http_code}" $url) | |
if [ "$response" = "500" ] | |
then | |
exit 1 | |
else | |
exit 0 | |
fi | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment