Hướng dẫn cài đặt Zabbix Agent trên CentOS 7

Thiết lập Zabbix Agent phiên bản 3.4.5 cho hệ thống giám sát trên nền tảng CentOS 7, sử dụng gói cài đặt RPM từ kho lưu trữ chính thức.

Quy trình triển khai

1. Tải gói cài đặt trực tiếp từ repository:

[root@server-mon ~]# mkdir -p /opt/monitoring/agent
[root@server-mon ~]# cd /opt/monitoring/agent
[root@server-mon agent]# wget https://repo.zabbix.com/zabbix/3.4/rhel/7/x86_64/zabbix-agent-3.4.5-1.el7.x86_64.rpm
[root@server-mon agent]# wget https://repo.zabbix.com/zabbix/3.4/rhel/7/x86_64/zabbix-sender-3.4.5-1.el7.x86_64.rpm

2. Cài đặt các gói RPM bằng trình quản lý gói:

[root@server-mon agent]# yum localinstall -y *.rpm
Loaded plugins: langpacks
Resolving Dependencies
--> Running transaction check
---> Package zabbix-agent.x86_64 0:3.4.5-1.el7 installed
---> Package zabbix-sender.x86_64 0:3.4.5-1.el7 installed
Installed:
  zabbix-agent.x86_64 0:3.4.5-1.el7     zabbix-sender.x86_64 0:3.4.5-1.el7
Complete!

3. Điều chỉnh cấu hình chính trong tập tin /etc/zabbix/zabbix_agentd.conf:

PidFile=/var/run/zabbix/zabbix_agentd.pid
LogFile=/var/log/zabbix/agent.log
Server=192.168.10.100        # Địa chỉ máy chủ giám sát (chế độ thụ động)
ServerActive=192.168.10.100  # Địa chỉ máy chủ (chế độ chủ động)
Hostname=web-server-01       # Tên máy phải khớp với cấu hình trên Zabbix Server
Include=/etc/zabbix/conf.d/*.conf
UnsafeUserParameters=1       # Cho phép tham số người dùng tùy chỉnh

4. Khởi động dịch vụ và kích hoạt khởi động cùng hệ thống:

[root@server-mon ~]# systemctl daemon-reload
[root@server-mon ~]# systemctl start zabbix-agent
[root@server-mon ~]# systemctl enable zabbix-agent
Created symlink from /etc/systemd/system/multi-user.target.wants/zabbix-agent.service to /usr/lib/systemd/system/zabbix-agent.service.
[root@server-mon ~]# ss -tuln | grep 10050
tcp    LISTEN     0      128      *:10050                *:*

5. Xác thực kết nối từ máy chủ giám sát:

[root@monitoring-srv ~]# zabbix_get -s 192.168.10.50 -k "system.cpu.load[all,avg1]"
0.15
[root@monitoring-srv ~]# zabbix_get -s 192.168.10.50 -k "vm.memory.size[available]"
3892148224

Trên giao diện Zabbix Server, thêm máy chủ mới với tên web-server-01 và liên kết các template giám sát phù hợp. Kiểm tra trạng thái kết nối qua biểu tượng ZBX màu xanh lá cây trong phần Hosts.

Thẻ: zabbix-agent centos7 system-monitoring

Đăng vào ngày 21 tháng 6 lúc 07:45