Skip to content
Snippets Groups Projects
Commit 50bac1a3 authored by Hahn Axel (hahn)'s avatar Hahn Axel (hahn)
Browse files

check_http: update output

parent 72c450dc
No related branches found
No related tags found
1 merge request!168check_http: update output
......@@ -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
......
......@@ -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"
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment