Add Icinga Director module using Icinga in Docker containers

Hello,

I have an issue: I have Icinga that runs on 4 Docker containers (icinga-web-pnp, icinga2-snmptrap, icinga2-core, mariadb) and my modules are:

company 0.0.0
cube 1.0.1
doc 2.6.2
map 1.1.0
monitoring 2.6.2
nagvis 1.1.1
pnp 1.1.0

My version on icinga Web 2 is 2.6.2

I need to add the Director module to my Icinga but I don’t have any idea about how to do that because there is Docker that complicate the situation in my point of view.

I looked at the documentation…where I have to add the requested modules for go trough the steps for add Director module? I have to add them to some container? How?

Thank You for the help

Giulia

Can you share the Dockerfiles? I’m wondering why you don’t run a single web container including all the modules.

Cheers from DevOpsDays,
Michael

Hi,

According to the Github source

So you need to enable the Director variable.

Cheers,
George

1 Like

Under /etc/icingaweb2/modules I have only “monitoring” and “translation”

How is the container icinga-core started?
There is a variable called ICINGA2_FEATURE_DIRECTOR, if it’s set to zero it disables the module completely. Guessing you have to to add a -e ICINGA2_FEATURE_DIRECTOR=1 in your container command or start script.

Cheers,
George

1 Like

I looked at the docker-compose.yaml and there is no mention to ICINGA2_FEATURE_DIRECTOR :disappointed_relieved:

Can we see the docker compose file? I am guessing it is not the one from Github.

version: “2”
services:
core:
image: NAMEOFTHECOMPANY/icinga2-core
env_file: ./secrets.env
links:
- sql
domainname: ${DOMAINNAME}
hostname: ${FIRSTNAME}-core
build:
context: ./core
ports:
- 5665:5665
volumes:
- ./${FIRSTNAME}-container/cache/icinga2:/var/cache/icinga2
- ./${FIRSTNAME}-container/etc/icinga2:/etc/icinga2
- ./${FIRSTNAME}-container/lib/icinga2:/var/lib/icinga2
- ./${FIRSTNAME}-container/contrib-plugins:/usr/lib/contrib-plugins
- ./${FIRSTNAME}-container/log/icinga2:/var/log/icinga2
- ./${FIRSTNAME}-container/run/icinga2:/var/run/icinga2
- ./${FIRSTNAME}-container/spool/icinga2:/var/spool/icinga2
- ./${FIRSTNAME}-container/etc/ssmtp:/etc/ssmtp
volumes_from:
- sql
sql:
image: mariadb
env_file: ./secrets.env
domainname: ${DOMAINNAME}
hostname: ${FIRSTNAME}-sql
volumes:
- ./${FIRSTNAME}-container/lib/mysql:/var/lib/mysql
web-pnp:
image: NAMEOFTHECOMPANY/icinga2-web-pnp
env_file: ./secrets.env
links:
- sql
- core
domainname: ${DOMAINNAME}
hostname: ${FIRSTNAME}-web-pnp
build:
context: ./web-pnp
ports:
- 80:80
volumes:
- ./${FIRSTNAME}-container/etc/icingaweb2:/etc/icingaweb2
- ./${FIRSTNAME}-container/webroot_icingaweb2:/usr/share/icingaweb2
- ./${FIRSTNAME}-container/webroot_nagvis:/usr/local/nagvis
- ./${FIRSTNAME}-container/lib/php5/sessions:/var/lib/php5/sessions
- ./${FIRSTNAME}-container/log/apache2:/var/log/apache2
- ./${FIRSTNAME}-container/certs:/etc/apache2/ssl:ro
- ./${FIRSTNAME}-container/perfdata:/var/lib/pnp4nagios/perfdata
- ./${FIRSTNAME}-container/etc/pnp4nagios:/etc/pnp4nagios
volumes_from:
- core
- sql
snmptrap:
image: NAMEOFTHECOMPANY/icinga2-snmptrap
env_file: ./secrets.env
links:
- core
domainname: ${DOMAINNAME}
hostname: ${FIRSTNAME}-snmptrap
build:
context: ./snmptrap
ports:
- 162:162/udp
volumes:
- ./${FIRSTNAME}-container/mibs:/mibs
volumes_from:
- core

This is the file…I don’t know where it comes from

Thank you for the help…

That is a heavily customized version of the original compose file. Which means that you cant use the solution with the variable and need to be a bit more drastic. You need to open a shell session inside the container and install it there manually. Since there is a special volume for modules

the Director installation should be persistent.

Download the director tar file in icinga-web-pnp-container/webroot_icingaweb2
The try running docker exec -it icinga-web-pnp bash (or similar) and go to /usr/share/icingaweb2 and follow the steps to complete the installation.
(Hope I got the container names right)

Cheers,
George

I only have to download the tar file? No other things? I ask because on the documentation seems like I need other modules…

Thank you
Giulia

Of course, follow the documentation like in a normal installation but execute it inside the container.

Ok thank you so much!

Giulia

Good luck! Maintaining and upgrading this installation will not be an easy task.
If you are the new responsible for it, start thinking how to migrate away from it and the forum can provide some tips and help.

Cheers,
George

2 Likes

Here is a Dockerfile I have written which we are using in production - happy to hear if anyone has any suggestions as I am relatively new to Docker - it runs nginx, php and supervisor acts as a process manager.

FROM centos:latest
RUN yum install epel-release centos-release-scl -y
RUN yum install https://packages.icinga.com/epel/icinga-rpm-release-7-latest.noarch.rpm -y
RUN yum install icingaweb2 icingacli icingaweb2-selinux -y
RUN useradd -r -g icingaweb2 -d /var/lib/icingadirector -s /bin/false icingadirector
RUN install -d -o icingadirector -g icingaweb2 -m 0750 /var/lib/icingadirector
RUN yum install nginx php php-fpm php-curl php-process php-pcntl php-sockets python-pip -y
RUN yum install rh-php71-php-posix rh-php71-php-soap rh-php71-php-cli -y
RUN pip install --upgrade pip
RUN pip install supervisor
CMD ["/usr/bin/supervisord", "-c", "/etc/supervisord.conf"]

We expose a few directories as volumes in our docker-compose.yml to ensure settings are persistent.

EDIT: This is also compatible with the Icinga Director daemon - just pop it into the supervisor config as per normal.

2 Likes