check_curl: fix "echo: write error: Broken pipe"
This commit is contained in:
parent
9ffe697ba8
commit
35d75853ec
|
@ -16,7 +16,7 @@ usage() {
|
||||||
-t Timeout in seconds
|
-t Timeout in seconds
|
||||||
-s Ignore the response status code.
|
-s Ignore the response status code.
|
||||||
-e Specify the exact response code that should be returned. Cannot be used with -s option.
|
-e Specify the exact response code that should be returned. Cannot be used with -s option.
|
||||||
-S Sanitize HTML when printing to console. Good for Icinga2 Web.
|
-S Sanitize HTML when printing to console. Good for Icinga2 Web. (not functional)
|
||||||
-n Don't return any perfdata if the status code was not 200.
|
-n Don't return any perfdata if the status code was not 200.
|
||||||
-a Specify the username and password for authentication in the format username:password"
|
-a Specify the username and password for authentication in the format username:password"
|
||||||
exit 3
|
exit 3
|
||||||
|
@ -443,16 +443,16 @@ fi
|
||||||
BODY_CONTAINS=""
|
BODY_CONTAINS=""
|
||||||
if [ -n "$CRIT_STRING" ]; then
|
if [ -n "$CRIT_STRING" ]; then
|
||||||
BODY=$(curl -s $FOLLOW_REDIRECTS $INSECURE $HEADERS $RESOLVE $TIMEOUT $AUTHENTICATION "$URL")
|
BODY=$(curl -s $FOLLOW_REDIRECTS $INSECURE $HEADERS $RESOLVE $TIMEOUT $AUTHENTICATION "$URL")
|
||||||
if ! echo "$BODY" | grep -Fq "$CRIT_STRING"; then
|
if ! grep -Fq "$CRIT_STRING" <<< "$BODY"; then
|
||||||
if $SANITIZE_HTML; then
|
# if $SANITIZE_HTML; then
|
||||||
BODY=$(echo "$BODY" | sed 's/</\</g' | sed 's/>/\>/g')
|
# BODY=$(echo "$BODY" | sed 's/</\</g' | sed 's/>/\>/g')
|
||||||
fi
|
# fi
|
||||||
CRIT_STRING_MSG="response body does not contain the required string"
|
CRIT_STRING_MSG="response body does not contain the required string"
|
||||||
ERROR_MSG="${ERROR_MSG}${CRIT_STRING_MSG}; "
|
ERROR_MSG="${ERROR_MSG}${CRIT_STRING_MSG}; "
|
||||||
EXIT_CODE=2
|
EXIT_CODE=2
|
||||||
else
|
else
|
||||||
BODY_CONTAINS=", and contained substring"
|
BODY_CONTAINS=", and contained substring"
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Prepare perfdata_str
|
# Prepare perfdata_str
|
||||||
|
|
Loading…
Reference in New Issue