check_curl
This commit is contained in:
parent
ecfa98e531
commit
cb12e17261
43
check_curl
43
check_curl
|
@ -86,10 +86,45 @@ fi
|
|||
RESPONSE=$(curl --output "$TMP_RESPONSE" -w "%{http_code}\n%{time_total}" $(echo "${HEADER_ARGS[@]}" | tr -s ' ') $FOLLOW_REDIRECTS $INSECURE $RESOLVE $URL 2>"$TMP_ERROR_LOG")
|
||||
|
||||
# shellcheck disable=SC2181
|
||||
if [ $? -ne 0 ]; then
|
||||
echo "CRITICAL: curl failed!"
|
||||
echo "Error log:"
|
||||
cat "$TMP_ERROR_LOG"
|
||||
status=$?
|
||||
if [ $status -ne 0 ]; then
|
||||
case $status in
|
||||
1)
|
||||
msg="CRITICAL: Unsupported protocol"
|
||||
;;
|
||||
3)
|
||||
msg="CRITICAL: Malformed URL"
|
||||
;;
|
||||
# 5)
|
||||
# msg="CRITICAL: Couldn't resolve proxy $proxy"
|
||||
# ;;
|
||||
6)
|
||||
msg="CRITICAL: Couldn't resolve host"
|
||||
;;
|
||||
# 7)
|
||||
# msg="CRITICAL: Couldn't connect to proxy $proxy"
|
||||
# ;;
|
||||
22)
|
||||
msg="CRITICAL: Server returned http code >= 400"
|
||||
;;
|
||||
52)
|
||||
msg="CRITICAL: Server returned empty response (52)"
|
||||
;;
|
||||
56)
|
||||
msg="CRITICAL: Failure recieving network data (56)"
|
||||
;;
|
||||
60)
|
||||
msg="CRITICAL: SSL/TLS connection problem (60)"
|
||||
;;
|
||||
*)
|
||||
echo "UNKNOWN: $status - $URL"
|
||||
exit 3
|
||||
;;
|
||||
esac
|
||||
|
||||
echo -e "$msg"
|
||||
# echo "Error log:"
|
||||
# cat "$TMP_ERROR_LOG"
|
||||
rm -rf "$TMP_ERROR_LOG"
|
||||
exit 2
|
||||
fi
|
||||
|
|
Loading…
Reference in New Issue