2024-09-26 22:02:36 +00:00
|
|
|
#!/usr/bin/sh
|
|
|
|
|
|
|
|
cd /opt/ || exit
|
|
|
|
|
|
|
|
services_down=""
|
|
|
|
error=""
|
|
|
|
|
|
|
|
alias curl_hc='curl -LA "$USER_AGENT" --retry 3'
|
|
|
|
|
|
|
|
check_url ()
|
|
|
|
{
|
|
|
|
url="https://$1$2"
|
|
|
|
printf "checking url %s ." "$url"
|
|
|
|
dig A "$1" >/dev/null
|
|
|
|
printf "."
|
|
|
|
result=$(curl -LsSfv --connect-timeout 30 --retry 3 "$url" 2>&1)
|
|
|
|
code="$?"
|
|
|
|
printf ".\n"
|
|
|
|
#shellcheck disable=SC2181
|
|
|
|
if [ "$code" = "0" ]
|
|
|
|
then
|
|
|
|
echo "... good"
|
|
|
|
else
|
|
|
|
services_down=$(printf "%s\n%s" "$services_down" "$1")
|
|
|
|
error=$(printf "%s\n==========\n%s:\n%s" "$error" "$1" "$result")
|
|
|
|
echo "... bad"
|
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
|
|
|
#check_url "acme.serguzim.me" "/health"
|
|
|
|
check_url "analytics.serguzim.me"
|
|
|
|
check_url "auth.serguzim.me"
|
|
|
|
check_url "ci.serguzim.me"
|
|
|
|
#check_url "cloud.serguzim.me" "/login?noredir=1"
|
|
|
|
check_url "git.serguzim.me"
|
|
|
|
check_url "hook.serguzim.me"
|
|
|
|
check_url "mail.serguzim.me"
|
|
|
|
#check_url "msrg.cc" # disabled because it keeps creating false alerts
|
|
|
|
check_url "rss.serguzim.me"
|
|
|
|
#check_url "serguzim.me" # disabled because it keeps creating false alerts
|
2024-10-07 19:17:35 +00:00
|
|
|
#check_url "status.serguzim.me" "/status/serguzim-net"
|
2024-09-26 22:02:36 +00:00
|
|
|
check_url "tick.serguzim.me"
|
|
|
|
check_url "wiki.serguzim.me"
|
|
|
|
check_url "www.reitanlage-oranienburg.de"
|
|
|
|
|
|
|
|
if [ "$error" = "" ]
|
|
|
|
then
|
2024-10-06 18:47:59 +00:00
|
|
|
curl_hc "$HTTP_HC_URL" >/dev/null
|
2024-09-26 22:02:36 +00:00
|
|
|
echo "ALL GOOD"
|
|
|
|
else
|
2024-10-06 18:47:59 +00:00
|
|
|
curl_hc --data-raw "$services_down$error" "$HTTP_HC_URL/fail" >/dev/null
|
2024-09-26 22:02:36 +00:00
|
|
|
fi
|