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
|
||||
-s Ignore the response status code.
|
||||
-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.
|
||||
-a Specify the username and password for authentication in the format username:password"
|
||||
exit 3
|
||||
|
@ -443,16 +443,16 @@ fi
|
|||
BODY_CONTAINS=""
|
||||
if [ -n "$CRIT_STRING" ]; then
|
||||
BODY=$(curl -s $FOLLOW_REDIRECTS $INSECURE $HEADERS $RESOLVE $TIMEOUT $AUTHENTICATION "$URL")
|
||||
if ! echo "$BODY" | grep -Fq "$CRIT_STRING"; then
|
||||
if $SANITIZE_HTML; then
|
||||
BODY=$(echo "$BODY" | sed 's/</\</g' | sed 's/>/\>/g')
|
||||
fi
|
||||
CRIT_STRING_MSG="response body does not contain the required string"
|
||||
ERROR_MSG="${ERROR_MSG}${CRIT_STRING_MSG}; "
|
||||
EXIT_CODE=2
|
||||
else
|
||||
BODY_CONTAINS=", and contained substring"
|
||||
fi
|
||||
if ! grep -Fq "$CRIT_STRING" <<< "$BODY"; then
|
||||
# if $SANITIZE_HTML; then
|
||||
# BODY=$(echo "$BODY" | sed 's/</\</g' | sed 's/>/\>/g')
|
||||
# fi
|
||||
CRIT_STRING_MSG="response body does not contain the required string"
|
||||
ERROR_MSG="${ERROR_MSG}${CRIT_STRING_MSG}; "
|
||||
EXIT_CODE=2
|
||||
else
|
||||
BODY_CONTAINS=", and contained substring"
|
||||
fi
|
||||
fi
|
||||
|
||||
# Prepare perfdata_str
|
||||
|
|
Loading…
Reference in New Issue