2024/07/03

Zabbix Agent2 安裝 - CentOS 7 - For Zabbix 7.0

 

安裝 Zabbix Agent2

$ sudo rpm -Uvh https://repo.zabbix.com/zabbix/7.0/rhel/7/x86_64/zabbix-agent2-7.0.0-release1.el7.x86_64.rpm

這時候可能會出現錯誤

-bash-4.2$ sudo rpm -Uvh https://repo.zabbix.com/zabbix/7.0/rhel/7/x86_64/zabbix-agent2-7.0.0-release1.el7.x86_64.rpm
Retrieving https://repo.zabbix.com/zabbix/7.0/rhel/7/x86_64/zabbix-agent2-7.0.0-release1.el7.x86_64.rpm
warning: /var/tmp/rpm-tmp.EdHcOD: Header V4 RSA/SHA512 Signature, key ID b5333005: NOKEY
error: Failed dependencies:
        libpcre2-8.so.0()(64bit) is needed by zabbix-agent2-7.0.0-release1.el7.x86_64

缺少了套件 libpcre - 安裝 pcre2

 $ sudo yum install pcre2

無法下載 rpm 套件

$ sudo rpm -Uvh https://repo.zabbix.com/zabbix/7.0/rhel/7/x86_64/zabbix-agent2-7.0.0-release1.el7.x86_64.rpm
Retrieving https://repo.zabbix.com/zabbix/7.0/rhel/7/x86_64/zabbix-agent2-7.0.0-release1.el7.x86_64.rpm
curl: (56) TCP connection reset by peer
error: skipping https://repo.zabbix.com/zabbix/7.0/rhel/7/x86_64/zabbix-agent2-7.0.0-release1.el7.x86_64.rpm - transfer failed

這個是因為缺少能下載的 wget 功能,所以再裝一下 wget 

$ sudo yum install wget

安裝 pcre2 後安裝 Zabbix Agent2 - 這樣就能正確的安裝

 $ sudo rpm -Uvh https://repo.zabbix.com/zabbix/7.0/rhel/7/x86_64/zabbix-agent2-7.0.0-release1.el7.x86_64.rpm
Retrieving https://repo.zabbix.com/zabbix/7.0/rhel/7/x86_64/zabbix-agent2-7.0.0-release1.el7.x86_64.rpm
warning: /var/tmp/rpm-tmp.DcCY4T: Header V4 RSA/SHA512 Signature, key ID b5333005: NOKEY
Preparing...                          ################################# [100%]
Updating / installing...
   1:zabbix-agent2-7.0.0-release1.el7 ################################# [100%]

 修改設定檔

$ sudo vi /etc/zabbix/zabbix_agent2.conf

然後修改下面項目,當然要把 10.1.2.3 換成你的 zabbix server

Server=10.1.2.3
ServerActive=10.1.2.3
ListenPort=10050
ListenIP=10.5.6.7
Hostname=Zabbix Client

然後啟動服務

$ sudo systemctl restart zabbix-agent2

$ sudo systemctl enable zabbix-agent2

$ sudo systemctl status zabbix-agent2

檢查 tcp 與 tcp6 的 10050 port 是否已正確 Listen

$ netstat -an | more

 

 執行都OK,就可以到 zabbix server 上把這台 CentOS 7 的主機加入監測。

~END

 



 

 


 

沒有留言:

張貼留言

Ubuntu 如何查看及變更時區 TimeZone

使用指令 timedatectl 查看目前 ubuntu 的時區設定 $ timedatectl 列出所有 Asia 的時區 $ timedatectl list-timezones | grep Asia 變更時區為 Asia/Taipei $ sudo timedatectl...