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

How to Install Zabbix Server on Ubuntu

How to Install Zabbix Server on 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 CentOS 7 and 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 on CentOS 7

Below steps are used to install Zabbix agent on CentOS 7

 Add Zabbix repositories

Add Zabbix 5.0 repositories using the commands below:

rpm -ivh https://repo.zabbix.com/zabbix/5.0/rhel/7/x86_64/zabbix-release-5.0-1.el7.noarch.rpm

Once the repo has been added, install Zabbix agent by executing the following command on your terminal.

sudo yum install zabbix-agent zabbix-sender

Accept installation prompts:

Dependencies Resolved

================================================================================
 Package               Arch           Version              Repository      Size
================================================================================
Installing:
 zabbix-agent          x86_64         5.0.11-1.el7         zabbix         457 k
 zabbix-sender         x86_64         5.0.11-1.el7         zabbix         357 k

Transaction Summary
================================================================================
Install  2 Packages

Total download size: 814 k
Installed size: 3.3 M
Is this ok [y/d/N]: y

Also import GPG key:

--------------------------------------------------------------------------------
Total                                              1.1 MB/s | 814 kB  00:00
Retrieving key from file:///etc/pki/rpm-gpg/RPM-GPG-KEY-ZABBIX-A14FE591
Importing GPG key 0xA14FE591:
 Userid     : "Zabbix LLC <[email protected]>"
 Fingerprint: a184 8f53 52d0 22b9 471d 83d0 082a b56b a14f e591
 Package    : zabbix-release-5.0-1.el7.noarch (installed)
 From       : /etc/pki/rpm-gpg/RPM-GPG-KEY-ZABBIX-A14FE591
Is this ok [y/N]: y

Install Zabbix agent on Ubuntu 20.04|18.04

Add Zabbix 5.0 repository on Ubuntu 20.04|18.04 LTS:

# 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

# 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

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

Step 2: 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 2021-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.

For CentOS 7:

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

For Ubuntu (UFW)

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 <-

Step 3: 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.

Your support is our everlasting motivation,
that cup of coffee is what keeps us going!


As we continue to grow, we would wish to reach and impact more people who visit and take advantage of the guides we have on our blog. This is a big task for us and we are so far extremely grateful for the kind people who have shown amazing support for our work over the time we have been online.

Thank You for your support as we work to give you the best of guides and articles. Click below to buy us a coffee.

LEAVE A REPLY

Please enter your comment!
Please enter your name here