diff --git a/check_http b/check_http index 4c038e2aab2f1b1826184526df1af8c59a2e7e7e..a48a2930c1987301e42231a4124a2100521c7a46 100755 --- a/check_http +++ b/check_http @@ -146,9 +146,9 @@ else else if [ "$_body" = "null" ]; then ph.setStatus critical - sProblems+="- jq filter [$sJq] does not match on responded JSON.\n" + sProblems+="- jq filter [$sJq] does not match on responded JSON\n" else - sOK+="- jq filter [$sJq] matches.\n" + sOK+="- jq filter [$sJq] matches\n" sInfos+="Content aufter jq filter: ${_body}" fi fi @@ -162,18 +162,18 @@ else # if ! grep -i "^HTTP/[0-9\.]* ${iStatus}" <<< "${_header}" >/dev/null; then if [ "$iHttpStatus" != "$iStatus" ]; then ph.setStatus critical - sProblems+="- Http status is not [${iStatus}] but [${iHttpStatus}];\n" + sProblems+="- Http status is not [${iStatus}] but [${iHttpStatus}]\n" else - sOK+="- Http status is [${iStatus}];\n" + sOK+="- Http status is [${iStatus}]\n" fi else if [ $iHttpStatus -ge 400 ]; then ph.setStatus critical - sProblems+="- Http status is an http error [${iHttpStatus}];\n" + sProblems+="- Http status is an http error [${iHttpStatus}]\n" elif [ $iHttpStatus -ge 300 ]; then - sOK+="- Http status is a 3xx redirect [${iHttpStatus}];\n" + sOK+="- Http status is a 3xx redirect [${iHttpStatus}]\n" else - sOK+="- Http status is a 2xx OK [${iHttpStatus}];\n" + sOK+="- Http status is a 2xx OK [${iHttpStatus}]\n" fi fi @@ -181,18 +181,18 @@ else if [ -n "$sHeader" ]; then if ! grep -iE "$sHeader" <<< "${_header}" >/dev/null; then ph.setStatus critical - sProblems+="- Header does not contain [${sHeader}];\n" + sProblems+="- Header does not contain [${sHeader}]\n" else - sOK+="- [${sHeader}] was found in header;\n" + sOK+="- [${sHeader}] was found in header\n" fi fi # --- search in http response header if [ -n "$sNotInHeader" ]; then if grep -iE "$sNotInHeader" <<< "${_header}" >/dev/null; then ph.setStatus critical - sProblems+="- Header does contain unwanted [${sNotInHeader}];\n" + sProblems+="- Header does contain unwanted [${sNotInHeader}]\n" else - sOK+="- [${sNotInHeader}] was not found in header;\n" + sOK+="- [${sNotInHeader}] was not found in header\n" fi fi @@ -200,18 +200,18 @@ else if [ -n "$sBody" ]; then if ! grep -iE "$sBody" <<< "${_body}" >/dev/null; then ph.setStatus critical - sProblems+="- Body does not contain [${sBody}];\n" + sProblems+="- Body does not contain [${sBody}]\n" else - sOK+="- [${sBody}] was found in body;\n" + sOK+="- [${sBody}] was found in body\n" fi fi if [ -n "$sNotInBody" ]; then if grep -iE "$sNotInBody" <<< "${_body}" >/dev/null; then ph.setStatus critical - sProblems+="- Body contains unwanted [${sNotInBody}];\n" + sProblems+="- Body contains unwanted [${sNotInBody}]\n" else - sOK+="- [${sNotInBody}] was not found in body;\n" + sOK+="- [${sNotInBody}] was not found in body\n" fi fi diff --git a/docs/20_Checks/check_http.md b/docs/20_Checks/check_http.md index 201cc712d6eff6b84035a7dffdc357f82f94d84b..395ad05f77fdf914259b282f6d33c3ce4d315547 100644 --- a/docs/20_Checks/check_http.md +++ b/docs/20_Checks/check_http.md @@ -103,7 +103,7 @@ OK: GET https://www.example.com/ (200) Command: curl -si -X GET https://www.example.com/ Found: -- Http status is a 2xx OK [200]; +- Http status is a 2xx OK [200] ``` ### Http HEAD of an url @@ -118,7 +118,7 @@ OK: HEAD https://www.example.com/ (200) Command: curl -si -X HEAD https://www.example.com/ Found: -- Http status is a 2xx OK [200]; +- Http status is a 2xx OK [200] ``` ### Exact status code @@ -170,9 +170,9 @@ This filter we put into the ``-j`` param: OK: GET https://keycloak.example.com:8443/health (200) Found: -- jq filter [.status] matches. -- Http status is a 2xx OK [200]; -- [UP] was found in body; +- jq filter [.status] matches +- Http status is a 2xx OK [200] +- [UP] was found in body Hints: Content aufter jq filter: "UP"