Opsview Knowledge Center

Application - Docker

An overview of the Application - Docker Opspack for Opsview Monitor

Since Opsview Monitor 4.6.3, we have supported the monitoring of Docker hosts and containers as standard. This ability is implemented as using a Host Template named 'Application - Docker' which should be applied to all hosts which have Docker installed (and an Opsview Monitor agent).

Before applying the 'Application - Docker' host template to your Docker hosts, follow the initial instructions below:

SystemD based hosts

Note: To enable the Docker API on SystemD, we had to modify the file, /lib/systemd/system/docker.service. Change the execute line to:
ExecStart=/usr/bin/docker -d -H 127.0.0.1:4243 -H unix:///var/run/docker.sock
This starts the daemon listening on port 4243 (Note that we are only listening on the loopback adapter, 127.0.0.1, as the API is not secure in this state).

Note: Docker 1.5+ update: After upgrading to the latest version (1.5.0) these settings were overwritten. After re-enabling them we had to run the command 'systemctl daemon-reload' to make them take effect.

Init script based hosts

For other Linux distributions you will need to modify the file, /etc/default/docker. Modify the DOCKER_OPTS line to:
DOCKER_OPTS="--dns 8.8.8.8 -H 127.0.0.1:4243 -H unix:///var/run/docker.sock"
Then, restart the docker service using "service docker restart" (or "/etc/init.d/docker restart" as necessary). These steps enable the plugin to connect and monitor Docker. We recommend only exposing docker on 127.0.0.1 for security purposes.

Installation

On the Docker host to be monitored:

  1. Install the perl LWP library - on Debian/Ubuntu use 'apt-get install libwww-perl', on CentOS/RHEL use 'yum install perl-libwww-perl'
  2. Install the Opsview Agent - see article
  3. Run the script '/usr/local/nagios/libexec/check_docker -h' - if you see an error "Can't locate JSON.pm in @INC" you also need to install the perl JSON library - see the file README on http://search.cpan.org/~makamaka/JSON-2.90/ for installation instructions. This will be included in a future version of the Opsview Agent.

Configuration

In the Opsview Monitor UI:

  1. Create a new host within "Menu => Settings => Host Settings" for your Docker host.
  2. Add the Host Template "OS - Opsview Agent"
  3. Add the Host Template "Application - Docker"
  4. For any specific containers you want monitored, on the 'Variables' tab add in 'DOCKER_CONTAINER' with a value set to the container name
  5. Submit Changes
  6. Perform a configuration reload within "Menu => Settings => Reload"

Application - Docker

An overview of the Application - Docker Opspack for Opsview Monitor