Last active
November 20, 2015 16:34
-
-
Save schallis/8305205bbdfaddec4462 to your computer and use it in GitHub Desktop.
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
post_to_slack() { | |
USERNAME="<username>" | |
CHANNEL="<channel>" | |
MESSAGE="$1" | |
PAYLOAD="payload={\"channel\": \"$CHANNEL\", \"username\": \"$USERNAME\", \"text\": \"$MESSAGE\"}" | |
SLACK_URL=<webhook_url> | |
curl -X POST --data-urlencode "$PAYLOAD" $SLACK_URL | |
} | |
response=`curl -s -o /dev/null -w "%{http_code}" https://zonza.tv/authentication/login/` | |
current=`date "+%F %T %Z"` | |
message="$current zonza.tv appears to be down [HTTP $response] #PrayForZONZA" | |
if [ $response != "200" ] && [ $response != "000" ]; then | |
echo $message; post_to_slack "$message"; | |
fi | |
~ | |
~ | |
~ | |
~ | |
~ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Check for non-200 HTTP codes and post to Slack channel if website appears to be down.
Stick it in Cron with: