1.環境說明:
環境 | ip | hostname | 要安裝的應用 |
伺服器 | 192.168.59.131 | server | lamp架構 zabbix server zabbix agent |
用戶端 | 192.168.59.133 | 139 |
2用戶端配置檔案zabbix_agentd.conf常用配置參數:
參數 | 作用 |
---|---|
Server | 指定zabbix伺服器的IP或域名 |
ServerActive | |
Hostname | 指定本機的主機名,此項必須與web界面配置項一緻 |
UnsafeUserParameters | 是否啟用自定義監控項,可選值為{1 | 0} |
UserParameter | 指定自定義監控腳本參數 |
LogFile | 設定用戶端日志檔案存放路徑 |
3.部署用戶端:
#傳輸zabbix
[root@server ~]# scp zabbix-5.2.6.tar.gz 192.168.59.133:/root/
The authenticity of host '192.168.59.133 (192.168.59.133)' can't be established.
ECDSA key fingerprint is SHA256:nLe11i1nfIrpLVReliBQKOkJiRlvKvVZ0vQBaJGq1qU.
Are you sure you want to continue connecting (yes/no/[fingerprint])? y
Please type 'yes', 'no' or the fingerprint: yes
Warning: Permanently added '192.168.59.133' (ECDSA) to the list of known hosts.
[email protected]'s password:
zabbix-5.2.6.tar.gz 100% 20MB 54.1MB/s 00:00
[root@139 ~]# ls
anaconda-ks.cfg zabbix-5.2.6.tar.gz
#解壓
[root@139 ~]# tar xf zabbix-5.2.6.tar.gz
[root@139 ~]# cd zabbix-5.2.6
#建立使用者
[root@139 zabbix-5.2.6]# useradd -r -M -s /sbin/nologin zabbix
[root@139 zabbix-5.2.6]# rpm -qa|grep gcc
libgcc-8.3.1-5.1.el8.x86_64
#安裝依賴
[root@139 zabbix-5.2.6]# yum -y install gcc gcc-c++ make vim pcre-devel
#編譯安裝
[root@139 zabbix-5.2.6]# ./configure --enable-agent
[root@139 zabbix-5.2.6]# make install
#配置檔案
[root@139 ~]# cd /usr/local/etc/
[root@139 etc]# ls
zabbix_agentd.conf zabbix_agentd.conf.d
[root@139 etc]# vim zabbix_agentd.conf
添加裡面server和serveractive ip為服務端ip 192.168.59.133
添加hostname=随機數
[root@server ~]# openssl rand -base64 10
Y1K/81B+upq/sA==
#啟動
[root@139 etc]# zabbix_agentd
[root@139 etc]# ss -antl
State Recv-Q Send-Q Local Address:Port Peer Address:Port
LISTEN 0 128 0.0.0.0:22 0.0.0.0:*
LISTEN 0 128 0.0.0.0:10050 0.0.0.0:*
LISTEN 0 128 [::]:22 [::]:*
在web界面添加主機:
添加監控項
手動建立