Welcome to our guide on How to Install and configure Zabbix agent 5.0 on Ubuntu 20.04|18.04 Linux system. In our previous guide, we covered the installation of Zabbix Server, both for Ubuntu and CentOS 7:

This is a continuation guide on Zabbix monitoring of your entire Infrastructure – Linux systems, Windows servers, network routers, network switches e.t.c. So let’s get started with how to Install and configure Zabbix agent 5.0 on Ubuntu 20.0418.04.

What is Zabbix Agent?

Zabbix agent is a program developed in C. It runs on various supported platforms, including Linux, UNIX, and Windows. The work of the Zabbix agent is to collect data such as CPU, memory, disk and network interface usage from a device. It has a small resource footprint considering that monitoring configurations are centralized on the Zabbix server.

Zabbix Agents
image from zabbix

How Zabbix agent works

Zabbix agent can do both passive (polling) and active checks (trapping). The checks can be performed at an interval or based on specific times schedule. Here is the difference between passive and active checks:

Passive checks (polling):

  • Zabbix server (or proxy) requests a value from Zabbix agent
  • Agent processes the request and returns the value to the Zabbix server (or proxy)

Active checks (trapping):

  • Zabbix agent requests from Zabbix server (or proxy) a list of active checks
  • The agent sends the results in periodically

The image below from Zabbix may help visualize passive and active checks in action:

active vs passive
image from zabbix.com

Install Zabbix agent

Add Zabbix 5.0 repository on Ubuntu 20.04|18.04 LTS:

# Ubuntu 20.04
wget https://repo.zabbix.com/zabbix/5.0/ubuntu/pool/main/z/zabbix-release/zabbix-release_5.0-1+focal_all.deb
sudo apt install ./zabbix-release_5.0-1+focal_all.deb
sudo apt update

# Ubuntu 18.04
wget https://repo.zabbix.com/zabbix/5.0/ubuntu/pool/main/z/zabbix-release/zabbix-release_5.0-1+bionic_all.deb
sudo apt install ./zabbix-release_5.0-1+bionic_all.deb
sudo apt update

Add Zabbix 5.0 repository on Ubuntu 16.04 (Xenial Xerus) LTS:

wget https://repo.zabbix.com/zabbix/5.0/ubuntu/pool/main/z/zabbix-release/zabbix-release_5.0-1+xenial_all.deb
sudo apt install ./zabbix-release_5.0-1+xenial_all.deb

Then install Zabbix agent

sudo apt update
sudo apt install zabbix-agent zabbix-sender

Configuring Zabbix Agent

Zabbix agent configuration is /etc/zabbix/zabbix_agentd.conf. Edit the file using the following command:

$ sudo vim /etc/zabbix/zabbix_agentd.conf
# On line 117 - Specify Zabbix server IP Address
Server=192.168.10.2
# On line 158 - Specify Zabbix server ( For active checks)
ServerActive=192.168.10.2
# On line 169 - Set server hostname reported by Zabbix agent
Hostname=server1.example.com

Start zabbix-agent after making the change, also enable the service to start on boot:

sudo systemctl start zabbix-agent
sudo systemctl enable zabbix-agent

You can check service status using the command:

$ systemctl status zabbix-agent
● zabbix-agent.service - Zabbix Agent
     Loaded: loaded (/lib/systemd/system/zabbix-agent.service; enabled; vendor >
     Active: active (running) since Wed 2022-04-28 09:12:58 UTC; 1min 48s ago
   Main PID: 2378 (zabbix_agentd)
      Tasks: 6 (limit: 1137)
     Memory: 4.4M
     CGroup: /system.slice/zabbix-agent.service
             ├─2378 /usr/sbin/zabbix_agentd -c /etc/zabbix/zabbix_agentd.conf
             ├─2379 /usr/sbin/zabbix_agentd: collector [idle 1 sec]
             ├─2380 /usr/sbin/zabbix_agentd: listener #1 [waiting for connectio>
             ├─2381 /usr/sbin/zabbix_agentd: listener #2 [waiting for connectio>
             ├─2382 /usr/sbin/zabbix_agentd: listener #3 [waiting for connectio>
             └─2383 /usr/sbin/zabbix_agentd: active checks #1 [idle 1 sec]

Apr 28 09:12:58 ubuntu systemd[1]: Starting Zabbix Agent...
Apr 28 09:12:58 ubuntu systemd[1]: Started Zabbix Agent.

If you have firewalld enabled, allow port 10050/tcp on the firewall. This is used by Zabbix agent daemon.

sudo ufw allow 10050/tcp

You can check service port if listening using ss or netstat commands:

$ sudo ss -tunelp | grep 10050
tcp    LISTEN     0      128       *:10050                 *:*                   users:(("zabbix_agentd",pid=28031,fd=6),("zabbix_agentd",pid=28030,fd=6),("zabbix_agentd",pid=28029,fd=6),("zabbix_agentd",pid=28028,fd=6),("zabbix_agentd",pid=28027,fd=6),("zabbix_agentd",pid=28026,fd=6)) uid:385 ino:15465825 sk:ffffa119c2e264c0 <->
tcp    LISTEN     0      128      :::10050                :::*                   users:(("zabbix_agentd",pid=28031,fd=7),("zabbix_agentd",pid=28030,fd=7),("zabbix_agentd",pid=28029,fd=7),("zabbix_agentd",pid=28028,fd=7),("zabbix_agentd",pid=28027,fd=7),("zabbix_agentd",pid=28026,fd=7)) uid:385 ino:15465826 sk:ffffa11973db8880 v6only:1 <-

Add host to Zabbix Server

Login to admin Zabbix server interface, and go to Configuration > Hosts > Create host. Provide the following information:

  • Hostname of the server to be monitored
  • The visible name of the server to be monitored.
  • Select the group or add a new group for “Groups” field.
  • IP address
  • Zabbix agent service port -default is 10050

Then go to the Templates tab.

1. Click the select button under Link new templates section

Select the templates you want to use:

zabbix agent add select templates

2. Once you have selected the templates, click on the Add link to link templates to your target systemAfter the templates are linked, they’ll appear on the  Linked templates section

zabbix agent add linked templates

Update the setting using the Update button.

After a few minutes, monitoring data will be collected and you can visualize them using Zabbix graphs. Default host graphs can be accessed on

Monitoring > Graphs > <Host|Graph>

Below are the Ram and CPU utilization graphs for the host we added earlier.

zabbix agent add host centos 03
zabbix agent add host centos 04

Enjoy your monitoring with Zabbix Server and Agent installed in your operating system.

LEAVE A REPLY

Please enter your comment!
Please enter your name here