Translation(s): English - Fran├žais



Icinga2 - Installation and configuration

Documentation overview

The purpose of this documentation is to accompagn you for the installation and configuration of this features:

This documentation is writen and testing for the following Debian versions:

Installation

Packages installation

Firstly, we need to update the packages list and install the required packages.

Update packages list:

apt update

Packages installation ( for Debian 10 ):

DEBIAN_FRONTEND=noninteractive apt-get -y install \
icinga2                \
icingacli              \
icingaweb2             \
icinga2-ido-mysql      \
mariadb-client         \
monitoring-plugins     \
apache2                \
libapache2-mod-rpaf    \
php-fpm                \
curl                   \
vim-icinga2            \
vim-addon-manager      \
nagios-nrpe-plugin     \
unscd                  \
nagios-plugins-contrib \
unattended-upgrades

Packages notes:

PHP-FPM activation

PHP-FPM is a FastCGI Process Manager wich allow communication between Apache2 server and PHP. It's an alternative to traditional PHP FastCGI implementation mostly useful for heavily loaded web servers.

Pour Debian 9:

a2enmod proxy_fcgi setenvif
a2enconf php7.3-fpm
apache2ctl configtest
systemctl restart php7.3-fpm.service
systemctl restart apache2.service

Icinga syntax highlighting for Vim

If you use vim to edit your configurations files, you can easily enable syntax highlighting as following:

vim-addon-manager -w install icinga2

Create Apache2 virtual host for Icinga

WARNING! This virtual host is not securised (listen on HTTP and not on HTTPS). If incomming connexions is wanted, we recommand you to setup this vHost on HTTPS. By example, you can see LetsEncrypt.

Before, you need to set the following variables. You must change the values:

FQDN="icinga.example.com"
EMAIL="me@example.com"

Now you can copy/past the following lines to create the /etc/apache2/sites-available/icinga.conf file.

cat << EOF > /etc/apache2/sites-available/icinga.conf
<VirtualHost *:80>

    ServerName $FQDN
    ServerAdmin $EMAIL

    DocumentRoot "/usr/share/icingaweb2/public"

    <Directory "/usr/share/icingaweb2/public">
        Options SymLinksIfOwnerMatch
        AllowOverride None

        <IfModule mod_authz_core.c>
            # Apache 2.4
            <RequireAll>
                Require all granted
            </RequireAll>
        </IfModule>

        SetEnv ICINGAWEB_CONFIGDIR "/etc/icingaweb2"

        EnableSendfile Off

        <IfModule mod_rewrite.c>
            RewriteEngine on
            # RewriteBase /icingaweb2/
            RewriteBase /
            RewriteCond %{REQUEST_FILENAME} -s [OR]
            RewriteCond %{REQUEST_FILENAME} -l [OR]
            RewriteCond %{REQUEST_FILENAME} -d
            RewriteRule ^.*$ - [NC,L]
            RewriteRule ^.*$ index.php [NC,L]
        </IfModule>

        <IfModule !mod_rewrite.c>
            DirectoryIndex error_norewrite.html
            ErrorDocument 404 /error_norewrite.html
        </IfModule>
    </Directory>

    ErrorLog  /var/log/apache2/icinga-error.log
    CustomLog /var/log/apache2/icinga-access.log combined

</VirtualHost>
EOF

Now you can enable the Icinga virtual host on Apache2, test the configuration and reload Apache2

a2ensite icinga.conf
apache2ctl configtest
systemctl reload apache2

Enable Icinga features and modules

icinga2 feature enable command ido-mysql
icingacli module enable monitoring

Troubleshooting

List of useful directories:

Others Wiki pages