CHECK_DOCKERCONTAINER_TOP

Script: check_dockercontainer_top

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
icingaclient ALL=(ALL) NOPASSWD:SETENV: /usr/bin/docker

Standalone installation

From this repository ypu need next to this script:

  • inc_pluginfunctions shared function for all IML checks written in bash
  • inc_dockerfunctions.sh

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

______________________________________________________________________

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

TODO