Public | Automated Build

Last pushed: 5 days ago
Short Description
icinga2 with icinga-web and icingaweb2
Full Description

icinga2

This repository contains the source for the icinga2 docker image.

The dockerhub-repository is located at https://hub.docker.com/r/jordan/icinga2/.

This build is automated by push for the git-repo. Just crawl it via:

docker pull jordan/icinga2

Image details

  1. Based on debian:jessie
  2. Key-Features:
    • icinga2
    • icingacli
    • icingaweb2
    • icingaweb2-director module
    • icingaweb2-graphite module
    • icingaweb2-module-aws
    • ssmtp
    • MySQL
    • Supervisor
    • Apache2
    • SSL Support
  3. No SSH. Use docker exec or nsenter
  4. If passwords are not supplied, they will be randomly generated and shown via stdout.

Usage

Start a new container and bind to host's port 80

docker run -p 80:80 -t jordan/icinga2:latest

Icinga Web 2

Icinga Web 2 can be accessed at http://localhost/icingaweb2 with the credentials icingaadmin:icinga (if not set differently via variables).

Saving PHP Sessions

If you want to save your php-sessions over multiple boots, mount /var/lib/php5/sessions/ into your container. Session files will get saved there.

example:

docker run [...] -v $PWD/icingaweb2-sessions:/var/lib/php5/sessions/ jordan/icinga2

Graphite

The graphite writer can be enabled by setting the ICINGA2_FEATURE_GRAPHITE variable to true or 1 and also supplying values for ICINGA2_FEATURE_GRAPHITE_HOST and ICINGA2_FEATURE_GRAPHITE_PORT. This container does not have graphite and the carbon daemons installed so ICINGA2_FEATURE_GRAPHITE_HOST should not be set to localhost.

Example:

docker run -t \
  --link graphite:graphite \
  -e ICINGA2_FEATURE_GRAPHITE=true \
  -e ICINGA2_FEATURE_GRAPHITE_HOST=graphite \
  -e ICINGA2_FEATURE_GRAPHITE_PORT=2003 \
  jordan/icinga2:latest

Icinga Director

The Icinga Director Icinga Web 2 module is installed and enabled by default. You can disable the automatic kickstart when the container starts by setting the DIRECTOR_KICKSTART variable to false. To customize the kickstart settings, modify the /etc/icingaweb2/modules/director/kickstart.ini.

Sending Notification Mails

The container has ssmtp installed, which forwards mails to a preconfigured static server.

You have to create the files ssmtp.conf for general configuration and revaliases (mapping from local Unix-user to mail-address).

# ssmtp.conf
root=<E-Mail address to use on>
mailhub=smtp.<YOUR_MAILBOX>:587
UseSTARTTLS=YES
AuthUser=<Username for authentication (mostly the complete e-Mail-address)>
AuthPass=<YOUR_PASSWORD>
FromLineOverride=NO

But be careful, ssmtp is not able to process special chars within the password correctly!

revaliases follows the format: Unix-user:e-Mail-address:server.
Therefore the e-Mail-address has to match the root's value in ssmtp.conf
Also server has to match mailhub from ssmtp.conf but without the port.

# revaliases
root:<VALUE_FROM_ROOT>:smtp.<YOUR_MAILBOX>
nagios:<VALUE_FROM_ROOT>:smtp.<YOUR_MAILBOX>
www-data:<VALUE_FROM_ROOT>:smtp.<YOUR_MAILBOX>

These files have to get mounted into the container. Add these flags to your docker run-command:

-v $(pwd)/revaliases:/etc/ssmtp/revaliases:ro
-v $(pwd)/ssmtp.conf:/etc/ssmtp/ssmtp.conf:ro

If you want to change the display-name of sender-address, you have to define the variable ICINGA2_USER_FULLNAME.

If this does not work, please ask your provider for the correct mail-settings or consider the ssmtp.conf(5)-manpage or Section "Reverse Aliases" on ssmtp(8).
Also you can debug your config, by executing inside your container ssmtp -v $address and pressing 2x Enter.
It will send an e-Mail to $address and give verbose log and all error-messages.

SSL Support

For enabling of SSL support, just add a volume to /etc/apache2/ssl, which contains these files:

  • icinga2.crt: The certificate file for apache
  • icinga2.key: The corresponding private key
  • icinga2.chain (optional): If a certificate chain is needed, add this file. Consult your CA-vendor for additional info.

For https-redirection or http/https dualstack consult APACHE2_HTTP env-variable.

Adding own modules

To use your own modules, you're able to install these into enabledModules-folder of your /etc/icingaweb2 volume.

Environment variables Reference

Environmental Variable Default Value Description
ICINGA_PASSWORD randomly generated MySQL password for icinga
ICINGAWEB2_PASSWORD randomly generated MySQL password for icingaweb2
DIRECTOR_PASSWORD randomly generated MySQL password for icinga director
IDO_PASSWORD randomly generated MySQL password for ido
DEBIAN_SYS_MAINT_PASSWORD randomly generated Password for debian-syst-maint account
ICINGA2_FEATURE_GRAPHITE false Set to true or 1 to enable graphite writer
ICINGA2_FEATURE_GRAPHITE_HOST graphite hostname or IP address where Carbon/Graphite daemon is running
ICINGA2_FEATURE_GRAPHITE_PORT 2003 Carbon port for graphite
ICINGA2_FEATURE_GRAPHITE_URL http://${ICINGA2_FEATURE_GRAPHITE_HOST} Web-URL for Graphite
ICINGA2_FEATURE_DIRECTOR true Set to false or 0 to disable icingaweb2 director
DIRECTOR_KICKSTART true Set to false to disable icingaweb2 director's auto kickstart at container startup. Value is only used, if icingaweb2 director is enabled.
ICINGAWEB2_ADMIN_USER icingaadmin Icingaweb2 Login User<br>After changing the username, you should also remove the old User in icingaweb2-> Configuration-> Authentication-> Users
ICINGAWEB2_ADMIN_PASS icinga Icingaweb2 Login Password
ICINGA2_USER_FULLNAME Icinga Sender's display-name for notification e-Mails
APACHE2_HTTP REDIRECT Variable is only active, if both SSL-certificate and SSL-key are in place. BOTH: Allow HTTP and https connections simulateously. REDIRECT: Rewrite HTTP-requests to HTTPS

Volume Reference

All these folders are configured and able to get mounted as volume. The bottom ones are not quite neccessary.

Volume ro/rw Description & Usage
/etc/apache2/ssl ro Mount optional SSL-Certificates (see SSL Support)
/etc/ssmtp/revaliases ro revaliases map (see Sending Notification Mails)
/etc/ssmtp/ssmtp.conf ro ssmtp configufation (see Sending Notification Mails)
/etc/icinga2 rw Icinga2 configuration folder
/etc/icingaweb2 rw Icingaweb2 configuration folder
/var/lib/mysql rw MySQL Database
/var/lib/icinga2 rw Icinga2 Data
/var/lib/php5/sessions/ rw Icingaweb2 PHP Session Files
/var/log/apache2 rw logfolder for apache2 (not neccessary)
/var/log/icinga2 rw logfolder for icinga2 (not neccessary)
/var/log/icingaweb2 rw logfolder for icingaweb2 (not neccessary)
/var/log/mysql rw logfolder for mysql (not neccessary)
/var/log/supervisor rw logfolder for supervisord (not neccessary)
/var/spool/icinga2 rw spool-folder for icinga2 (not neccessary)
/var/cache/icinga2 rw cache-folder for icinga2 (not neccessary)
Docker Pull Command
Owner
jordan
Source Repository

Comments (23)
jordan
6 months ago

Hi everyone,

If you have any issues, please open an issue on GitHub: https://github.com/jjethwa/icinga2

It's a lot easier to track there as Docker Hub does not send me notifications of comments.

aod7br
7 months ago

127.0.0.1 has invisible characters 127.<200b>0.0.<200b>1 in the configuration that raise an error on icinga comand :

/bin/ping -n -U -w 30 -c 5 127.​0.0.​1

wuran123
a year ago

hello,I have used the command" docker run -i -t docker.io/jordan/icinga2",but it can't into the images.why?

jordan
a year ago

Hi everyone,

If you have any issues, please open an issue on GitHub: https://github.com/jjethwa/icinga2

It's a lot easier to track there as Docker Hub does not send me notifications of comments.

sedlund
a year ago

How would one get this to run with Graphite?

fill32
2 years ago

^ + fix check now error:
https://dev.icinga.org/issues/10146

fill32
2 years ago

Hi jordan,

The 'icinga-web' UI gives me a blank page with some javascript error: Uncaught TypeError: Cannot read property 'MultiSelect' of undefined(anonymous function) @ javascript:46500
(index):61 Uncaught TypeError: Cannot read property 'search' of undefined(anonymous function) @ (index):61(anonymous function) @ (index):65
javascript:41838 Uncaught ReferenceError: Cronk is not defined.

But the 'icingaweb2' UI seems to run OK.

Btw, anyone encountered with errors when click 'Check now' refer to this for a fix :)

michaelherren
2 years ago

Hello

Sorry I am new to docker and Icinga2. I hope my question is not too sily. I've succeeded downloading the docker files and I can run it by executing sudo docker run j-p 80:80 -t jordan/icinga2:latest

It starts and the following output appears. But I am not able to connect to the website. Any hint?

Generating new private key and certificate for this container...done
=>Initializing databases and icinga2 configurations.
=>This may take a few minutes
[ ok ] Starting MySQL database server: mysqld .
.
[info] Checking for tables which need an upgrade, are corrupt or were

not closed cleanly..
[ ok ] Stopping MySQL database server: mysqld
.

===================================================================
MySQL user 'root' has no password but only allows local connections
MySQL user 'debian-sys-maint' password set to rioeVyuuUhqH848
MySQL user 'icinga' password set to 9SkAxyxMjkr5aaj
MySQL user 'icinga2-ido-mysq' password set to Z1pBjmiLfC4jkAq
MySQL user 'icinga-web' password set to ZbrQru9L4SsoyTv

MySQL user 'icingaweb2' password set to F9iKc8ONPDXFidL

Starting Supervisor. You can safely CTRL-C and the container will continue to r
un with or without the -d (daemon) option

talkwithmurtuza
2 years ago

Hi,

I am not able to login into icinga-web. It is showing incorrect password. Could you please help?

Thanks

jordan
2 years ago

For tracking purposes, zijam created an issue in git: https://github.com/jjethwa/icinga2/issues/2 Thank you, zijam! :)