In our previous guide, we covered the installation of Zabbix Server on Ubuntu 18.04. 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 to Install Zabbix agent on Ubuntu 18.04.
See Updated Article for Zabbix Agent 4.0 below:
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:
How to Install Zabbix agent on Ubuntu 18.04
Below steps are used to install Zabbix agent on Ubuntu 18.04.
Step 1: Add Zabbix repositories
Add Zabbix 3.4 repositories using the commands below:
$ wget http://repo.zabbix.com/zabbix/3.4/ubuntu/pool/main/z/zabbix-release/zabbix-release_3.4-1+bionic_all.deb --2018-06-14 08:00:08-- http://repo.zabbix.com/zabbix/3.4/ubuntu/pool/main/z/zabbix-release/zabbix-release_3.4-1+bionic_all.deb Resolving repo.zabbix.com (repo.zabbix.com)... 18.104.22.168 Connecting to repo.zabbix.com (repo.zabbix.com)|22.214.171.124|:80... connected. HTTP request sent, awaiting response... 200 OK Length: 3952 (3.9K) [application/octet-stream] Saving to: ‘zabbix-release_3.4-1+bionic_all.deb’ $ sudo dpkg -i zabbix-release_3.4-1+bionic_all.deb Selecting previously unselected package zabbix-release. (Reading database ... 109198 files and directories currently installed.) Preparing to unpack zabbix-release_3.4-1+bionic_all.deb ... Unpacking zabbix-release (3.4-1+bionic) ... Setting up zabbix-release (3.4-1+bionic) ... $ sudo apt-get install zabbix-agent Reading package lists... Done Building dependency tree Reading state information... Done The following NEW packages will be installed: zabbix-agent 0 upgraded, 1 newly installed, 0 to remove and 2 not upgraded. Need to get 197 kB of archives. After this operation, 664 kB of additional disk space will be used. Get:1 http://mirrors.digitalocean.com/ubuntu bionic/universe amd64 zabbix-agent amd64 1:3.0.12+dfsg-1 [197 kB] Fetched 197 kB in 3s (71.3 kB/s) Selecting previously unselected package zabbix-agent.... .....
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 # Set 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 renabled, 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.