Skip to content
Snippets Groups Projects

check_http update jq handling

Merged Hahn Axel (hahn) requested to merge add-systemdunit into master
1 file
+ 10
1
Compare changes
  • Side-by-side
  • Inline
+ 10
1
@@ -115,6 +115,7 @@ sLabel=$( ph.getValueWithParam "" l "$@")
curlParams+=" -si -X $sMethod --connect-timeout 10"
sProblems=
sInfos=
sOK=
if [ -z "$sUrl" ]; then
@@ -136,6 +137,13 @@ else
if [ -n "$sJq" ]; then
_body=$( jq "$sJq" <<< "$_body" 2>/dev/null )
if [ -z "$_body" ]; then
ph.setStatus critical
sProblems+="- jq filter [$sJq] was applied and resulted in an empty result.\n"
else
sInfos+="- jq filter [$sJq] was applied.\n"
sInfos+="${_body}"
fi
fi
# --- test status
@@ -205,6 +213,7 @@ fi
# --- output
test -n "$sProblems" && sProblems="Problems:\n$sProblems\n"
test -n "$sOK" && sOK="Found:\n$sOK"
test -n "$sInfos" && sInfos="\nHints:\n$sInfos"
test -n "$sLabel" && (
ph.status "$sLabel"
@@ -213,7 +222,7 @@ test -n "$sLabel" && (
test -n "$sLabel" || ph.status "$sMethod $sUrl ($iHttpStatus)"
echo
echo -e "${sProblems}${sOK}"
echo -e "${sProblems}${sOK}${sInfos}"
test -n "${sProblems}" && (echo "RESPONSE HEADER:"; echo; echo "$_header")
Loading