Share on Social Media

Learn how to install Icinga2 on CentOS 8 with our step-by-step guide. Set up this powerful monitoring tool to efficiently manage and monitor your IT infrastructure. #centlinux #linux #icinga

What is Icinga2?

Icinga2 is an open-source monitoring system designed to track the performance and availability of various IT infrastructure components. It provides real-time monitoring, alerting, and reporting to help administrators ensure their systems are running smoothly. Key features of Icinga2 include:

  1. Scalable Monitoring: Capable of monitoring large and complex environments, from small networks to enterprise-level infrastructures.
  2. Flexible Configuration: Highly configurable with a powerful and flexible configuration language.
  3. Real-Time Alerts: Provides instant notifications through various channels (email, SMS, chat) to alert administrators of issues.
  4. Advanced Visualizations: Integrates with Icinga Web 2 and other tools to provide detailed dashboards and visualizations.
  5. Multi-Platform Support: Can monitor a wide range of devices and applications across different platforms.
  6. Extensibility: Supports numerous plugins and add-ons to extend its capabilities and integrate with other systems.

Icinga2 helps IT teams maintain the health and performance of their infrastructure by providing comprehensive monitoring and alerting solutions.

Being a fork of Nagios, Icinga has all the features of Nagios Core and it also has some additional features like modern Web 2.0 style user interface, database connectors (for MySQL, Oracle and PostgreSQL) and a REST API that lets System Administrators to integrate numerous extensions without complicated modifications.

Icinga developers also seek to reflect the community needs more closely by integrating patches more quickly.

Recommended Online Training: Learn Bash Shell in Linux for Beginners

745772 0021

Icinga2 vs Nagios

Icinga2 and Nagios are both popular open-source monitoring systems used to monitor the health and performance of IT infrastructure. Here’s a comparison of the two:

1. Origin and Development:

Nagios:

  • Nagios is one of the oldest monitoring tools, first released in 1999.
  • It has a large community and extensive documentation.
  • Development is slower, with fewer updates and features compared to newer tools.

Icinga2:

  • Icinga was forked from Nagios in 2009 to address limitations and enhance features.
  • Active and modern development, with frequent updates and new features.
  • Icinga 2 (the latest version) is a complete rewrite, offering improved performance and flexibility.

2. Configuration and Ease of Use:

Nagios:

  • Configuration is primarily file-based (text files) and can be complex.
  • Steeper learning curve, especially for large and dynamic environments.

Icinga2:

  • Configuration can be done via files or through the Icinga Director (a web-based configuration tool).
  • More user-friendly and easier to manage large configurations.
  • Better integration with modern configuration management tools.

3. Performance and Scalability:

Nagios:

  • Can face performance issues with large-scale deployments due to its older architecture.
  • Scalability can be challenging without significant tuning and optimization.

Icinga2:

  • Designed with performance and scalability in mind.
  • Better handling of large-scale environments with distributed monitoring capabilities.

4. Web Interface and Visualization:

Nagios:

  • Basic web interface with limited visualization options.
  • Various third-party addons are available to enhance the UI and reporting capabilities.

Icinga2:

  • Icinga Web 2 provides a modern, responsive, and highly customizable web interface.
  • Enhanced visualization and reporting features out-of-the-box.
  • Modular architecture allows easy extension with additional features.

5. Extensibility and Integrations:

Nagios:

  • Extensive plugin ecosystem, with thousands of plugins available for various monitoring tasks.
  • Integrates with many third-party tools but often requires manual configuration.

Icinga2:

  • Supports Nagios plugins, ensuring compatibility and a wide range of monitoring capabilities.
  • Easier integration with modern tools and platforms.
  • More built-in features and extensions available.

6. Community and Support:

Nagios:

  • Large and active community with a wealth of documentation, forums, and user-contributed plugins.
  • Commercial support is available through Nagios Enterprises.

Icinga2:

  • Growing and active community with comprehensive documentation and support forums.
  • Commercial support is available through various partners.

7. Licensing:

Nagios:

  • Open-source core (Nagios Core) with a variety of proprietary addons and commercial products.

Icinga2:

  • Completely open-source, including core and most of its modules.

Conclusion:

Both Icinga2 and Nagios are powerful monitoring tools, but they cater to slightly different needs. Nagios remains a reliable choice with a vast ecosystem and strong community support. However, Icinga offers a more modern and scalable solution with better ease of use, performance, and integration capabilities. The choice between the two often depends on specific requirements, existing infrastructure, and personal preference.

Environment Specification

In this article, we are writing a guide on how to install Icinga2 on CentOS 8 and we are also configuring MariaDB as backend data store for our Network Monitoring Server by means of IDO (Icinga Data Out) module.

We are using a CentOS 8 minimal installed virtual machine with following specification.

  • CPU – 3.4 Ghz (2 cores)
  • Memory – 2 GB
  • Storage – 20 GB
  • Operating System – CentOS 8.0
  • Hostname – icinga-2.recipes.com
  • IP Address – 192.168.116.206 /24

Instructions in this article are of advance level, if you are new to Linux world then we strongly recommend you to read Red Hat RHCSA 8 Cert Guide: EX200 (Certification Guide) (PAID LINK) by Pearson IT Certification. It will provides basic to intermediate knowledge about the RHEL (Red Hat Enterprise Linux) 8 or CentOS 8.

Installing EPEL Yum Repository

Connect with icinga-2.recipes.com server as root user by using an ssh tool.

Icinga2 requires Nagios Plugins, that are available in EPEL (Extra Packages for Enterprise Linux) yum repository, therefore we are installing EPEL yum repository.

# dnf install -y https://dl.fedoraproject.org/pub/epel/epel-release-latest-8.noarch.rpm

Install MariaDB Database Server on CentOS 8

We are installing MariaDB server to be used as the data store for Icinga2 server.

# dnf install -y @mariadb/server

Start and enable MariaDB service.

# systemctl enable --now mariadb.service
Created symlink /etc/systemd/system/mysql.service â /usr/lib/systemd/system/mariadb.service.
Created symlink /etc/systemd/system/mysqld.service â /usr/lib/systemd/system/mariadb.service.
Created symlink /etc/systemd/system/multi-user.target.wants/mariadb.service â /usr/lib/systemd/system/mariadb.service.

Configure MariaDB server and set root user password.

# mysql_secure_installation

NOTE: RUNNING ALL PARTS OF THIS SCRIPT IS RECOMMENDED FOR ALL MariaDB
      SERVERS IN PRODUCTION USE!  PLEASE READ EACH STEP CAREFULLY!

In order to log into MariaDB to secure it, we'll need the current
password for the root user.  If you've just installed MariaDB, and
you haven't set the root password yet, the password will be blank,
so you should just press enter here.

Enter current password for root (enter for none):
OK, successfully used password, moving on...

Setting the root password ensures that nobody can log into the MariaDB
root user without the proper authorisation.

Set root password? [Y/n] Y
New password:
Re-enter new password:
Password updated successfully!
Reloading privilege tables..
 ... Success!


By default, a MariaDB installation has an anonymous user, allowing anyone
to log into MariaDB without having to have a user account created for
them.  This is intended only for testing, and to make the installation
go a bit smoother.  You should remove them before moving into a
production environment.

Remove anonymous users? [Y/n] Y
 ... Success!

Normally, root should only be allowed to connect from 'localhost'.  This
ensures that someone cannot guess at the root password from the network.

Disallow root login remotely? [Y/n] Y
 ... Success!

By default, MariaDB comes with a database named 'test' that anyone can
access.  This is also intended only for testing, and should be removed
before moving into a production environment.

Remove test database and access to it? [Y/n] Y
 - Dropping test database...
 ... Success!
 - Removing privileges on test database...
 ... Success!

Reloading the privilege tables will ensure that all changes made so far
will take effect immediately.

Reload privilege tables now? [Y/n] Y
 ... Success!

Cleaning up...

All done!  If you've completed all of the above steps, your MariaDB
installation should now be secure.

Thanks for using MariaDB!

Install Icinga2 Yum Repository

Icinga2 rpms are provided within its own yum repository, therefore it is necessary to install their official yum repository, if we want to install this network monitoring software by using dnf command.

# dnf install -y https://packages.icinga.com/epel/icinga-rpm-release-8-latest.noarch.rpm

Build cache for newly installed yum repositories.

# dnf makecache
CentOS-8 - AppStream                            4.6 kB/s | 4.3 kB     00:00
CentOS-8 - Base                                 5.2 kB/s | 3.9 kB     00:00
CentOS-8 - Extras                               4.5 kB/s | 1.5 kB     00:00
ICINGA (stable release for epel)                 43 kB/s |  66 kB     00:01
Extra Packages for Enterprise Linux 8 - x86_64  5.1 kB/s | 9.9 kB     00:01
Metadata cache created.

Install Nagios Plugins on CentOS 8

For collection of different metrics, we need commands provided by the respective Nagios plugins.

Nagios Plugins are available in EPEL yum repository. Since, we have already installed EPEL, therefore, we can now easily install Nagios Plugins using dnf commands.

# dnf install -y nagios-plugins-{http,ping,disk,users,swap,procs,ssh,load}

There are thousands of Nagios Plugins are freely available, but we have only install Nagios plugins.

Install Icinga2 on CentOS 8

We have installed Icinga2 yum repository. Therefore, we can now install icinga2 software by using dnf command.

# dnf install -y icinga2 icinga2-selinux icinga2-ido-mysql vim-icinga2

Check Icinga2 installed features.

# icinga2 feature list
Disabled features: api command compatlog debuglog elasticsearch gelf graphite ido-mysql influxdb livestatus opentsdb perfdata statusdata syslog
Enabled features: checker mainlog notification

Configure Icinga2 IDO to use MariaDB Data Store

Connect with MariaDB server as root user to configure Icinga2 IDO.

# mysql -u root -p123
Welcome to the MariaDB monitor.  Commands end with ; or g.
Your MariaDB connection id is 16
Server version: 10.3.11-MariaDB MariaDB Server

Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.

Type 'help;' or 'h' for help. Type 'c' to clear the current input statement.

MariaDB [(none)]>

Create a MariaDB database for Icinga2 as follows.

MariaDB [(none)]> CREATE DATABASE icinga;
Query OK, 1 row affected (0.073 sec)

Create a user for Icinga2 and grant complete privileges on icinga database.

MariaDB [(none)]> GRANT ALL PRIVILEGES ON icinga.* TO 'icinga'@'localhost' IDENTIFIED BY 'Ahmer@1234';
Query OK, 0 rows affected (0.176 sec)

Reload privileges table and exit from MySQL prompt.

MariaDB [(none)]> FLUSH PRIVILEGES;
Query OK, 0 rows affected (0.066 sec)

MariaDB [(none)]> EXIT;
Bye

Import database from the script provided with the Icinga2 software.

# mysql -u root -p123 icinga < /usr/share/icinga2-ido-mysql/schema/mysql.sql

Configure Icinga2 IDO configurations according to our environment.

# vi /etc/icinga2/features-available/ido-mysql.conf

Uncomment and set directives as follows.

/**
 * The IdoMysqlConnection type implements MySQL support
 * for DB IDO.
 */

object IdoMysqlConnection "ido-mysql" {
  user = "icinga"
  password = "Ahmer@1234"
  host = "localhost"
  database = "icinga"
}

Configure icinga2 to enable IDO and other required features.

# icinga2 feature enable command ido-mysql syslog
Enabling feature command. Make sure to restart Icinga 2 for these changes to take effect.
Enabling feature ido-mysql. Make sure to restart Icinga 2 for these changes to take effect.
Enabling feature syslog. Make sure to restart Icinga 2 for these changes to take effect.

Enable and start Icinga2 Service.

# systemctl enable --now icinga2.service
Created symlink /etc/systemd/system/multi-user.target.wants/icinga2.service â /usr/lib/systemd/system/icinga2.service.

Verify status of Icinga2 Service.

# systemctl status icinga2.service
â icinga2.service - Icinga host/service/network monitoring system
   Loaded: loaded (/usr/lib/systemd/system/icinga2.service; enabled; vendor pre>
   Active: active (running) since Sat 2020-01-11 12:34:00 PKT; 27s ago
  Process: 14847 ExecStartPre=/usr/lib/icinga2/prepare-dirs /etc/sysconfig/icin>
 Main PID: 14857 (icinga2)
    Tasks: 13 (limit: 5948)
   Memory: 13.5M
   CGroup: /system.slice/icinga2.service
           ââ14857 /usr/lib64/icinga2/sbin/icinga2 --no-stack-rlimit daemon --c>
           ââ14872 /usr/lib64/icinga2/sbin/icinga2 --no-stack-rlimit daemon --c>
           ââ14873 /usr/lib64/icinga2/sbin/icinga2 --no-stack-rlimit daemon --c>

Jan 11 12:34:00 icinga-2.recipes.com icinga2[14857]: [2020-01-11 12:34:00 +0500>
Jan 11 12:34:00 icinga-2.recipes.com systemd[1]: Started Icinga host/service/ne>

Continue reading our next article for installation of Icinga Web 2 on CentOS 8.

Final Thoughts

Install Icinga2 on CentOS 8 is a great way to set up a robust and scalable monitoring system for your IT infrastructure. By following this guide, you’ve learned how to configure Icinga2, setup essential components, and get started with effective system monitoring and alerting.

If you need professional assistance with to install Icinga2 or any other system administration tasks, feel free to reach out to me on Fiverr for expert support: Linux Server Administrator

Leave a Reply