From 426b0dc00553022ad70c868b4e45424b6ef6dc14 Mon Sep 17 00:00:00 2001
From: "Hahn Axel (hahn)" <axel.hahn@unibe.ch>
Date: Mon, 29 Jan 2024 09:42:36 +0100
Subject: [PATCH] update docs

---
 docs/20_Checks/check_docker_info.md         | 17 +++-
 docs/20_Checks/check_docker_stats.md        | 10 +--
 docs/20_Checks/check_dockercontainer_top.md | 99 +++++++++++++++++++++
 3 files changed, 117 insertions(+), 9 deletions(-)
 create mode 100644 docs/20_Checks/check_dockercontainer_top.md

diff --git a/docs/20_Checks/check_docker_info.md b/docs/20_Checks/check_docker_info.md
index 38fed82..b681971 100644
--- a/docs/20_Checks/check_docker_info.md
+++ b/docs/20_Checks/check_docker_info.md
@@ -37,7 +37,7 @@ If DOCKER_HOST is not set then the docker socket is detected from a running dock
 ______________________________________________________________________
 
 CHECK_DOCKER_INFO
-v1.3
+v1.4
 
 (c) Institute for Medical Education - University of Bern
 Licence: GNU GPL 3
@@ -49,7 +49,7 @@ Show docker version and count of containers total and by its status.
 
 It returns 
   CRITICAL if a created container is not running.
-  OK if no container was created yet or all conmtainers are running
+  OK if no container was created yet or all conmtainers are running.
   UNKNOWM if
     - docker or jq were not found
     - docker data were not fetched
@@ -61,11 +61,20 @@ USAGE:
   check_docker_info [OPTIONS]
 
 OPTIONS:
+
+  General:
   -h, --help        this help
-  -c, --containers  Flag: Show containers (slow)
-  -e, --errors      Flag: Show containers on error only (slow)
   -d, --debug       Debug; Flag: show all docker system infos
+
+  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
+                    multiple users run a rootless docker daemon.
+
+  Flags:
+  -c, --containers  Flag: Show containers (slow)
+  -e, --errors      Flag: Show containers on error only (slow)
 
 EXAMPLES:
   check_docker_info
diff --git a/docs/20_Checks/check_docker_stats.md b/docs/20_Checks/check_docker_stats.md
index 058eae8..2cd82d0 100644
--- a/docs/20_Checks/check_docker_stats.md
+++ b/docs/20_Checks/check_docker_stats.md
@@ -1,8 +1,8 @@
-# CHECK_DOCKER_INFO
+# CHECK_DOCKER_STATS
 
 ## Introduction
 
-**check_docker_stats** shows the docker status of containers.
+**check_docker_stats** shows the docker resources of containers.
 This check sends performance data.
 
 ## Requirements
@@ -37,7 +37,7 @@ If DOCKER_HOST is not set then the docker socket is detected from a running dock
 ______________________________________________________________________
 
 CHECK_DOCKER_STATS
-v1.0
+v1.1
 
 (c) Institute for Medical Education - University of Bern
 Licence: GNU GPL 3
@@ -56,7 +56,7 @@ 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
@@ -88,7 +88,7 @@ EXAMPLES:
     given path first - then in all other dirs of $PATH
 
   check_docker_stats -d
-    Show stats of all containers and json with all docker system infos.
+    Show stats of all containers and json with docker env infos.
 
   check_docker_stats -m cpu
     Show cpu usage total of all containers. The container list is sorted
diff --git a/docs/20_Checks/check_dockercontainer_top.md b/docs/20_Checks/check_dockercontainer_top.md
new file mode 100644
index 0000000..af3d9d9
--- /dev/null
+++ b/docs/20_Checks/check_dockercontainer_top.md
@@ -0,0 +1,99 @@
+# CHECK_DOCKERCONTAINER_TOP
+
+## Introduction
+
+**check_dockercontaeiner_top** shows the docker top output for each container.
+
+## Requirements
+
+* `docker` Docker must be installed
+* `jq` must be installed - commandline JSON processor
+* `bc` must be installed - an arbitrary precision calculator language
+* sudo permissions on docker command
+
+```txt
+icingaclient ALL=(ALL) NOPASSWD:SETENV: /usr/bin/docker
+```
+
+## Includes
+
+Additional needed files in the current folder that this check can run:
+
+* inc_dockerfunctions.sh
+* inc_pluginfunctions
+
+## Rootless docker
+
+It works with docker setups as root and can handle rootless docker instances.
+
+To bring it up and running with an unpriviledged icinga user it must be able to access docker. Copy the docker binary eg. from /home/dockeruser/bin/docker to /usr/bin/. Then use the parameter `-p /usr/bin`.
+
+If DOCKER_HOST is not set then the docker socket is detected from a running docker instance and will be fetched from the process list.
+
+## Syntax
+
+```txt
+______________________________________________________________________
+
+CHECK_DOCKERCONTAINER_TOP
+v1.1
+
+(c) Institute for Medical Education - University of Bern
+Licence: GNU GPL 3
+
+https://os-docs.iml.unibe.ch/icinga-checks/Checks/check_dockercontainer_top.html
+______________________________________________________________________
+
+Show counts and processes of docker containers.
+
+It returns 
+  CRITICAL if a created container is not running.
+  OK if no container was created yet or all conmtainers are running.
+  UNKNOWM if
+    - docker or jq were not found
+    - docker data were not fetched
+    - docker cannot be connected
+
+This check provides performance data.
+
+USAGE:
+  check_dockercontainer_top [OPTIONS]
+
+OPTIONS:
+
+  General:
+  -h, --help        this help
+  -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
+                    multiple users run a rootless docker daemon.
+
+EXAMPLES:
+  check_dockercontainer_top
+    Show processes of all containers
+
+  check_dockercontainer_top -p /usr/bin
+    Show processes of all containers. The docker binary will be searched in
+    given path first - then in all other dirs of $PATH
+
+  check_dockercontainer_top -d
+    Show processes of all containers and json with docker env infos.
+
+```
+
+### Parameters
+
+None.
+
+## Examples
+
+### Stats
+
+`$ ./check_dockercontaeiner_top` returns
+
+```txt
+TODO
+```
-- 
GitLab