Icinga2 is a robust free and open-source monitoring software that retains an eye fixed in your community sources and sends alerts or notifications in case of failure or outages. It additionally collects metrics from community sources that may allow you to generate efficiency knowledge and create reviews.
Icinga2 is scalable and it might probably monitor small to giant and sophisticated networks throughout varied areas. On this information, you’ll discover ways to set up the Icinga2 monitoring software on Ubuntu 20.04 and Ubuntu 22.04.
Step 1: Set up Apache, MariaDB, and PHP
We begin off by putting in Apache, MariaDB, and PHP with further PHP modules that are required in the course of the closing setup of Icinga2 on an online browser.
$ sudo apt set up apache2 mariadb-server mariadb-client mariadb-common php php-gd php-mbstring php-mysqlnd php-curl php-xml php-cli php-soap php-intl php-xmlrpc php-zip php-common php-opcache php-gmp php-imagick php-pgsql -y
As soon as put in, ensure all of the companies are operating. If that’s the case, run the next instructions.
$ sudo systemctl begin {apache2,mariadb} $ sudo systemctl allow {apache2,mariadb} $ sudo systemctl standing {apache2,mariadb}
Subsequent, you should use mysql_secure_installation script to arrange the password for the database root account, take away nameless customers, disallow root login remotely and take away the check database.
$ sudo mysql_secure_installation
With the PHP modules in place, you should modify the php.ini file which is the default configuration file for functions operating on PHP.
Utilizing your most well-liked editor, open the file. Right here. we’re utilizing a nano command-line editor.
$ sudo nano /and so forth/php/8.1/apache2/php.ini [On Ubuntu 22.04] $ sudo nano /and so forth/php/7.4/apache2/php.ini [On Ubuntu 20.04]
Make the next modifications to the next parameters.
memory_limit = 256M post_max_size = 64M upload_max_filesize = 100M max_execution_time = 300 default_charset = "UTF-8" date.timezone = "Asia/Kolkata" cgi.fix_pathinfo=0
For the date.timezone
parameter, be sure you set it as much as replicate your present time zone. Here’s a record of supported occasions zones by PHP.
To use the modifications made, merely restart the Apache webserver.
$ sudo systemctl restart apache2
Step 2: Set up Icinga2 on Ubuntu
With the PHP configuration out of the way in which, we’ll proceed and set up Icinga2. Nevertheless, the Icinga2 repository will not be offered by the Ubuntu 20.04 repositories. As such, we have to manually add the repository to your system.
Subsequently, begin off by including the GPG key utilizing the curl command.
$ curl https://packages.icinga.com/icinga.key | apt-key add -
Subsequent, create a repository file for Icinga2.
$ sudo vim /and so forth/apt/sources.record.d/icinga-focal.record
Add the next entries.
deb http://packages.icinga.com/ubuntu icinga-focal essential deb-src http://packages.icinga.com/ubuntu icinga-focal essential
Save and exit the file.
To start out utilizing the repository, replace the package deal lists as follows.
$ sudo apt replace
Subsequent, set up Icinga2 and the monitoring plugins.
$ sudo apt set up icinga2 monitoring-plugins
As soon as the set up is full, allow and begin the Icinga2 service.
$ sudo systemctl allow icinga2 $ sudo systemctl begin icinga2
To verify that the Icinga2 service is operating, execute:
$ sudo systemctl standing icinga2
The output signifies that the Icinga2 daemon is operating and we’re good to go.
Step 3: Set up the Icinga2 IDO Module
The Icinga2 Information Output (IDO) exports all of the configuration and standing info right into a database. The IDO database is then utilized by Icinga Net 2 as a knowledge backend.
To put in the module, run the command
$ sudo apt set up icinga2-ido-mysql -y
Alongside the way in which, a pop-up might be displayed on the terminal. To allow Icinga2’s ido-mysql function, choose ‘Sure‘ and press ENTER.
The icinga2-ido-mysql package deal requires a database put in and configured. This may be dealt with with dbconfig-common, however we’re going to create the database ourselves. So choose ‘No‘ and refuse this feature.
Subsequent, log in to your MariaDB database server.
$ sudo mysql -u root -p
Then, create a database and a database person for the icinga2-ido-mysql package deal and grant the person all of the privileges on the database.
> CREATE DATABASE icinga_ido_db; > GRANT ALL ON icinga_ido_db.* TO 'icinga_ido_user'@'localhost' IDENTIFIED BY 'Password321'; > FLUSH PRIVILEGES; > EXIT;
With the database in place, proceed and import the Icinga2 IDO schema utilizing the command. You may be required to offer the database server’s root password.
$ sudo mysql -u root -p icinga_ido_db < /usr/share/icinga2-ido-mysql/schema/mysql.sql
Step 4: Allow the Icinga2 IDO Module
To allow the icinga2-ido-mysql database communication with Icinga Net 2, we have to go a step additional and make modifications to the default configuration file.
Open the icinga2-ido-mysql configuration file.
$ sudo vim /and so forth/icinga2/features-available/ido-mysql.conf
Edit the next entries and set them to match the icinga2-ido-mysql database particulars as laid out in Step 3.
Save the modifications and exit.
Then allow the icinga2-ido-mysql function.
$ sudo icinga2 function allow ido-mysql
For the modifications to return into impact, restart Icinga2.
$ sudo systemctl restart icinga2
Step 5: Set up and Setup IcingaWeb2
The final part to put in and configure is IcingaWeb 2, which is a quick, highly effective, and extensible PHP framework that acts because the entrance finish to Icinga2.
So set up IcingaWeb2 and the Icinga CLI, run the command.
$ sudo apt set up icingaweb2 icingacli -y
We have to create a second database schema that might be designated for Icinga Net 2.
As soon as once more, log in to your database server.
$ sudo mysql -u root -p
Then create the database and database person for Icingaweb2 and grant all permissions to the database person on the database.
> CREATE DATABASE icingaweb2; > GRANT ALL ON icingaweb2.* TO 'icingaweb2user'@'localhost' IDENTIFIED BY '[email protected]'; > FLUSH PRIVILEGES; > EXIT;
Thereafter, create a setup token utilizing the next command. The setup token might be used throughout authentication when organising Icinga2 on the browser.
$ sudo icingacli setup token create
In case you lose or overlook the token, you’ll be able to view it by operating the command:
$ sudo icingacli setup token present
Step 6: Full IcingaWeb2 Set up in Ubuntu
With all configurations in place, we’ll now full the Icinga2 arrange on an online browser. So, launch your browser and head over to the URL proven.
http://server-ip/icingaweb2/setup
This takes you to the Welcome web page as proven. Bear in mind the setup token that you just created? Copy and Paste it within the textual content discipline and click on ‘Subsequent’.
On the ‘Modules‘ web page, the ‘Monitoring’ module is enabled by default. Nevertheless, you might be at liberty to allow your most well-liked modules.
Then scroll down and click on ‘Subsequent‘.
Within the subsequent step, make sure that all of the PHP modules and libraries are put in and listing permissions are appropriate.
Then scroll down and click on ‘Subsequent‘.
On the ‘Authentication’ web page, choose ‘Database’ because the authentication kind and click on ‘Subsequent’.
Within the ‘Database Useful resource’ part, fill within the database particulars for IcingaWeb2 as laid out in Step 5.
Then scroll down and click on ‘Validate Configuration’ to validate the database particulars.
If all went properly, the database configuration might be efficiently validated. As soon as the validation is profitable, scroll down and click on ‘Subsequent’.
Within the subsequent step, click on ‘Subsequent’ to simply accept the defaults.
Within the ‘Software Configuration’ part, click on ‘Subsequent’ to simply accept the defaults.
Within the subsequent step, take a while and assessment all of the modifications for Icinga Net 2. Be certain that all of the configurations are appropriate and be happy to return and make the mandatory corrections.
If all seems to be good, scroll down and click on ‘Subsequent‘.
The final part within the Icinga2 net setup entails configuring the monitoring module. So, click on ‘Subsequent’.
Subsequent, fill within the database particulars for the Icinga2 IDO module as laid out in Step 3.
Then scroll down and click on ‘Validate Configuration’.
As soon as once more, the validation of the database particulars must be successful. If you happen to get an error, head again and guarantee all the small print are appropriate.
To move to the subsequent step, scroll down and click on ‘Subsequent’.
Within the ‘Command Transport’ part, choose ‘Native Command File’ because the transport kind and click on ‘Subsequent’.
Within the ‘Monitoring Safety’ part, merely click on ‘Subsequent’ to go together with the defaults.
Evaluation all of the modifications for the monitoring module. If something seems to be misplaced, head again and make the mandatory corrections.
Then scroll down and click on ‘End’.
At this level, Icinga Net 2 has efficiently been arrange and it’s best to see a notification to that impact as proven beneath. To log in to the Icinga2 dashboard, click on on ‘Login to Icinga Net 2’.
This takes you to the login web page as proven. Present your Admin account particulars and press ENTER to log in.
And the Icinga2 dashboard will become visible. Any present points might be displayed with their stage of severity. For instance, the dashboard notifies us of 28 packages with prepared upgrades.
To confirm this, we’ll head again to the terminal and run the command:
$ sudo apt record --upgradable
To improve the packages, we’ll merely run:
$ sudo apt improve -y
And this resolves the difficulty. From the dashboard, you’ll be able to see that there are not any extra points displayed.
On this information, we have now demonstrated methods to set up the Icinga2 monitoring software on Ubuntu. Admittedly, the set up is sort of lengthy and requires consideration to element. Nonetheless, in the event you adopted the steps to the latter, every part ought to work simply superb.