For this installation I won’t use puppet, because I really want to focus on a real setup for Ubuntu 16.04. The goal is to setup icinga2, icinga web, icinga director and to monitor a few hosts.

You’ll need to have a hostname for your server. If you are using vagrant, don’t use the default machine and create a specific machine with a name, to have a valid hostname.

Add icinga repository:

wget -O - http://packages.icinga.com/icinga.key | apt-key add -
add-apt-repository 'deb http://packages.icinga.org/ubuntu icinga-xenial main'
apt-get update

Install icinga2:

apt-get install \
 icinga2 \
 monitoring-plugins \
 nagios-plugins-contrib

Install icinga Web

apt-get install \
 mysql-server \
 mysql-client \
 icinga2-ido-mysql \
 icingaweb2 \
 php-curl

MySQL install and ido-mysql has interactive parts.

  • Set root password: Set the password that you want for mysql root user.
  • enable ido-mysql: yes
  • setup ido-mysql database: yes
  • Set password for icinga2-ido-mysql: Set your own password

Icingaweb2 package will automatically install apache,php and all needed dependencies. It also setup a an alias to access web interface, but don’t work because Ubuntu 16.04 dont’t enable PHP by default. Just enable it:

a2enconf php7.0-fpm
service apache2 reload

Also need a timezone defined into PHP. Edit /etc/php/7.0/fpm/php.ini:

date.timezone = UTC

Also seems that icinga is not really enabling ido-mysql nor command. Check and do it:

icinga2 feature list
icinga2 feature enable ido-mysql
icinga2 feature enable command
icinga2 api setup
service icinga2 restart

Now lets configure icingaweb:

icingacli setup config directory --group icingaweb2;
icingacli setup token create;

From that you’ll get a setup token that you can use to begin config in http://icinga_ip/icingaweb2/setup Wizard will ask for the setup key and check requirements. After that wou’ll configure the database. This database it’s a new one, not the same as ido-mysql. I’ll name it icingaweb, with username icingaweb. Wizard will ask for a password to setup. You can use the previous defined mysql root user password.

After that pres next, next to setup ido. Now yes, it’s asking for mysql-ido credentials that you previously set. Database name and user is icinga2.

Now everything is next, next and everything is up and running. Now you can login.

You’ll see that icinga automatically enabled monitoring for its own host.

Now let’s setup icinga director to add new hosts.

Setup the needed database:

mysql -e "CREATE DATABASE director CHARACTER SET 'utf8';
   GRANT ALL ON director.* TO [email protected] IDENTIFIED BY 'some-password';"

Download module:

wget https://github.com/Icinga/icingaweb2-module-director/archive/master.zip
unzip master.zip
mv icingaweb2-module-director-master /usr/share/icingaweb2/modules/director

Configure database resource that you created Configuration -> Application -> Resources -> Create New Resource. Resource name, database name and user name is director. It’s important to set character set to utf8

Now enable director Configuration -> Modules -> director -> State -> Enable. Then in Module configuration set the created resource director and click Create Database schema.

Now you are in the Kickstart director wizard. Your endpoint is actually the hostname of the machine where you are. Your api user is root an the password is located in /etc/icinga2/conf.d/api-users.conf

Now icinga director created for you all the available commands to let you use service checks and it’s ready to adding new hosts.

Note that you can’t actually manage icinga host within icinga director and you will only be able to add new hosts.

To add a new host you have to create a template first. Let’s create a linux template. I’ll start with a detailed monitoring host: Hostname: linux Check command: ping Check interval: 1 Retry interval: 1 Max check attempts: 3

Now you can create new hosts by setting a hostname and host address. I’ve added my High Availability infrastructure.

And set up a business process with business process plugin to show how it’s working:

icinga-business-process-ok

Here you can see that I’ve configured the process to tell the system that to be working, needs at least one web server, a nfs and a balancer. In this case a web server is down, but the web still works.

icinga-business-process-not-ok

In the other case the web doesn’t work and you can clearly see that it’s because there are no web servers working.