Install Icinga2 and Icingaweb2 monitoring on Ubuntu 14.04

Madeesha’s Tech Space
4 min readApr 3, 2018

--

You can install Icinga2 on your monitoring node by following simple steps:

note: Make sure that you have install apache2 before these installations.

Step 1 : Install Icinga2

# wget -O - http://packages.icinga.org/icinga.key | apt-key add -
# add-apt-repository 'deb http://packages.icinga.org/ubuntu icinga-trusty main
# apt-get update
# apt-get install icinga2

Step 2: Install MySQL and client

apt-get install mysql-server mysql-client

Step 3: Install icinga database

# apt-get install icinga2-ido-mysql
Enable Icinga 2's ido-mysql fetures "Yes" enter

Step 4: Login in MySQL and create a database

# mysql -u root -p
mysql> CREATE DATABASE icinga;
mysql> GRANT SELECT, INSERT, UPDATE, DELETE, DROP, CREATE VIEW, INDEX, EXECUTE ON icinga.* TO 'icinga'@'localhost' IDENTIFIED BY 'icinga';
mysql> quit

Sometimes, when login to MySQL you may receive the following error,

Access Denied for User ‘root’@’localhost’ (using password: YES)

You can avoid this error by reseting the root password. Before reset, you need to know your mysql version to proceed. Type mysql — version and check your mysql version. Then execute following command according to your mysql version.

MySQL 5.7.6 and later:

ALTER USER 'root'@'localhost' IDENTIFIED BY 'MyNewPass';

MySQL 5.7.5 and earlier:

SET PASSWORD FOR 'root'@'localhost' = PASSWORD('MyNewPass');

Step 5: Enable livestatus feature and restart Icinga deamon

# icinga2 feature enable livestatus
# service icinga2 restart

Step 6: Add user to the group for permissions

# usermod -a -G nagios www-data

Step 7: Enable compat log and database feature and restart Icinga

# icinga2 feature enable compatlog
# icinga2 feature enable ido-mysql
# icinga2 feature enable command
# service icinga2 restart

Now you have succesfully install the Icinga2 on your server. Then we can proceed with installing icingaweb2.

Step 8: Clone Icinga web repository from Github

# apt-get install git
# git clone https://github.com/Icinga/icingaweb2.git

Step 9: Move cloned directory to /usr/share/icingaweb

# mv icingaweb2 /usr/share/
# cd /usr/share

Step 10: Install lamp server

# tasksel install lamp-server

Step 11: Naviagate to Icingaweb2 and run the following command.

# cd icingaweb2 
# ./bin/icingacli setup config webserver apache --document-root /usr/share/icingaweb/public

Step 12: copy paste the generated output in sites-enabled

vi /etc/apache2/sites-enabled/000-default.conf
After copy the output it will looks like this.

Step 13: Enable apache module rewrite and restart service

# service apache2 restart
# a2enmod rewrite
# service apache2 restart

Step 14: Create a directory and change it’s permission

# mkdir /etc/icingaweb2
# chmod 777 -R /etc/icingaweb2

Step 15: Open your browser and navigate to localhost/icingaweb2/setup

If it is a remote instance you can use it’s public ip instead of localhost to access the icingaweb2.

http://host-or-ip/icingaweb2/setup

It will ask for a token to proceed. you can generate token using following command,

su www-data --shell=/bin/bash -c "mkdir -m 2770 /etc/icingaweb2; head -c 12 /dev/urandom | base64 | tee /etc/icingaweb2/setup.token; chmod 0660 /etc/icingaweb2/setup.token;";

Now you need to config PHP `date.timezone’. change time zone to “Asia/Kolkata” in /etc/php5/apache2/php.ini file then uncomment ‘date.timezone’. Then click ‘Next’.

Then Resolve PHP dependencies.

# apt-get install php5-ldap
# service apache2 restart
# apt-get install php5-intl
# apt-get install php5-gd php5-imagick
# service apache2 restart

Then keep clicking ‘Next’ until you meet configuring database resources.

Step 16: Configuring Database Resources

You need to fill the page with the following details:

Step 17: Adminstration

Click next until you meet administration page and then fill it with relavant details.

Step 18: Monitoring IDO resource

Keep clicking next until you meet IDO resource. Fill the page with database details and click on validate for ensuring the configurations.

Click next and finish the configuration steps. You will meet with the following page.

Then login to icinga web. Now you have succesfully configured Icinga 2 and Icingaweb 2 on your ubuntu 14.04 machine. Cheers !!!!!!

--

--

Recommended from Medium

Lists