Welcome to our guide on How to Install and configure Zabbix agent 4.0 on Ubuntu 18.04 and CentOS 7. In our previous guide, we covered the installation of Zabbix Server, both for Ubuntu and CentOS 7:
How to Install Zabbix Server 4.0 on Ubuntu 18.04 & Ubuntu 16.04 LTS
How to Install Zabbix Server 4.0 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 4.0 on CentOS 7 and Ubuntu 18.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.

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:

How to Install Zabbix agent on CentOS 7
Below steps are used to install Zabbix agent on CentOS 7
Add Zabbix repositories
Add Zabbix 4.0 repositories using the commands below:
rpm -ivh https://repo.zabbix.com/zabbix/4.0/rhel/7/x86_64/zabbix-release-4.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
How to Install Zabbix agent on Ubuntu 18.04
Add Zabbix 4.0 repository on Ubuntu 18.04 (Bionic Beaver) LTS:
wget https://repo.zabbix.com/zabbix/4.0/ubuntu/pool/main/z/zabbix-release/zabbix-release_4.0-2+bionic_all.deb sudo dpkg -i zabbix-release_4.0* sudo apt update
Add Zabbix 4.0 repository on Ubuntu 16.04 (Xenial Xerus) LTS:
wget https://repo.zabbix.com/zabbix/4.0/ubuntu/pool/main/z/zabbix-release/zabbix-release_4.0-2+xenial_all.deb sudo dpkg -i zabbix-release_4.0*
Then install Zabbix agent
sudo apt install zabbix-agent zabbix-sender
Step 2: Configuring Zabbix Agent
Zabbix agent configuration is /etc/zabbix/zabbix_agentd.conf. Edit
# cat /etc/zabbix/zabbix_agentd.conf # On line 97 - Specify Zabbix server IP Address Server=192.168.10.2 # On line 138 - Specify Zabbix server ( For active checks) ServerActive=192.168.10.2 # On line 150 - 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:
$ sudo systemctl status zabbix-agent ● zabbix-agent.service - Zabbix Agent Loaded: loaded (/usr/lib/systemd/system/zabbix-agent.service; enabled; vendor preset: disabled) Active: active (running) since Tue 2018-10-16 22:30:00 UTC; 50s ago Main PID: 28026 (zabbix_agentd) CGroup: /system.slice/zabbix-agent.service ├─28026 /usr/sbin/zabbix_agentd -c /etc/zabbix/zabbix_agentd.conf ├─28027 /usr/sbin/zabbix_agentd: collector [idle 1 sec] ├─28028 /usr/sbin/zabbix_agentd: listener #1 [waiting for connection] ├─28029 /usr/sbin/zabbix_agentd: listener #2 [waiting for connection] ├─28030 /usr/sbin/zabbix_agentd: listener #3 [waiting for connection] └─28031 /usr/sbin/zabbix_agentd: active checks #1 [idle 1 sec]
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:
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:
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
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.