Skip to content

Running Adagios inside docker

Garðar Þorsteinsson edited this page Feb 4, 2018 · 9 revisions

Docker is a convenient way to start up and test a clean instance of adagios for testing purposes.

# To start up the latest stable version of adagios:
docker run -i -t palli/adagios-latest-stable

# Or the same, with the latest testing version:
docker create \ 
  --name=my-adagios \
  -p 80:80 \
  opinkerfi/adagios-rpm

docker development area

If you are developing a feature and want to see what it looks like in a clean environment. You can also start an Adagios instance that binds to pynag and adagios directories on your local server. The Docker image is maintained in a seperate repository https://github.com/opinkerfi/docker-adagios-git

Via docker run command

This docker command runs Adagios on http://localhost:8080 and MK Livestatus on 6557/tcp. The Adagios/Pynag code from github is accessable in your local ~/code directory so you can make any changes and then restart the container to see the progress of your work. Adagios uses MK Livestatus for communicating with Nagios and it is possible to communicate with Livestatus remotely on port 6557/tcp. Please see the guide below for more information on Livestatus communication.

docker run -it -p 8080:80 \
-p 6557:6557 \
-v ~/code/adagios:/opt/adagios \
-v ~/code/pynag:/opt/pynag \
-v ~/code/logs:/var/log/nagios \
--name adagios opinkerfi/adagios-git:latest

Via docker-compose

docker-compose up

where the contents of docker-compose.yml is similar to the example provided

version: '3.1'

services:
  adagios:
    image: opinkerfi/adagios-git:latest
    ports:
      - 8080:80
      - 6557:6557
    volumes:
      - ./adagios:/opt/adagios
      - ./pynag:/opt/pynag
      - ./logs:/var/log/nagios

volumes:
  adagios:
  pynag:
  logs:

Basic development environment setup via shell script

We have created a small script that you can use to setup the local development environment

cd ~/my/adagios/env/dev/folder # Folder that you want to keep the code for pynag and adagios
bash -c "$(curl -L https://raw.githubusercontent.com/opinkerfi/docker-adagios-git/master/setup_dev_env.sh)"

To access your Adagios development container, direct your browser to http://0.0.0.0:8080 Now do some changes with your Adagios or Pynag code inside your local volumes that you created before and restart your container.

docker-compose restart

When the container restarts it will install Adagios and Pynag from your local volumes. Your new code changes should now reflect on your Adagios developement container.

Working with Livestatus remotely

Get status information for all hosts with Livestatus

echo "GET hosts" | nc localhost 6557