There are multiple monitoring utilities. If you are looking to monitor Windows Server, Microsoft has it build right into System Center Operation Manager and Server 2012. For detailed performance monitoring of Windows Servers this is the right choice. But more likely you want monitor not only Windows but other platforms like Linux Servers, routers, switches etc. In this article we take a look at Icinga 2, an open source monitoring system.

Icinga used to be a fork of the Nagios project. It has now been totally rewritten (in C#) and has a nice dashboard (Icinga web 2). Icinga works with all the Nagios monitoring plug-ins and is generally much easier to implement. The documentation can be a little cumbersome though. The basis is a single master which communicates with the agent which is locally installed on the server. The Icinga master server communicates (encrypted) through port 5565 with the agent. There are agents available on multiple platforms (https://www.icinga.com/download).

The master can only be installed on a linux- or freebsd based system. The installation is fairly straightforward. Let’s do it now.

Package Repositories

First we need to add the icinga repository to the system. I will be using Ubuntu Xenial Xerus 16.04. Make sure you’re root for the whole tutorial.

Install Icinga2

Installation of Icinga is quite simple, we can use apt-get (or yum if you have Centos).

Icinga has a number of features. Only three are enabled by default. You can see what is enabled with this command:

Installing monitoring plugins

Icinga uses different monitoring tools from Nagios. Icinga needs these to check external services (disks pace, CPU utilization). Installation is also not that hard:

Install Dashboard

Icinga comes with a nice dashboard which runs on a webserver and is written in PHP. The latest version works well with PHP 7. It’s called Icinga Web 2. To take care of exporting all configuration and status information into a database, the DB IDO module for MySQL or PostgresSQL is used. I will use MySQL. First we have to install it:

During the installation you will be asked to enter a root password. Remember this password. You will need it later!

Now install the DB ISO module for MySQL by using this command:

During setup you tell that Icinga wil use MySQL it then creates the database for you.

New function. Let setup create the initial database Ininga2 for you.

Now that the DB and MySQL IDO modules are installed we need to enable them in icinga2

Make sure ido-mysql.conf is present in: /etc/icinga2/features-available/

If everything looks good, you can enable IDO with:

Icinga 2 web needs a webserver. I use apache + php 7. We need to install it:

Install IcingaWeb2

It is now time to install Incinga Web 2. We use this command:

With the Icinga Webserver 2 you can directly sends command’s to the Icinga Deamon, e.g. update the host. We need enable the command feature first:

There is the issue of permissions. By default the command file is owned by the group icingaweb2. First we need to make sure that this group is installed and then we need to add the webserver (www-data on Ubuntu / www on freebsd) to this group.

Configure dashboard (Icinga Webserver 2)

You can now use the setup wizard from Icinga2 web to continue. You can find the website on:

http://ip of your server/icingaweb2/setup

You need a token to continue:

Paste it into the setup and click next.

Select the desired modules and click next.

The next screen list the requirements needed for the Icinga Webserver 2. We see that one isn’t met. Let’s fix that.

Hit refresh down on the bottom to reload the requirements.

If you have some module (like LDAP) not installed. You can add them via:

Create new database for authentication (users) within Icinga Webserver 2

Chose a new database name, setup will create it for you.

Because setup wants to create a new database it needs root privileges (or at least add/grant priveleges). Use the password you entered during the setup of MySQL earlier.

Chose an appropriate name for the backend.

Create administrator account for managing the server.

I highly recommended using the MySQL database for the application configuration. Just click next.

We have completed the setup of the Icinga Webserver 2. Click finish.

Now we start part 2: configuring the monitoring module. As I stated earlier Icinga uses the IDO module for MySQL to store all monitoring and status information.

Click next to begin.

Enter an appropriate backend name and select IDO.

This is the IDO resource we created earlier during installation of the IDO module. Make sure you use the right credentials. You can find it here: /etc/icinga2/features-available/ido-mysql.conf

Leave this as it is and press next.

The default security is fine, press next.

We now have installed the dashboard. Press finish!

We can now log in the dashboard by using the admin credentials we created earlier.

We see that the dashboard is installed and the master itself is included. We can see it’s marked critical. Upon inspection we see that there are 110 packages that needs to be updated.

Let do that now:

After installation the critical warning is gone. Sweet!

In the next part we are going to look a bit further in the configuration of the Icinga master and we add a Linux host to be monitored.