How to Install Zabbix Agent on CentOS/Ubuntu

zabbix zabbix-agent

How to Install Zabbix Agent on CentOS/Ubuntu

Zabbix Agent is required to install on all remote systems needs to be monitor through Zabbix server.

The Zabbix Agent collects resource utilization data and applications data on client system and provide such information to Zabbix server on their requests.

There are two types of checks between Zabbix Server and Client.

- 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 server, Now we are moving to install agent on remote system’s. This article will help you to install zabbix agent on CentOS/RHEL 7/6/5 systems. After completing this step go to next article add Host in Zabbix Server.

Step 1 – Add Required Repository

Before installing Zabbix Agent first configure zabbix yum repository using following commands as per your required version and operating system.

CentOS/RHEL 7:
#rpm -Uvh 
# 13.07.2020
#rpm -Uvh ls zabbix-agent-5.0.2-1.el7.x86_64.rpm
# 31.05.2021
rpm -ivh zabbix-agent2-5.0.9-1.el7.x86_64.rpm

CentOS/RHEL 6:
# rpm -Uvh

CentOS/RHEL 5:
# rpm -Uvh

Step 2 – Install Zabbix Agent

After install yum repository packages in our system. Now use following command to install Zabbix agent on your Linux system.

# yum install zabbix-agent

Step 3 – Edit Zabbix Agent Configuration

As zabbix agent has been successfully installed on our remote system. Now we just need to configure zabbix agent by adding zabbix server ip in its configuration file /etc/zabbix/zabbix_agentd.conf

#Server=[zabbix server ip]
#Hostname=[ Hostname of client system ]


Step 4 – Restarting Zabbix Agent

After adding zabbix server ip in configuration file, now restart agent service using below command.

# /etc/init.d/zabbix-agent restart

To start and stop zabbix-agent service anytime use following commands.

# /etc/init.d/zabbix-agent start
# /etc/init.d/zabbix-agent stop

Step 5 - Add service to autostart

#chkconfig zabbix-agent on
#sudo update-rc.d zabbix-agent defaults

Step 6 - Add firewall rules

Centos 6

# iptables -I INPUT -p tcp --dport 10050 -j ACCEPT
# yum install iptables-services
# service iptables save
# service iptables restart

Centos 7   firewall\-cmd

firewall-cmd --zone=public --add-port=10050/tcp --permanent
firewall-cmd --reload
# подробнее здесь:


Надо прописать и сохранить в файле текущие правила:

# iptables -I INPUT -p tcp --dport 10050 -j ACCEPT
iptables-save > /etc/iptables.rules

Пропишем в /etc/network/interfaces

auto eth0
iface eth0 inet dhcp
  pre-up iptables-restore < /etc/iptables.rules
  #post-down iptables-restore < /etc/iptables.downrules


В Ubuntu 16.04 так делать нельзя - там надо применять пакет iptables-persistent

см. статью “Persistent Iptables Rules in Ubuntu 16.04 Xenial Xerus”