On this tutorial, we’ll present you add hosts to Icinga2 utilizing a module referred to as ‘Icinga Director’ and configure server and repair monitoring.
For this information, we’ll want Icinga2 put in on the system and the Icinga Director module has been enabled and configured appropriately. For the Icinga2 set up, you should utilize this hyperlink.
What we’ll do?
- Create Service Template
- Create ServiceSet and Add Service Templates
- Create a Host Template and Add ServiceSet
- Add Hosts to Icinga2 Server
- Shopper Host Initialization
Step 1 – Create Service Template
Firstly, we have to create templates that can be used to watch our companies and techniques. So, we have to outline which service and a part of the system can be monitored by Icinga2.
For this information, we’ll create some templates by the Icinga Director to watch SSH, HTTP, APT examine replace, System Load, and Disk Utilization.
Login to Icinga2 dashboard utilizing your admin consumer and password, then Click on the ‘Icinga Director‘ menu on the left.
Now click on the ‘Companies‘ and click on the ‘Service Templates‘ choice on the web page. To create a brand new service template, click on the ‘Add‘ button.
Sort particulars about your service particulars. Following is an instance for monitoring the SSH service.
Click on the ‘Add‘ button and the service template for SSH has been created.
Now redo this step to create different companies similar to HTTP, APT examine replace, System Load, Disk utilization.
Step 2 – Create a ServiceSet and Add Service Templates
After creating some service templates, we’ll make these templates as one ServiceSet.
On the ‘Companies‘ web page, click on the ‘ServiceSet‘ and click on ‘Add‘ button.
Now kind the ‘Service set identify’ and Description with your personal, then click on ‘Add‘ button once more.
And the ServiceSet named ‘basic-services-ubuntu’ has been created.
Subsequent, we’ll add our service templates to the ‘basic-services-ubuntu’ ServiceSet. Click on on the ServiceSet identify and click on the ‘Companies‘ tab on the correct display screen.
Click on the ‘Add Service‘ button.
Sort the service templates identify on the ‘Import‘ area after which click on ‘Add‘ once more.
And the service templates have been added to the ‘basic-services-ubuntu’ ServiceSet.
Now redo this step so as to add all service templates that we have created to the ‘basic-services-ubuntu’ ServiceSet.
Step 3 – Create a Host Template and Add ServiceSet
So as to add new Hosts to Icinga2 by Director, we have to create the Host templates. And for this step, we’ll create the host template and add ServiceSet into it.
On the Icinga Director menu, click on ‘Hosts’ and ‘Host Templates’.
Now click on the ‘Add‘ button.
Sort particulars concerning the Hosts Templates similar to under.
Click on ‘Add‘ button once more and the Host Templates named ‘ubuntu-template’ has been created.
Subsequent, we’ll add the ServiceSet named ‘basic-services-ubuntu’ to our host template.
Click on the Host template identify on the record, then click on the ‘Service‘ tab on the correct display screen.
Now click on the ‘Add Service Set‘ button.
Select the ServiceSet that we have created named ‘basic-services-ubuntu’ and click on ‘Add‘.
In consequence, the Host Template has been created with the ServiceSet added into it. And we’re prepared so as to add new hosts to the Icinga2.
Step 4 – Add Host to Icinga2 Server
On this step, we’ll add new hosts to the Icinga2 Server. We are going to add the Ubuntu Server 18.04 with the hostname ‘client1.hakase-labs.io’, and the IP handle ‘10.5.5.21’.
On the Icinga2 Dashboard, click on the ‘Icinga Director’ menu and click on ‘Hosts‘.
Now Click on ‘Hosts‘ on the web page and click on the ‘Add‘ button on the correct display screen.
Select the ‘basic-ubuntu‘ Host Template, and kind detailed host configurations.
Now click on the ‘Add‘ button.
As soon as all of those are full, click on the ‘Exercise Log‘ menu on the left and click on the ‘Deploy xx Pending Adjustments‘ to use our setup.
And consequently, the ‘client1’ host has been added to the Icinga2 utilizing the ‘basic-ubuntu’ host template that incorporates the ‘basic-service-ubuntu’ ServiceSet.
Step 5 – Shopper Host Initialization
On this step, we’ll initialize the ‘client1’ server by putting in the Icinga2 packages into it and configuring the distant Agent into it.
Hook up with the ‘client1’ server.
ssh [email protected]
Edit the ‘/and so on/hosts’ file utilizing vim editor.
Add hosts configuration under.
10.5.5.20 icinga2.hakase-labs.io icinga2
10.5.5.21 client1.hakase-labs.io client1
Save and shut.
Subsequent, add the icinga2 key.
curl https://packages.icinga.com/icinga.key | apt-key add -
Then goto the ‘/and so on/sources.record.d’ listing and create the ‘icinga2.record’ repository file.
cd /and so on/apt/sources.record.d/
Paste Icinga2 repository under.
deb http://packages.icinga.com/ubuntu icinga-bionic important
deb-src http://packages.icinga.com/ubuntu icinga-bionic important
Save and shut.
Now replace the repository and set up Icinga2 packages utilizing the apt command under.
sudo apt replace
sudo apt set up icinga2 monitoring-plugins
The Icinga2 packages have been put in on the ‘client1’ server.
Now again to the icinga2 dashboard, click on the ‘Hosts‘ menu and click on the ‘client1’ host on the record.
Now click on the ‘Agent‘ tab of the client1 host configuration.
Copy the Linux Script for the Agent deployment.
After that, again to the ‘client1’ server and create a brand new configuration referred to as ‘deploy-agent.sh’.
Paste the agent deployment script into it.
DEPLOYMENT SCRIPT From the Icinga2 Dashboard
Save and shut.
Make the script executable and run.
chmod +x deploy-agent.sh
And you’ll get the end result as under.
As soon as it is full, restart the icinga2 service utilizing the systemctl command under.
systemctl restart icinga2
And the initialization of Shopper Host server has been accomplished.
Step 6 – Testing
On the Icinga2 Dashboard menu, click on ‘Overview‘ and ‘Hosts‘. Now you can be proven two hosts the icinga2 server and ‘client1’ is up and working.
Click on the ‘client1‘ server to see particulars.
You’ll get a abstract of the ‘client1’ server.
To get the monitored companies for client1 hosts, click on the ‘Companies‘ tab.
Now you’ll get the service templates have been used on the ‘client1’ host.
And at last, we have efficiently added the Linux Hosts to the Icinga2 Monitoring System by the Icinga Director module.