11.12.2024

How to Install and Configure Zabbix Agent on CentOS 8

The Zabbix agent runs on client machines, collects and sends data to the Zabbix server. Therefore, all remote machines must be provided with a client for the server to work. We recently installed Zabbix server. In this tutorial, we will walk through the necessary steps to install and configure the Zabbix agent on CentOS 8.

Turning SELinux off

It is better to disable SELinux for Zabbix to work correctly. So, open the configuration file.

nano /etc/selinux/config

Set SELINUX to disabled.

SELINUX=disabled

Save and close the file, and then restart the system.

Installing Zabbix agent

Now add the Zabbix repository to be able to install the agent.

rpm -Uvh https://repo.zabbix.com/zabbix/5.0/rhel/8/x86_64/zabbix-release-5.0-1.el8.noarch.rpm
dnf clean all

Let's install the Zabbix agent package.

dnf install zabbix-agent

Now start the service and make it start with system boot.

systemctl enable --now zabbix-agent

Zabbix agent configuration

Open the Zabbix configuration file.

nano /etc/zabbix/zabbix_agentd.conf

Find and set the correct values for the next parameters:

Server=10.5.5.1
ServerActive=10.5.5.1
Hostname=client

The first two of them must contain the IP address of the Zabbix server, and the Hostname is the name of this client that will be displayed in statistics on the server.

Now restart the service.

systemctl restart zabbix-agent

Firewall configuration

Open the 10050, 10051, http,https ports for Zabbix to work.

firewall-cmd --add-service={http,https} --permanent
firewall-cmd --add-port={10051/tcp,10050/tcp} --permanent
firewall-cmd --reload