Add Host to Zabbix

We will teach you how to add a host to zabbix and start monitoring the host.

For this tutorial, we will use the zabbix agent on a host with a Linux operating system. However, the procedure is similar for adding hosts from different operating systems such as Windows and macOS.

Configuring Zabbix server

Let’s access the Zabbix server through the browser.

The scenario we used for this laboratory is shown in the figure below. We have Host machine and Zabbix server machine connected. This connection can be physical or using virtual networks as in the case of VirtualBox or VMWare.

In our case, we are on the same machine that the Zabbix server is running on. Therefore, we can use the loopback IP “http://127.0.0.1/zabbix”.

http://127.0.0.1/zabbix

Next, let’s see the main screen of the Zabbix server as in the figure below.

Creating new host on Zabbix Server

Now let’s start the process of adding a host to zabbix. To do this, we will click on “Data Collection” and then on “Hosts” in the menu on the left.

Next, at the top of the screen, we will click on “Create host”.

Now let’s see the hosts insertion screen. On this screen, we will give a name to the host we are going to monitor. In our case, we are giving the name “My_host”.

Adding a Template to the Host

Next, let’s add the monitoring template. To do this, we will click on “Select” in the Templates line.

After clicking on “Select” in the Templates line, we will see the screen below.

And let’s click on “Select” as in the figure below.

Now, let’s choose the type of template we are going to use. In our case, we are going to monitor a common machine and so we will choose to monitor based on the operating system. To do this, we will click on “Templates/Operating systems”.

Now let’s choose the operating system we are going to use and the data collection mode for zabbix. In our case, our host is Linux and we are going to use the zabbix agent. Therefore, we will click on “Linux by Zabbix agent” and then we will click on “Select”.

Note. If you are using another operating system such as Windows or macOS, choose the appropriate field.

Adding the host to a Host Groups

Now let’s add the host group that the new host will belong to. To do this, we will click on Select in the “Hosts groups

Next, we’ll choose a group for our host. In this case, we will choose the “Discovered hosts” group and then click on “Select”.

Adding Interface to Host

The next step is to add the interface. To do this, we will click on “Add” in the “interfaces” field.

As we are going to use the zabbix agent on the host, we will choose the “Agent” option.

Now let’s enter the IP of the host we want to monitor. In our case, the host IP is “172.16.10.9”. After entering the host IP, we will click on “Add”.

Checking for added host

The figure below shows that the host has been added to Zabbix. However, we can check the “Availability” field is still not showing the host status in green.

To show the “Availability” field in green, we will install and configure the zabbix agent on the host we want to monitor.

On host machine

Let’s open the terminal to install the zabbix agent. In our case, we are using Ubuntu and therefore we will first update the repositories with the command below. 

sudo apt update

Installing the zabbix agent on the host

Next we will start installing the zabbix agent with the command below.

sudo apt install zabbix-agent

Configuring the zabbix agent on the host

Now, let’s edit the zabbix agent configuration file. To do this, we will type the command below in the terminal.

sudo nano /etc/zabbix/zabbix_agentd.conf

Once inside the “zabbix_agentd.conf” file, let’s look for the part related to passive monitoring configuration. In this case, the zabbix server initiates the connection for monitoring.

Next we will change the “Server=127.0.0.1” field to the IP of our Zabbix server. In our case, our server’s IP is “172.16.10.8”.

Now, let’s look for the monitoring configuration in active mode. In this case, the zabbix agent will initiate connection with the Zabbix server.

Here we will also change the IP that is in the configuration file “127.0.0.1” to the IP of our Zabbix server “172.16.10.8”.

As we are using monitoring in active mode, we will have to change the field that informs the name of our host. This step is very important, as we must enter the same hostname that we used when creating the host on the zabbix server.

In our case, the name we gave to our host there on the zabbix server was “My_host”.

After making the changes, we will save the changes and exit the file.

Restarting zabbix agent

After having changed the “zabbix_agentd.conf” file, we need to restart the zabbix agent. To do this, we will use the command below.

sudo service zabbix-agent restart

Returning to the Zabbix server

Now let’s go back to the Zabbix server to check if the newly added host already appears in monitoring.

We can look at the screen that we had added the host to the Zabbix server and we can press the “F5” key to refresh the page on the Zabbix server.

If everything went correctly, we will see a screen showing the “Availability” field in green.

Monitoring the host

Now we can monitor the host we recently added. To do this, we will access the left menu and click on “Monitoring” and then on “Hosts”.

We can see that, as in the figure below, our newly added host appears to be monitored.

See more:

Install Zabbix on Ubuntu

How to install Zabbix on Raspberry Pi

Juliana Mascarenhas

Data Scientist and Master in Computer Modeling by LNCC.
Computer Engineer

Best IDE for Python?

Finding the perfect IDE is a personal journey that depends on various factors such as…

Read More

Reference Links:

https://www.zabbix.com/manuals