On Zabbix, hosts are typically devices or machines you want to monitor. It can be servers, workstations, virtual machines, containers, switches, etc. After installing Zabbix on your environment, you must add hosts first, then start monitoring some items.

To add hosts to monitor the Zabbix server, you can use different types of checks. Below are the type of checks commonly used for monitoring hosts on Zabbix:

  1. Using Zabbix Agent, which provides Passive and Active checks (can be used to monitor servers, workstations, virtual machines).
  2. Using SNMP (Simple Network Management Protocol), mostly used to monitor devices such as a printer, switches, routers, etc.

To add and monitor hosts using the Zabbix agent, you must install Zabbix agent packages to the host machine. Also, to add and monitor devices using SNMP protocol, make sure your devices come with default enabled SNMP protocol, it can be v1, v2, or v3.

Prerequisites

This article will teach you how to add hosts Debian 11 and Rocky Linux 8.4 to the Zabbix server.

Below is the detailed environment for our example:

Zabbix-server

  • Operating system: Debian 11 Bullseye
  • IP Address: 192.168.1.10
  • Root privileges

hosts01

  • Operating system: Debian 11 Bullseye
  • IP Address: 192.168.1.115
  • Root privileges

host02

  • Operating system: Rocky Linux 8.4
  • IP Address: 192.168.1.116
  • Root privileges

Before starting this guide, complete the Zabbix server installation below.

How to Install Zabbix on Debian 11

After that, ensure the TCP port ‘10050‘ on the Zabbix server is on the state ‘OPEN‘. The following command can add the TCP port ‘10050’ to the UFW firewall.

sudo ufw allow 10050/tcp
sudo ufw reload

And if you’ve got the Zabbix server up and running, let’s start adding host machines ‘host01‘ and ‘host02‘ to the Zabbix server.

Installing Zabbix Agent on Debian/Ubuntu Systems

In this first step, you will learn how to install and configure the Zabbix agent on the Debian-based system. Also, you will learn how to set up the Zabbix agent with active checks.

1. First, download the repository package for Zabbix for your system.

Zabbix repository for Debian 11:

wget --no-check-certificate https://repo.zabbix.com/zabbix/5.5/debian/pool/main/z/zabbix-release/zabbix-release_5.5-1+debian11_all.deb

Zabbix repository for Ubuntu 20.04:

wget --no-check-certificate https://repo.zabbix.com/zabbix/5.5/ubuntu/pool/main/z/zabbix-release/zabbix-release_5.5-1+ubuntu20.04_all.deb

2. Next, add the Zabbix repository and update the system repository using the following command.

sudo dpkg -i zabbix-release_5.5-1 debian11_all.deb
sudo apt update

After that, install the Zabbix agent using the apt command below.

sudo apt install zabbix-agent

Type ‘y’ to confirm and press ‘Enter‘ to continue the installation.

How to Add Host to the Zabbix Server Debian linux

3. After Zabbix agent installation completes, edit the configuration ‘/etc/zabbix/zabbix_agentd.conf‘ using nano editor.

nano /etc/zabbix/zabbix_agentd.conf

Uncomment the following configuration and change the value with your Zabbix server IP address ‘192.168.1.10‘.

Server=IP-Address-Zabbix-Server/192.168.1.10
ServerActive=IP-Address-Zabbix-Server/192.168.1.10

Type the server hostname ‘host01‘ and uncomment the option ‘HostnameItem‘.

Hostname=host01
HostnameItem=system.hostname

Save the configuration and exit.

4. Next, execute the following command to start and enable the Zabbix agent service.

sudo systemctl enable --now zabbix-agent

Now verify the Zabbix agent service, and make sure it’s active and running.

sudo systemctl status zabbix-agent

As you can see on the following screenshot, the Zabbix agent service on the ‘host01‘ is active and running.

How to Add Host to the Zabbix Server Debian linux

5. Now add the TCP port ‘10050‘ to the firewall rule. If you’re using the UFW firewall, use the command below.

sudo ufw allow 10050/tcp
sudo ufw reload

The Zabbix agent installation and configuration on the Debian-based systems are complete.

Installing Zabbix Agent on CentOS/RockyLinux

In this step, you will learn how to install and configure the Zabbix agent on the CentOS or Rocky Linux system. By default, the CentOS/Rocky Linux repository provides packages for Zabbix. But, you can still install all Zabbix packages from the official Zabbix repository.

1. At first, add the EPEL repository to your CentOS/Rocky Linux system.

sudo dnf install epel-release

Type ‘y‘ and press ‘Enter‘ to continue the installation.

2. After that, add the Zabbix repository to your system using the following command.

– Install Zabbix Agent from Zabbix Repository

If you prefer installing Zabbix packages from the official Zabbix repository, add the Zabbix repository using the command below.

sudo rpm -Uvh https://repo.zabbix.com/zabbix/5.5/rhel/8/x86_64/zabbix-release-5.5-1.el8.noarch.rpm

After that, execute the DNF command below to install the Zabbix agent.

sudo dnf install zabbix-agent

Type ‘y‘ and press ‘Enter‘ to continue the installation.

– Install Zabbix Agent from CentOS/Rocky Linux Repository

To install the Zabbix agent from the CentOS/Rocky Linux repository, you must enable the Zabbix module using the following command.

sudo dnf module enable zabbix:5.0

Type ‘y‘ and press ‘Enter‘ to enable the Zabbix module.

How to Add Host to the Zabbix Server Debian linux

Next, install the Zabbix agent using the dnf command below.

sudo dnf install zabbix-agent

Wait for the package installation to complete.

3. If your Zabbix agent installation completes, edit the Zabbix agent configuration ‘/etc/zabbix_agentd.conf‘ using nano editor.

nano /etc/zabbix_agentd.conf

Uncomment the option ‘Server‘ and ‘ServerActive‘, and change the value with your Zabbix server IP address ‘192.168.1.10‘.

Server=IP-Address-Zabbix-Server
ServerActive=IP-Address-Zabbix-Server

Now change the hostname with your server hostname ‘host02‘ and uncomment the option ‘HostnameItem‘.

Hostname=host2
HostnameItem=system.hostname

Save the configuration and exit.

4. Next, execute the command below to start and enable the Zabbix agent service.

sudo systemctl enable --now zabbix-agent

Now check the Zabbix agent service status and make sure it’s active and running.

sudo systemctl status zabbix-agent

Below is the screenshot from the ‘host02‘ with the Zabbix agent active and running.

How to Add Host to the Zabbix Server Debian linux

5. Now you must add the TCP port ‘10050‘ to your firewall. If you’re running CentOS/Rocky Linux with firewalld, use the firewall-cmd command below.

sudo firewall-cmd --add-port=10050/tcp --permanent
sudo firewall-cmd --reload

The installation and configuration of the Zabbix agent on the CentOS/Rocky Linux are complete.

Add Hosts to Zabbix Server

After installing the Zabbix agent on each host, you must add it to the Zabbix server through the admin dashboard.

Before going any further, you must log in to the Zabbix admin dashboard.

1. Click the menu ‘Configuration > Hosts‘, and you will see your Zabbix server on the list.

How to Add Host to the Zabbix Server Debian linux

Click the button ‘Create host‘ on the right top.

2. Add details host configuration as below.

  • Host name: host01.
  • Visible name: host01 – Debian11.
  • Groups: click ‘Select’ and choose ‘Linux servers’.
  • Interface: click ‘Add’ and select ‘Agent’, then type the IP address of your host, DNS name can be hostname with the port ‘10050’.
  • Enabled: Check the option.

How to Add Host to the Zabbix Server Debian linux

3. Now move to the tab ‘Templates‘.

Link new templates: click the ‘Select‘ button.

How to Add Host to the Zabbix Server Debian linux

You will see a new ‘Templates‘ pop-up window, click the ‘Select‘ button on the ‘Host group‘ section.

How to Add Host to the Zabbix Server Debian linux

Select ‘Templates/Operating systems‘.

How to Add Host to the Zabbix Server Debian linux

Mark as a check on the template ‘Linux by Zabbix agent’ and click the ‘Select‘ button.

How to Add Host to the Zabbix Server Debian linux

Now you will see the template ‘Linux by Zabbix agent’ on the ‘Link new templates’ section.

How to Add Host to the Zabbix Server Debian linux

Click the ‘Add‘ button.

For ‘host02‘, do the same thing as on top ‘host01‘.

4. After adding new hosts, you will see ‘host01‘ and ‘host02‘ on the ‘Hosts‘ menu.

How to Add Host to the Zabbix Server Debian linux

As you can see on the top screenshot, ‘host01‘ and ‘host02‘ are enabled and it’s up and running.

The green logo ‘ZBX’ means the Zabbix agent service on the host is running, if there is an error, you will see the logo with red color. And for warning, the logo will be grey.

5. Wait for some minutes (10-20 minutes), then right-click on the hostname and select ‘Graph‘.

Below is a detailed graph monitoring from the ‘host01‘ Debian 11 machine.

How to Add Host to the Zabbix Server Debian linux

And below is the graph monitoring from the ‘host02‘ Rocky Linux system.

How to Add Host to the Zabbix Server Debian linux

Now you’ve successfully added hosts to monitor to the Zabbix server.

Conclusion

Congratulations! You’ve learned how to add a new host to monitor the Zabbix server. Also, you’ve learned how to install the Zabbix agent on the Debian-based distribution and CentOS/Rocky Linux system.

For the next step, you may new hosts and services to monitor or explore another method such as Zabbix with SNMP, SSH, etc.