How to Install Zabbix Agent on Rocky Linux/Alma Linux 8

Pinterest LinkedIn Tumblr

A Zabbix agent is a program that runs on a remote machine that needs to be monitored through the Zabbix server. The agent collects the data on the remote server and send back to Zabbix server when requested. Zabbix agent must be installed on all the remote systems that need to be monitor through the Zabbix server.

There are two types of checks:

  • Passive Check – Zabbix Agent sent data to server on their request.
  • Active Check – Zabbix Agent sends data periodically to server.

In this article, we will learn how to install the Zabbix agent in RHEL 8 based distributions like the Rocky Linux or Alma Linux. Checkout this guide on How to Install and Configure Zabbix Server 5 on Rocky Linux/Alma Linux 8.

Related content:

Table of Content

  1. Ensure that the server is up to date
  2. Install the Zabbix Agent
  3. Configure Zabbix Agent

1. Ensure that the server packages are up to date

Before proceeding, let us make sure that our server packages are up to date with this command:

sudo dnf -y update

Let us also install some common packages that we will need

sudo dnf install -y vim

2. Install the Zabbix Agent

The Zabbix agent packages are not available under the default Rocky Linux 8 repositories. We will need to configure the Zabbix repository in our system before installing the agent.

The latest Zabbix version as at the writing of this article is Zabbix version 5.4. Install the Zabbix version 5.4 repository using this command:

sudo dnf install -y

Once the repository is installed, we can install the agent. Use this command:

sudo dnf install -y zabbix-agent

Confirm the software version installed:

$ rpm -qi zabbix-agent
Name        : zabbix-agent
Version     : 5.4.9
Release     : 1.el8
Architecture: x86_64
Install Date: Mon 17 Jan 2022 06:23:27 AM UTC
Group       : Applications/Internet
Size        : 2353430
License     : GPLv2+
Signature   : RSA/SHA512, Thu 23 Dec 2021 12:54:16 PM UTC, Key ID 082ab56ba14fe591
Source RPM  : zabbix-5.4.9-1.el8.src.rpm
Build Date  : Thu 23 Dec 2021 12:28:37 PM UTC
Build Host  : 3a869a1545a8
Relocations : (not relocatable)
URL         :
Summary     : Old Zabbix Agent
Description :
Old implementation of zabbix agent.
To be installed on monitored systems.

3. Configure Zabbix Agent

Now, you need to configure the Agent service to allow Zabbix server requests. We will also update the Hostname so we know which server we configured the agent on. Edit the Zabbix agent configuration file by adding the Zabbix server IP.

sudo vim /etc/zabbix/zabbix_agentd.conf

Add this content:


4. Disable SELinux and Adjust Firewall for Zabbix

If you have firewall installed and enabled, you will need to allow the Zabbix ports 10050 and 10051. and HTTP service through the firewall. You can allow them with the following command:

firewall-cmd --permanent --add-port=10050/tcp
firewall-cmd --reload

You will also need to set SELinux to permissive in order to access the frontend from a browser. To do that, run the command:

sudo setenforce 0
sudo sed -i 's/SELINUX=enforcing/SELINUX=permissive/g' /etc/selinux/config

5. Start and enable the Zabbix agent

We can now start the agent. The agent is not started by default. Use this command to start:

sudo systemctl start zabbix-agent

Check the status to confirm that it is started.

$ 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 Mon 2022-01-17 06:57:33 UTC; 19s ago
  Process: 39725 ExecStop=/bin/kill -SIGTERM $MAINPID (code=exited, status=0/SUCCESS)
  Process: 39728 ExecStart=/usr/sbin/zabbix_agentd -c $CONFFILE (code=exited, status=0/SUCCESS)
 Main PID: 39730 (zabbix_agentd)
    Tasks: 6 (limit: 23176)
   Memory: 3.9M
   CGroup: /system.slice/zabbix-agent.service
           ├─39730 /usr/sbin/zabbix_agentd -c /etc/zabbix/zabbix_agentd.conf
           ├─39732 /usr/sbin/zabbix_agentd: collector [idle 1 sec]
           ├─39733 /usr/sbin/zabbix_agentd: listener #1 [waiting for connection]
           ├─39734 /usr/sbin/zabbix_agentd: listener #2 [waiting for connection]
           ├─39735 /usr/sbin/zabbix_agentd: listener #3 [waiting for connection]
           └─39736 /usr/sbin/zabbix_agentd: active checks #1 [idle 1 sec]

Jan 17 06:57:33 systemd[1]: zabbix-agent.service: Succeeded.
Jan 17 06:57:33 systemd[1]: Stopped Zabbix Agent.
Jan 17 06:57:33 systemd[1]: Starting Zabbix Agent...
Jan 17 06:57:33 systemd[1]: zabbix-agent.service: Can't open PID file /run/zabbix/ (yet?) after start: No such file or directory
Jan 17 06:57:33 systemd[1]: Started Zabbix Agent.

From the above output, we can confirm that the agent is running. To enable the agent to start on boot, use this command:

sudo systemctl enable zabbix-agent

That is it! You have successfully installed Zabbix Agent on your Rocky Linux Machine. You can now proceed to add host in zabbix server to be monitored. Checkout this guide How to Add Host in Zabbix Server to Monitor.

I am a Devops Engineer, but I would describe myself as a Tech Enthusiast who is a fan of Open Source, Linux, Automations, Cloud and Virtualization. I love learning and exploring new things so I blog in my free time about Devops related stuff, Linux, Automations and Open Source software. I can also code in Python and Golang.

Write A Comment