Install Icinga2 on Ubuntu 16.04

From ICO wiki
Revision as of 19:40, 11 November 2016 by Ebarrier (talk | contribs)
Jump to navigationJump to search

Author: Etienne Barrier

Last modified: 11.11.2016

Background

This tutorial shows how to install Icinga 2 on Ubuntu 16.04 LTS, using PostgreSQL (as for database) and Apache 2 (as for webserver).

This tutorial does NOT show: - how to install Icinga version 1 - how to install/configure databses other than PostgreSQP (for example MySQL, MariaDB, etc.) - how to install/configure webservers other than Apache2 (for example Nginx) - how to use Icinga2

It is assumed that you are already familiar with the basics of Linux command line terminal commands. But this tutorial is made so that you can copy paste the commands to your terminal.

Versions used in this tutorial: - Icinga 2 (version: r2.5.4-1) - Ubuntu 16.04.1 LTS (Xenial) - PostgreSQL (version: 9.5.2) - Apache 2 (version: 2.4.18) - Php (version 7.0)

Depending on the versions you use, the commands and/or the path shown in this tutorial might be different.

The version of Icinga used (version 2) is referred sometimes as “Icinga” or “Icinga 2” accross the tutorial.

This tutorial is based on the following tutorials: Official Icinga documentation [1] [2]

For any comments, please write to etienne(dot}barrier{at]itcollege[dot)ee.


What is Icinga?

Installation

Icinga is made of two parts - Icinga 2 and Icinga Web 2. The first one is the core of the software and the second is a web interface.

Install Icinga 2 core

Add Icinga's repository to the package management configuration.

$ add-apt-repository ppa:formorer/icinga $ apt update

Install Icinga 2 package.

$ apt install icinga2

Once done, check that Icinga is up and running

$ service icinga2 status

If it is not running, start it.

$ service icinga2 start

Make sure Icinga will start automatically on startup.

$ systemctl enable icinga2.service

Install plugins

Nagios plugins

To be able to check external services, Icinga needs monitoring plugins to know about them and to make sure they work properly. Available monitoring plugins are available on the Monitoring Plugins Project website. We install the main set of plugins that come from Nagios monitoring solution. Note that Icinga service runs as user and group called "Nagios" (for historical reasons).

$ apt install nagios-plugins

Vim and Nano configuration syntax highlighting

Icinga provides packages to highlight its configuration files using Nano and Vim utilities. The package for Nano is included by default when installinIcinga2. For Vim, do:

$ apt install vim-icinga2 vim-addon-manager $ vim-addon-manager -w install icinga2

Install and configure PostgreSQL databases

Icinga needs two databases to work: one main to store monitoring information and one to store all configuration and status information. The later is the DB IDO (Database Icinga Data Output) module.

Install PostgreSQL

Install PostgreSQL database system.

$ apt install postgresql

Install IDO module for PostgreSQL

The IDO module will create the IDO database for us, but it is possible to do it manually as well.

Install Icinga IDO module for PostgreSQL.

$ apt install icinga2-ido-pgsql

A wizard will start. Say "yes" to confirm to enable the IDO module for PostgreSql.

The wizard proposes us to create and configure the database for us. Unless you know what you are doing, choose “Yes”. It will create the IDO database and ask you a password for it. Note: the default user and name of this database is "Icinga2".

Create main PostgreSQL database

Create the main database for Icinga. First go to the /tmp directory because that is the default unix socket location for PostgreSQL.


$ cd /tmp