Skip to content
Snippets Groups Projects

Docker checks: add check for docker stats

Merged Hahn Axel (hahn) requested to merge docker-checks into master
2 files
+ 9
9
Compare changes
  • Side-by-side
  • Inline

Files

+ 4
6
@@ -28,14 +28,14 @@ _is_docker_detected=0
# param string json data
# param string jq filter
function _filterJson(){
echo "$1" | jq "$2"
echo "$1" | jq -r "$2"
}
# filter json data with jq (by expecting a single result) and remove quotes
# param string json data
# param string jq filter
function _getString(){
_filterJson "$1" "$2" | tr -d '"' | sed "s#^null\$##"
_filterJson "$1" "$2" | sed "s#^null\$##g"
}
# if DOCKER_HOST is not set we try to detect the user running "containerd"
@@ -74,12 +74,10 @@ function _detectDockererror(){
ph.exit
fi
local sSrvErrror;
sSrvErrror=$( _filterJson "$data" ".ServerErrors" )
if [ "$sSrvErrror" != "null" ] ; then
if grep '"ServerErrors"' <<<"$data" >/dev/null; then
ph.setStatus unknown
ph.status "Unable to connect to Docker:"
echo "$sSrvErrror" | grep "^ "
_filterJson "$data" ".ServerErrors" | grep "^ "
ph.exit
fi
Loading