AlmaLinux

Install Zabbix Agent 2 on Rocky Linux 10 / AlmaLinux 10

Every server you add to Zabbix needs an agent collecting metrics on the host side. Zabbix Agent 2 handles that job. Written in Go with a plugin architecture, it gathers CPU, memory, disk, network, and process data, then ships it to your Zabbix server for alerting and visualization. Agent 2 replaced the legacy C-based agent starting with Zabbix 5.0 and is now the recommended choice for all new deployments.

Original content from computingforgeeks.com - post 111292

This guide covers installing and configuring Zabbix 7.0 LTS Agent 2 on Rocky Linux 10 and AlmaLinux 10, including SELinux configuration, firewall rules, and adding the host to a Zabbix server. The same steps work on RHEL 10 with no changes.

Prerequisites

  • A server running Rocky Linux 10 or AlmaLinux 10 with root or sudo access
  • A working Zabbix 7.0 server that this agent will report to
  • The Zabbix server’s IP address (the agent needs to know where to send data)
  • Port 10050/TCP open between the agent and the Zabbix server

Install Zabbix 7.0 Agent 2 Repository

Zabbix Agent 2 packages are not in the default Rocky Linux repositories. Add the official Zabbix 7.0 LTS repository first:

sudo dnf install -y https://repo.zabbix.com/zabbix/7.0/rhel/10/x86_64/zabbix-release-latest-7.0.el10.noarch.rpm

Clean the dnf cache so the new repository metadata gets picked up:

sudo dnf clean all

If you have EPEL enabled, exclude Zabbix packages from it to avoid version conflicts:

sudo dnf config-manager --save --setopt=epel.excludepkgs='zabbix*'

Install Zabbix Agent 2 and Plugins

Install the agent along with all available monitoring plugins. The plugins extend Agent 2 with native support for PostgreSQL, MongoDB, MSSQL, and other services:

sudo dnf install -y zabbix-agent2 zabbix-agent2-plugin-*

Verify the installed version:

zabbix_agent2 -V

The output confirms Zabbix Agent 2 7.0.x built with Go:

zabbix_agent2 (Zabbix) 7.0.24
Revision 36bdd34b378 12 March 2026, compilation time: Mar 12 2026 20:47:34, built with: go1.24.10

Check which plugins were installed:

rpm -qa | grep zabbix-agent2-plugin | sort

You should see plugins for Ember+, MongoDB, MSSQL, and PostgreSQL:

zabbix-agent2-plugin-ember-plus-7.0.24-release1.el10.x86_64
zabbix-agent2-plugin-mongodb-7.0.24-release1.el10.x86_64
zabbix-agent2-plugin-mssql-7.0.24-release1.el10.x86_64
zabbix-agent2-plugin-postgresql-7.0.24-release1.el10.x86_64

Configure Zabbix Agent 2

The Agent 2 configuration file is at /etc/zabbix/zabbix_agent2.conf. Open it and set the Zabbix server address and agent hostname:

sudo vi /etc/zabbix/zabbix_agent2.conf

Find and update these three directives. Replace 192.168.1.100 with your actual Zabbix server IP:

Server=192.168.1.100
ServerActive=192.168.1.100
Hostname=rocky10-web01

Here is what each directive does:

  • Server – IP address of the Zabbix server that sends passive check requests to this agent. Multiple servers can be comma-separated
  • ServerActive – IP address where the agent sends active check results. Active checks are more efficient because the agent pushes data on a schedule rather than waiting for the server to poll
  • Hostname – must match exactly what you configure in the Zabbix web frontend when adding this host. Case-sensitive

If you want to test the agent locally with zabbix_get before connecting to the server, add 127.0.0.1 to the Server line:

Server=192.168.1.100,127.0.0.1

Validate the configuration file for syntax errors before starting the service:

zabbix_agent2 -T

A valid config returns:

Validating configuration file "/etc/zabbix/zabbix_agent2.conf"
Validation successful

Configure Firewall and SELinux

Zabbix Agent 2 listens on TCP port 10050 for passive check requests from the server. If your server was provisioned from a minimal or cloud image, install firewalld first:

sudo dnf install -y firewalld
sudo systemctl enable --now firewalld

Open the agent port:

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

Verify the rule is active:

sudo firewall-cmd --list-ports

The output should include port 10050:

10050/tcp

Rocky Linux 10 runs SELinux in enforcing mode by default. The Zabbix Agent 2 package includes the necessary SELinux policy, so no extra SELinux configuration is needed. Verify there are no AVC denials after starting the agent:

sudo ausearch -m avc -ts recent | grep zabbix

No output means no SELinux denials. The agent is running within policy.

Start and Enable the Agent Service

Start Zabbix Agent 2 and enable it to start on boot:

sudo systemctl enable --now zabbix-agent2

Confirm the service is running:

sudo systemctl status zabbix-agent2

The output should show active (running):

● zabbix-agent2.service - Zabbix Agent 2
     Loaded: loaded (/usr/lib/systemd/system/zabbix-agent2.service; enabled; preset: disabled)
     Active: active (running)
   Main PID: 4909 ((x_agent2))
     CGroup: /system.slice/zabbix-agent2.service
             └─4909 "(x_agent2)"

Verify the agent is listening on port 10050:

ss -tlnp | grep 10050

Expected output confirming the agent is bound to all interfaces:

LISTEN 0  4096  *:10050  *:*  users:(("zabbix_agent2",pid=4909,fd=8))

Test Agent Connectivity

If you included 127.0.0.1 in the Server directive, you can test the agent locally with zabbix_get. Install it first:

sudo dnf install -y zabbix-get

Query a few metrics to confirm the agent responds:

zabbix_get -s 127.0.0.1 -k agent.version

This returns the agent version string:

7.0.24

Check system uptime in seconds:

zabbix_get -s 127.0.0.1 -k system.uptime

Get the system hostname:

zabbix_get -s 127.0.0.1 -k system.hostname

If zabbix_get returns “connection rejected, allowed hosts”, the Server directive does not include the IP you are connecting from. Add it to the Server line and restart the agent.

From the Zabbix server, test remote connectivity to the agent:

zabbix_get -s 192.168.1.120 -k agent.version

Replace 192.168.1.120 with the agent host’s IP. If this times out, check the firewall on the agent host and verify network connectivity between the two servers.

Add the Host in Zabbix Web Frontend

With the agent running on the remote host, add it to the Zabbix server through the web frontend:

  1. Navigate to Data collection > Hosts and click Create host
  2. Set Host name to match the Hostname value in zabbix_agent2.conf exactly (e.g., rocky10-web01)
  3. Under Host groups, select Linux servers
  4. Under Interfaces, click Add > Agent. Enter the agent host’s IP address and port 10050
  5. Switch to the Templates tab. Search for and link Linux by Zabbix agent – this template covers CPU, memory, disk, network, and process monitoring out of the box
  6. Click Add to save

Within a few minutes, the ZBX availability icon next to the host turns green, confirming the server is successfully polling the agent. If it stays grey or turns red, check the agent log:

sudo tail -20 /var/log/zabbix/zabbix_agent2.log

Common issues include hostname mismatches (case matters), the Server directive not including the Zabbix server’s IP, or firewall rules blocking port 10050.

Zabbix Agent 2 vs Legacy Agent

If you are migrating from the older Zabbix Agent (C-based), here are the key differences:

FeatureAgent (legacy)Agent 2
LanguageCGo
Config filezabbix_agentd.confzabbix_agent2.conf
PluginsLoadable modules (.so)Native Go plugins
Built-in DB monitoringNo (requires scripts)Yes (PostgreSQL, MySQL, MongoDB, MSSQL)
Active checks schedulingBasicFlexible intervals
Config validationNozabbix_agent2 -T
Persistent bufferNoYes (survives restarts)

Agent 2 runs as a single process (no child processes like the legacy agent), uses less memory per monitored item, and the plugin architecture means you can monitor databases and services without external scripts.

Troubleshooting

Agent not starting

Check the log at /var/log/zabbix/zabbix_agent2.log. The most common cause is a syntax error in the config file. Run zabbix_agent2 -T to validate.

Connection rejected errors in log

Messages like connection from "x.x.x.x" rejected, allowed hosts: "y.y.y.y" mean the connecting IP is not in the agent’s Server directive. Add the missing IP to Server= and restart:

sudo systemctl restart zabbix-agent2

ZBX icon stays red in frontend

Work through these checks in order:

  1. Verify the Hostname in zabbix_agent2.conf matches the host name in the Zabbix frontend exactly
  2. From the Zabbix server, run zabbix_get -s AGENT_IP -k agent.version to test connectivity
  3. Check that port 10050 is open on the agent’s firewall: firewall-cmd --list-ports
  4. Check the agent log: tail -30 /var/log/zabbix/zabbix_agent2.log

Conclusion

Zabbix Agent 2 is running on your Rocky Linux 10 / AlmaLinux 10 host and reporting to the Zabbix server. The Linux by Zabbix agent template provides comprehensive monitoring out of the box – CPU, memory, disk, network, filesystem, and process metrics. For database monitoring, the installed plugins handle PostgreSQL, MongoDB, and MSSQL without any external scripts. For monitoring Ubuntu hosts, the same Zabbix Agent 2 is available from the Zabbix repository for Debian-based distributions.

Related Articles

AlmaLinux How To Upgrade to AlmaLinux 9 from AlmaLinux 8 AlmaLinux Configure MariaDB Primary-Replica Replication on Rocky Linux 10 Databases How To Monitor MariaDB using Prometheus and Grafana Monitoring How To Install Nagios on Ubuntu 24.04 (Noble Numbat)

Leave a Comment

Press ESC to close