Install and configure Icinga 2 (part 1)

Install epel repositories if don’t have it already. And then, add the icinga repositories..

root@lab1234:~ $ rpm --import https://packages.icinga.com/icinga.key
root@lab1234:~ $ yum install https://packages.icinga.com/epel/icinga-rpm-release-7-latest.noarch.rpm

Install icinga2 package. If you use selinux install icinga2-selinux too.

root@lab1234:~ $ yum install icinga2

Start icinga2

root@lab1234:~ $ systemctl start icinga2

Install the nagios’ plugins

root@lab1234:~ $ yum install nagios-plugins-all

Install the IDO modules for MySQL

root@lab1234:~ $ yum install icinga2-ido-mysql

Create the database for icinga.

mysql> create database icinga2;
Query OK, 1 row affected (0.00 sec)

mysql> create database icinga2web;  --> We'll use it later for the web
Query OK, 1 row affected (0.00 sec)

mysql> create user icinga2@localhost identified by 'my_unknown_passwd';
Query OK, 0 rows affected (0.01 sec)

mysql> grant all on icinga2.* to icinga2@localhost;
Query OK, 0 rows affected (0.00 sec)

mysql> grant all on icinga2.* to icinga2web@localhost;
Query OK, 0 rows affected (0.00 sec)

mysql> flush privileges;
Query OK, 0 rows affected (0.00 sec)

mysql> 

Import the icinga ido schema in the database.

root@lab1234:~ $ mysql -u icinga2 -p icinga2 < /usr/share/icinga2-ido-mysql/schema/mysql.sql
Enter password: 
root@lab1234:~ $ 

Check the enabled/disabled features on icinga and enable ido-mysql and command (and the others you think you will need). Then restart icinga2.

root@lab1234:~ $ 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
root@lab1234:~ $ icinga2 feature enable ido-mysql
Enabling feature ido-mysql. Make sure to restart Icinga 2 for these changes to take effect.
root@lab1234:~ $ icinga2 feature enable command
Enabling feature command. Make sure to restart Icinga 2 for these changes to take effect.
root@lab1234:~ $ systemctl restart icinga2
root@lab1234:~ $ 

Configure and uncomment the database options in /etc/icinga2/features-enabled/ido-mysql.conf

  //user = "icinga"
  //password = "icinga"
  //host = "localhost"
  //database = "icinga"

Then restart icinga2 again.