Skip to content

Nagios Plugin check_container

Davide Madrisan edited this page Apr 10, 2024 · 1 revision

check_container - this plugin returns some runtime metrics exposed by Docker

[/etc/nrpe.d/check_container]
command[check_container]=/usr/lib/nagios/plugins/check_container
Usage note
This plugin returns some runtime metrics exposed by Docker
Copyright (C) 2018,2024 Davide Madrisan <[email protected]>
Usage:
  check_container --socket SOCKET [--image IMAGE] [-w COUNTER] [-c COUNTER]
Options:
  -i, --image IMAGE   limit the investigation only to the containers running IMAGE
  -M, --memory    check memory utilisation for running containers
  -s, --socket SOCKET   the path of the docker or podman socket, usually
                        /var/run/docker.sock and /run/podman/podman.sock
  -k,-m,-g     show output in kB (the default), MB, or GB
  -w, --warning COUNTER    warning threshold
  -c, --critical COUNTER   critical threshold
  -v, --verbose   show details for command-line debugging (Nagios may truncate output)
  -h, --help      display this help and exit
  -V, --version   output version information and exit
  delay is the delay between updates in seconds (default: 1sec)
  if no socket is specified, the value of the DOCKER_HOST environment variable will be used
Examples:
  export DOCKER_HOST="/var/run/docker.sock"
  check_container --socket /run/user/1000/podman/podman.sock
  check_container -w 100 -c 120
Example of output
> /usr/lib/nagios/plugins/check_container
container containers OK: 4 running container(s)
Performance data

containers_<container-name>=<running-instances> [...]