Install and Configure Zabbix Agent on Ubuntu 20.04/18.04

Posted on 97 views

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.

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

Ubuntu 20.04:

wget https://repo.zabbix.com/zabbix/6.0/ubuntu/pool/main/z/zabbix-release/zabbix-release_6.0-1+ubuntu20.04_all.deb
sudo dpkg -i zabbix-release_6.0-1+ubuntu20.04_all.deb

Ubuntu 18.04:

wget https://repo.zabbix.com/zabbix/6.0/ubuntu/pool/main/z/zabbix-release/zabbix-release_6.0-1+ubuntu18.04_all.deb
sudo dpkg -i zabbix-release_6.0-1+ubuntu18.04_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.computingpost.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

zabbix-agent-add-host

Then go to Templates tab.

1. Click the select button and 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 under Linked templates section

zabbix-agent-add-linked-templates

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 >

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

zabbix-agent-graph-cpu

zabbix-agent-graph-ram

coffee

Gravatar Image
A systems engineer with excellent skills in systems administration, cloud computing, systems deployment, virtualization, containers, and a certified ethical hacker.