check_curl: fix body contains

This commit is contained in:
Cyberes 2023-06-22 13:09:42 -06:00
parent 1c21029188
commit e792c43c09
1 changed files with 3 additions and 2 deletions

View File

@ -45,7 +45,7 @@ while getopts "u:w:c:C:LH:M:IpR:st:h" opt; do
CRIT_STRING="$OPTARG"
;;
L)
FOLLOW_REDIRECTS="--location"
FOLLOW_REDIRECTS="-L"
;;
I)
INSECURE="--insecure"
@ -397,7 +397,8 @@ fi
# Check critical string
if [ -n "$CRIT_STRING" ]; then
BODY=$(curl -s $FOLLOW_REDIRECTS $INSECURE $HEADERS $RESOLVE $TIMEOUT $URL)
if ! echo "$BODY" | grep -q "$CRIT_STRING"; then
if ! [[ $BODY =~ "$CRIT_STRING" ]]; then
# if ! echo "$BODY" | grep -q "$CRIT_STRING"; then
echo "CRITICAL - response body does not contain '$CRIT_STRING': $BODY"
exit 2
fi