Install Icinga 2 on Debian 10 Buster

|
Last Updated:
|
|

In this guide, we are going to learn how to install Icinga 2 on Debian 10 Buster. Icinga 2 is an opensource monitoring solution that is used to monitor the availability of various network resources including host metrics such as system uptime, load, memory, disk free space, running processes, network services such as HTTP, SMTP, SNMP, SSH, etc. Icinga supports notification and can be configured to notify users of system/service outages and generates performance data for reporting.

Install Icinga 2 on Debian 10 Buster

Run system update

Run the command below to update your system packages.

apt update
apt upgrade

Install Icinga 2 APT Repository

Install the Icinga 2 repo signing key

apt install -y apt-transport-https wget gnupg
wget -O - https://packages.icinga.com/icinga.key | apt-key add 

Next, install Debian 10 Buster Icinga 2 repositories.

echo "deb https://packages.icinga.com/debian icinga-buster main" > /etc/apt/sources.list.d/icinga.list
echo "deb-src https://packages.icinga.com/debian icinga-buster main" >> /etc/apt/sources.list.d/icinga.list

Run system package update.

apt update

Install Icinga 2 on Debian 10 Buster

Now that Icinga 2 repos are in place, you can install it by running the command below;

apt install icinga2

Restart Icinga 2

During the installation, there are three main Icinga 2 features that are enabled;

  • checker for executing checks
  • notification for sending notifications
  • mainlog for writing the icinga2.log file

For the enablement of these features to take effect, you need to restart Icinga 2.

systemctl restart icinga2

To check the status of Icinga 2 service;

systemctl status icinga2
● icinga2.service - Icinga host/service/network monitoring system
   Loaded: loaded (/lib/systemd/system/icinga2.service; enabled; vendor preset: enabled)
  Drop-In: /etc/systemd/system/icinga2.service.d
           └─limits.conf
   Active: active (running) since Sat 2019-08-10 07:07:09 EDT; 1s ago
  Process: 12246 ExecStartPre=/usr/lib/icinga2/prepare-dirs /etc/default/icinga2 (code=exited, status=0/SUCCESS)
 Main PID: 12253 (icinga2)
    Tasks: 9
   Memory: 12.7M
   CGroup: /system.slice/icinga2.service
           ├─12253 /usr/lib/x86_64-linux-gnu/icinga2/sbin/icinga2 --no-stack-rlimit daemon --close-stdio -e /var/log/icinga2/error.log
           └─12285 /usr/lib/x86_64-linux-gnu/icinga2/sbin/icinga2 --no-stack-rlimit daemon --close-stdio -e /var/log/icinga2/error.log

Aug 10 07:07:09 icinga2.example.com icinga2[12253]: [2019-08-10 07:07:09 -0400] information/ScriptGlobal: Dumping variables to file '/var/cache/icinga2
Aug 10 07:07:09 icinga2.example.com icinga2[12253]: [2019-08-10 07:07:09 -0400] information/ConfigObject: Restoring program state from file '/var/lib/i
Aug 10 07:07:09 icinga2.example.com icinga2[12253]: [2019-08-10 07:07:09 -0400] information/ConfigObject: Restored 264 objects. Loaded 29 new objects w
Aug 10 07:07:09 icinga2.example.com icinga2[12253]: [2019-08-10 07:07:09 -0400] information/ConfigItem: Triggering Start signal for config items
Aug 10 07:07:09 icinga2.example.com icinga2[12253]: [2019-08-10 07:07:09 -0400] information/FileLogger: 'main-log' started.
Aug 10 07:07:09 icinga2.example.com icinga2[12253]: [2019-08-10 07:07:09 -0400] information/NotificationComponent: 'notification' started.
Aug 10 07:07:09 icinga2.example.com icinga2[12253]: [2019-08-10 07:07:09 -0400] information/CheckerComponent: 'checker' started.
Aug 10 07:07:09 icinga2.example.com icinga2[12253]: [2019-08-10 07:07:09 -0400] information/ConfigItem: Activated all objects.
Aug 10 07:07:09 icinga2.example.com icinga2[12253]: [2019-08-10 07:07:09 -0400] information/cli: Closing console log.
Aug 10 07:07:09 icinga2.example.com systemd[1]: Started Icinga host/service/network monitoring system.

Install Icinga 2 Monitoring Plugins

Icinga 2 requires monitoring plugins in order to  check external services. Run the command below to install Icinga 2 monitoring plugins.

apt install monitoring-plugins

Install and Configure Icinga 2 Backend Database

Install Icinga Data Output Database Backend

At the moment, IDO only supports MySQL and PostgreSQL database backends. In this guide, we are going to use MySQL as our database backend server.

Install MySQL Database

apt install mariadb-server mariadb-client

Perform the usual MySQL initial security to remove anonymous database users, test databases, disable remote root login using the mysql_secure_installation script.

Install IDO modules for MySQL

The package icinga2-ido-mysql provides IDO modules for MySQL and can be installed by running the command below;

apt install icinga2-ido-mysql

During installation, you are prompted to specify whether Icinga 2 should use MySQL. Select yes to enable this feature. To list enabled features, run the command;

icinga2 feature list

If ido-mysql feature is not enabled, you can enable it later from command line;

icinga2 feature enable ido-mysql

Restart Icinga 2.

systemctl restart icinga2

You are then prompted on whether to use the automated setup wizard to configure icinga2-ido-mysql. You can skip it by selecting No so that you can manually configure it.

Create MySQL database for Icinga 2

Login to MariaDB and create Icinga 2 database. If you have enabled MariaDB root password authentication, use the command mysql -u root -p otherwise login using mysql.

mysql -u root -p

Create Icinga 2 IDO database

create database icinga2db;

Create the Icinga 2 database user with all the privileges on Icinga 2 database created above.

grant all on icinga2db.* to icingaadmin@localhost identified by 'P@ssWORD';

Reload privileges tables and quit.

flush privileges;
quit

Import the Icinga 2 IDO schema

Once you have created the database, run the command below to import Icinga 2 IDO schema.

mysql -u root -p icinga2db < /usr/share/icinga2-ido-mysql/schema/mysql.sql

Next, open Icinga 2 MySQL IDO configuration file and set the Icinga2 database connection details.

vim /etc/icinga2/features-available/ido-mysql.conf
/**
 * The db_ido_mysql library implements IDO functionality
 * for MySQL.
 */

library "db_ido_mysql"

object IdoMysqlConnection "ido-mysql" {
  user = "icingaadmin",
  password = "P@ssWORD",
  host = "localhost",
  database = "icinga2db"
}

Save and quit the configuration file.

Restart Icinga 2 daemon

systemctl restart icinga2

The next step is to install Icinga Web 2 which provides the web management interface for Icinga 2. Follow the link to install Icinga Web 2 on Debian 10 Buster.

Install Icinga Web 2 on Debian 10 Buster

Related Tutorials;

How to Install Icinga 2 and Icinga Web 2 on Ubuntu 18.04 LTS

Install Nagios Core on Debian 10 Buster

Install Zabbix 4.x from Sources on Debian 10 Buster

Nagios SNMP Monitoring of Linux Hosts on AlienVault USM/OSSIM

How to install and configure AlienVault OSSIM 5.5 on VirtualBox

SUPPORT US VIA A VIRTUAL CUP OF COFFEE

We're passionate about sharing our knowledge and experiences with you through our blog. If you appreciate our efforts, consider buying us a virtual coffee. Your support keeps us motivated and enables us to continually improve, ensuring that we can provide you with the best content possible. Thank you for being a coffee-fueled champion of our work!

Photo of author
koromicha
I am the Co-founder of Kifarunix.com, Linux and the whole FOSS enthusiast, Linux System Admin and a Blue Teamer who loves to share technological tips and hacks with others as a way of sharing knowledge as: "In vain have you acquired knowledge if you have not imparted it to others".

2 thoughts on “Install Icinga 2 on Debian 10 Buster”

Leave a Comment