Installation the Zabbix Agent
บันทึกการติดตั้ง agent ของ zabbix บน linux
Red Hat Enterprise Linux / CentOS
To install agent after correct repository configuration package is installed, run the following command:
yum install zabbix-agent
Now agent is ready to be started by:
systemctl start zabbix-agent
Debian / Ubuntu
To install agent after correct repository configuration package is installed, run the following command:
apt-get install zabbix-agent
Now agent is ready to be started by:
service zabbix-agent start
Almalinux / Other platform
Install Zabbix repository https://www.zabbix.com/download?zabbix=6.0&os_distribution=alma_linux&os_version=8&components=agent&db=&ws=
rpm -Uvh https://repo.zabbix.com/zabbix/6.0/rhel/8/x86_64/zabbix-release-6.0-4.el8.noarch.rpm
dnf clean all
Install Zabbix agent
dnf install zabbix-agent
Start Zabbix agent process and make it start at system boot.
systemctl restart zabbix-agent
systemctl enable zabbix-agent
Configuring the Zabbix Agent
แก้ไขไฟล์ /etc/zabbix/zabbix_agentd.conf
แก้ไข Server=127.0.0.1 เป็นเลข IP ของ zabbix ที่เราใช้งาน
### Option: Server
# List of comma delimited IP addresses (or hostnames) of Zabbix servers.
# Incoming connections will be accepted only from the hosts listed here.
# If IPv6 support is enabled then '127.0.0.1', '::127.0.0.1', '::ffff:127.0.0.1' are treated equally.
#
# Mandatory: no
# Default:
# Server=
Server=127.0.0.1
Allow Firewall
ปกติแล้วหลังจากที่ิติดตั้ง zabbix agent มันจะ allow port ให้อัตโนมัติ แต่ถ้ายังไม่ชัวร์ ให้ลองตรวจสอบดูอีกรอบ
Iptables
iptables -A INPUT -p tcp -m tcp --dport 10050 -j ACCEPT
iptables-save > /etc/iptables/rules.v4
Ubuntu
sudo ufw allow 10050/tcp
RedHat / Centos
firewall-cmd --new-zone=zabbix --permanent
firewall-cmd --permanent --zone=zabbix --add-port=10050/tcp
firewall-cmd --reload