In our previous guide, we covered the installation of Zabbix Server on Ubuntu Server. 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 see how you can install Zabbix agent on Ubuntu 20.04/18.04 server.
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 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 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:
Install Zabbix agent on Ubuntu 18.04 / 20.04
Below steps are used to install Zabbix agent on Ubuntu 18.04 / 20.04:
Step 1: Add Zabbix repositories
Add Zabbix repositories using the commands below:
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
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
Step 2: Install and Configure Zabbix Agent
Once repository is added install the packages:
sudo apt update sudo apt install zabbix-agent
Zabbix agent configuration is /etc/zabbix/zabbix_agentd.conf. Edit
$ sudo vim /etc/zabbix/zabbix_agentd.conf #Specify Zabbix server IP Address Server=192.168.10.2 #Specify Zabbix server ( For active checks) ServerActive=192.168.10.2 # Set this server hostname reported by Zabbix agent Hostname=node-01.computingforgeeks.com
Restart zabbix-agent after making the change:
sudo systemctl restart zabbix-agent sudo systemctl status zabbix-agent
If you have ufw enabled, allow port 10050 on the firewall. This is used by Zabbix agent daemon.
sudo ufw allow 10050/tcp
Step 3: Add host to Zabbix Server
Login to admin Zabbix server interface, and go to Configuration > Hosts > Create host
You’ll need to fill out the following information:
- Host name of the server to be monitored
- Visible name for 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 Templates tab.
1. Click the select button and Link new templates section
Select the templates you want to use:
Update the setting using Update button. After 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.