Skip to content
Snippets Groups Projects

Docker checks

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

Files

+ 10
5
@@ -13,13 +13,14 @@
# https://docs.docker.com/engine/reference/commandline/docker/
# ----------------------------------------------------------------------
# 2024-01-26 v1.0 <axel.hahn@unibe.ch> init
# 2024-01-29 v1.1 <axel.hahn@unibe.ch> fix help;
# ======================================================================
. $(dirname $0)/inc_pluginfunctions
. $(dirname $0)/inc_dockerfunctions.sh
self_APPVERSION=1.0
self_APPVERSION=1.1
# ----------------------------------------------------------------------
# FUNCTIONS
@@ -48,8 +49,12 @@ USAGE:
$_self [OPTIONS]
OPTIONS:
General:
-h, --help this help
-d, --debug Debug; Flag: show all docker system infos
-d, --debug Debug; Flag: show docker env values.
Connect to docker:
-p, --path Custom directory for docker binary
-t, --target Custom docker target; value for DOCKER_HOST
Needed only if Docker does not run on a unix socket or
@@ -91,7 +96,7 @@ while [[ "$#" -gt 0 ]]; do case $1 in
fi
shift; shift;;
-t|--target) export DOCKER_HOST="$2"; shift; shift;;
*) echo "ERROR: Unknown parameter: $1"; showHelp; exit 1;
*) echo "ERROR: Unknown parameter: $1"; _showHelp; exit 1;
esac; done
ph.require "docker"
@@ -108,7 +113,7 @@ _detectDockererror "$data"
out=$(
echo "$data" | while read -r line; do
id=$( echo "$line" | jq -r ".ID")
id=$( echo "$line" | jq -r ".ID")
name=$( echo "$line" | jq -r ".Names")
pslist=$( sudo -n --preserve-env docker top "$id" "-o user,pid,pcpu,pmem,command" 2>/dev/null )
@@ -121,7 +126,7 @@ done
typeset -i iContainers; iContainers=$( echo "$data" | wc -l )
typeset -i iLines; iLines=$( echo "$out" | wc -l )
typeset -i iProcesses; iProcesses=iLines-iContainers*2
typeset -i iProcesses; iProcesses=$(( iLines-iContainers*2 ))
# --- output
Loading