Installation of Icinga 2 on CentoS.
Icinga is a monitoring system which checks the availability of your network resources, notifies users of outages, and generates performance data for reporting.Install required packages
[basondole@localhost ~] sudo yum install httpd sudo yum install mariadb mariadb-server sudo systemctl start mariadb && sudo systemctl enable mariadb sudo mysql_secure_installation sudo yum install centos-release-scl sudo yum install rh-php71-php-mysqlnd rh-php71-php-cli php-Icinga rh-php71-php-common rh-php71-php-fpm rh-php71-php-pgsql rh-php71-php-ldap rh-php71-php-intl rh-php71-php-xml rh-php71-php-gd rh-php71-php-pdo rh-php71-php-mbstring -y
Verify the timezone is properly configured
[basondole@localhost ~] cat /etc/opt/rh/rh-php71/php.ini | grep timezone ; Defines the default timezone used by the date functions ; http://php.net/date.timezone date.timezone = Africa/Nairobi
if date.timezone is empty edit the file to add correct timezone
Install more dependencies
[basondole@localhost ~] sudo yum -y install http://mirror.centos.org/centos/7/sclo/x86_64/sclo/sclo-php71/sclo-php71-php-pecl-imagick-3.4.3-2.el7.x86_64.rpm sudo rpm -Uvh https://dl.fedoraproject.org/pub/epel/7/x86_64/Packages/e/epel-release-7-11.noarch.rpm sudo yum install https://packages.icinga.com/epel/icinga-rpm-release-7-latest.noarch.rpm sudo yum install icinga2-ido-mysql icingaweb2 icingacli nagios-plugins-all
Install icinga
[basondole@localhost ~] yum install icinga2
Start and enable the services
[basondole@localhost ~] sudo systemctl start httpd.service sudo systemctl start icinga2.service sudo systemctl start rh-php71-php-fpm.service sudo systemctl enable rh-php71-php-fpm.service sudo systemctl enable icinga2.service
Configuring the firewall
[basondole@localhost ~] sudo firewall-cmd --zone=public --permanent --add-port=80/tcp sudo firewall-cmd --zone=public --permanent --add-port=5665/tcp sudo firewall-cmd --reload
Now icinga2 is successfully installed and can be accessed on a browser to finalize the setup proccess
via http://<ip-addrees-or-hostname-of-icnga2-server>/icingaweb2/setup
Configuring icinga2 web
My installation is done on a vm with IP 192.168.56.4
I will browse http://192.168.56.4/icingaweb2/setup
Create token:
[basondole@localhost ~] sudo groupadd -r icingaweb2 sudo usermod -a -G icingaweb2 apache sudo icingacli setup config directory --group icingaweb2 sudo icingacli setup token create
Fill the token to the web interface and click next
Review the modules and click next
Create Icinga database
[basondole@localhost ~] mysql -u root -p Enter password: MariaDB [(none)]> create database icinga2; MariaDB [(none)]> exit
Fill in the details as illustrated and click validate configuration then next
On the next screen, we will be asked to review the changes that we have made for icinga.
Make sure that everything is in order & hit next
Configuring monitoring module for Icinga
[basondole@localhost ~] mysql -u root -p MariaDB [(none)]> CREATE DATABASE icinga; MariaDB [(none)]> GRANT SELECT, INSERT, UPDATE, DELETE, DROP, CREATE VIEW, INDEX, EXECUTE ON icinga.* TO 'baggy'@'localhost' IDENTIFIED BY 'password'; MariaDB [(none)]> FLUSH PRIVILEGES; MariaDB [(none)]> EXIT; mysql -u root -p icinga < /usr/share/icinga2-ido-mysql/schema/mysql.sql
Configure IDO
[basondole@localhost ~] sudo cat /etc/icinga2/features-available/ido-mysql.conf /** * The IdoMysqlConnection type implements MySQL support * for DB IDO. */ object IdoMysqlConnection "ido-mysql" { //user = "icinga" //password = "icinga" //host = "localhost" //database = "icinga" }
Edit the above file to become
[basondole@localhost ~] sudo cat /etc/icinga2/features-available/ido-mysql.conf /** * The IdoMysqlConnection type implements MySQL support * for DB IDO. */ library "db_ido_mysql" object IdoMysqlConnection "ido-mysql" { user = "icinga" password = "icinga" host = "localhost" database = "icinga" }
Check if IDO is enable
[basondole@localhost ~] sudo icinga2 feature list
if not enabled, enable with
[basondole@localhost ~] sudo icinga2 feature enable ido-mysql sudo icinga2 feature enable command sudo systemctl restart icinga2
If you get below error upon validation
"There is currently no icinga instance writing to the IDO. Make sure that a icinga instance is configured and able to write to the IDO.”
Issue these commands
[basondole@localhost ~] sudo chmod 660 /etc/icinga2/features-available/ido-mysql.conf sudo chown icinga:icinga /etc/icinga2/features-available/ido-mysql.conf
Login to icinga2
Adding Nodes to be monitored
[basondole@localhost ~] nano /etc/icinga2/conf.d/hosts.conf object Host “router-63” { address = “192.168.56.63” check_command = “hostalive” }
Restart the service
[basondole@localhost ~] sudo systemctl restart icinga2.service
On the web page navigate to hosts