This commit is contained in:
Cyberes 2024-03-30 21:27:07 -06:00
parent 2c014863db
commit 7c8dbd9099
1 changed files with 4 additions and 4 deletions

View File

@ -418,9 +418,9 @@ elif [ $(echo "$RESPONSE_TIME_MS > $WARN_TIME" | bc) -eq 1 ]; then
fi fi
# Check critical string # Check critical string
BODY_CONTAINS=" " BODY_CONTAINS=""
if [ -n "$CRIT_STRING" ]; then if [ -n "$CRIT_STRING" ]; then
BODY=$(curl -s $FOLLOW_REDIRECTS $INSECURE "$HEADERS" "$RESOLVE" "$TIMEOUT" "$URL") BODY=$(curl -s $FOLLOW_REDIRECTS $INSECURE "$HEADERS" $RESOLVE $TIMEOUT "$URL")
# shellcheck disable=SC2076 # shellcheck disable=SC2076
if ! [[ $BODY =~ "$CRIT_STRING" ]]; then if ! [[ $BODY =~ "$CRIT_STRING" ]]; then
if $SANITIZE_HTML; then if $SANITIZE_HTML; then
@ -429,7 +429,7 @@ if [ -n "$CRIT_STRING" ]; then
echo "CRITICAL - response body does not contain the required string: $BODY" echo "CRITICAL - response body does not contain the required string: $BODY"
exit 2 exit 2
else else
BODY_CONTAINS=" and contained substring " BODY_CONTAINS=" and contained substring"
fi fi
fi fi
@ -441,5 +441,5 @@ else
perfdata_str="| $perfdata" perfdata_str="| $perfdata"
fi fi
echo "OK - response time was $RESPONSE_TIME seconds, code $HTTP_CODE.${BODY_CONTAINS}-> $URL $perfdata_str" echo "OK - response time was $RESPONSE_TIME seconds, code $HTTP_CODE${BODY_CONTAINS}. $perfdata_str"
exit 0 exit 0