Table of Contents
CHECK_DOCKERCONTAINER_INFO
Script: check_dockercontainer_info
List existing containers and show container details. To show details you can enter an id or define a regex
⚠️ This script is more experimental.
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 you 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_INFO
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_info.html
______________________________________________________________________
List existing containers and show container details.
To show details you can enter an id or define a regex
USAGE:
check_dockercontainer_info [OPTIONS]
OPTIONS:
-h Show this help and exit.
-s Show containers using 'docker ps --all' and exit.
-i ID
Show details for container with given id.
-f REGEX
Show details for first matching container with given regex in output
of 'docker ps --all'.
If the options -i and -f are used then -i ID has priority.
PARAMETERS:
ID Hexadcimal value for the container id
REGEX String to filter the container list. With it you can set an image
name or a container name.
EXAMPLES:
check_dockercontainer_info -s
Show all containers
check_dockercontainer_info -i 0356f42ed27d
Show container details of container with id 0356f42ed27d
check_dockercontainer_info -f myapp
Show container details of first container that matches "myapp" in the
output of the container list.
Parameters
None.
Examples
Stats
$ ./check_dockercontaeiner_top
returns
TODO