|
|
@ -8,7 +8,7 @@ source $SCRIPTPATH/servers.private |
|
|
|
checkAllSites(){ |
|
|
|
checkAllSites(){ |
|
|
|
eval server=( \${$1[@]} ) |
|
|
|
eval server=( \${$1[@]} ) |
|
|
|
for site in ${server[@]}; do |
|
|
|
for site in ${server[@]}; do |
|
|
|
printf "%-35s | %s \n" "$site" "$(checkURL $site)" |
|
|
|
printf "%-35s | %s \n" "$site" "$(checkURL $site $1)" |
|
|
|
done |
|
|
|
done |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -19,11 +19,14 @@ checkRandomSite(){ |
|
|
|
random=$(( ( RANDOM % (${#server[@]} - 1) ) + 1 )) |
|
|
|
random=$(( ( RANDOM % (${#server[@]} - 1) ) + 1 )) |
|
|
|
urlToCheck=${server[$random]} |
|
|
|
urlToCheck=${server[$random]} |
|
|
|
echo $urlToCheck |
|
|
|
echo $urlToCheck |
|
|
|
echo $(checkURL $urlToCheck) |
|
|
|
echo $(checkURL $urlToCheck $1) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
checkURL(){ |
|
|
|
checkURL(){ |
|
|
|
responce=$(curl -s --head -w %{http_code} $1 -L -o /dev/null --connect-timeout 60) |
|
|
|
responce=$(curl -s --head -w %{http_code} $1 -L -o /dev/null --connect-timeout 10) |
|
|
|
|
|
|
|
if [ "$responce" != 200 ]; then |
|
|
|
|
|
|
|
pgrep -x dunst && notify-send -u critical "$1 is down" "<b>Server:</b> $2\n<b>Responce:</b> $responce" |
|
|
|
|
|
|
|
fi |
|
|
|
echo $responce |
|
|
|
echo $responce |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -39,6 +42,7 @@ if [ ! -z "$1" ]; then |
|
|
|
echo "#00FF00" |
|
|
|
echo "#00FF00" |
|
|
|
else |
|
|
|
else |
|
|
|
echo "#FF8000" |
|
|
|
echo "#FF8000" |
|
|
|
|
|
|
|
|
|
|
|
fi |
|
|
|
fi |
|
|
|
elif [ "$2" = "all" ]; then |
|
|
|
elif [ "$2" = "all" ]; then |
|
|
|
checkAllSites $1 |
|
|
|
checkAllSites $1 |
|
|
|