Zabbix Agent is a process that runs on remote machines, which need to monitor 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.
Basically, 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.
After installing zabbix server on your system. Now we are moving to install agent on remote system’s. This article will help you to install zabbix agent on CentOS/RHEL 8 Linux systems. After completing this step go to next article add Host in Zabbix Server.
Step 1 – Disable SELinux
By default, SELinux is enabled in CentOS 8. You can disable the SELinux to work Zabbix properly on your CentOS machine.
You can disable the SELinux by editing /etc/selinux/config file:
nano /etc/selinux/config
Change the following line:
SELINUX=disabled
Press CTRL + O to save changes and then CTRL + X to close file. Then restart your server to apply changes.
Step 2 – Installing Zabbix Agent
The Zabbix agent packages are not available under the default CentOS 8 repositories. So first, you will need to configure the Zabbix repository in your system.
At the time of writing this tutorial, the latest version of Zabbix is Zabbix 4.4. You can install the Zabbix 4.4 repository package by running the following command:
dnf install https://repo.zabbix.com/zabbix/4.4/rhel/8/x86_64/zabbix-release-4.4-1.el8.noarch.rpm
After installing yum repository packages in our system. Use the following command to install the Zabbix agent on your CentOS 8 or RHEL 8 systems using the package management tool.
dnf install zabbix-agent
Press ‘Y’ for any confirmation to complete the installation process.
Step 3 – Configure Zabbix Agent
Now, you need to configure the Agent service to allow Zabbix server requests. Edit the Zabbix agent configuration file by adding the Zabbix server IP.
/etc/zabbix/zabbix_agentd.conf
#Server=[zabbix server ip] #Hostname=[ Hostname of client system ] Server=192.168.1.100 Hostname=Server1
Step 4 – Adjust Firewall for Zabbix
Next, 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
Step 5 – Start Zabbix Agent
Your zabbix agent service is ready to run. Execute the following commands to enable service to auto start on system boot. Then also start service for the first time:
systemctl enable zabbix-agent systemctl start zabbix-agent
To stop zabbix-agent service anytime run the following command:
systemctl stop zabbix-agent
8 Comments
With RHEL8, there is an issue with PCP. The error “cannot initialize module zbxpcp.so” is generated. The solution that worked for me was the command I found in “https://www.zabbix.com/forum/zabbix-help/380685-agent-dont-start-after-instalation-zbxpcp-so”, yum remove pcp-export-zabbix-agent.
This part seems to be an issue:
dnf install zabbix zabbix-agent
Specifically
dnf install zabbix-agent < this works
dnf install zabbix < does not work
Rahul,
I’d really encourage you to add in SELinux support vs disabling as Pablo pointed out. I’d also suggest folks use the most current agent and enable encryption with a cert
Ok, 2 things to add to this tutorial:
1. DO NOT DISABLE SElinux- it is there for a reason – the reason being security as name suggests.
Instead, execute these commands to allow zabbix-agent to communicate with server:
setsebool -P httpd_can_connect_zabbix on
setsebool -P httpd_can_network_connect_db on
these with explanation can be found on OFFICIAL zabbix site – https://www.zabbix.com/documentation/4.4/manual/installation/install_from_packages/rhel_centos
2. If You want to use acitve checks, You also need to change in /etc/zabbix/zabbix_agentd.conf line:
ServerActive=[zabbix server ip]
that guide does not work anymore
Hi Rafa, What issue are you facing with this tutorial.
am getting the following:
Error: Transaction test error:
file /etc/zabbix/zabbix_agentd.conf conflicts between attempted installs of zabbix40-4.0.17-1.el8.x86_64 and zabbix-agent-4.4.10-1.el8.x86_64
step 1 is just wrong, it’s like permissions are wrong, let’s put 777