這裡簡單總結一下Linux平臺Zabbix Agent的安裝配置,實驗測試的Zabbix版本比較老了(Zabbix 3.0.9),不過版本雖然有點老舊,但是新舊版本的安裝步驟、流程基本差別不大。這裡的總結僅僅當成一個操作手冊,後續會更新或添加部分內容。 Linux版本眾多,下麵文檔僅僅在RHEL、C... ...
這裡簡單總結一下Linux平臺Zabbix Agent的安裝配置,實驗測試的Zabbix版本比較老了(Zabbix 3.0.9),不過版本雖然有點老舊,但是新舊版本的安裝步驟、流程基本差別不大。這裡的總結僅僅當成一個操作手冊,後續會更新或添加部分內容。
Linux版本眾多,下麵文檔僅僅在RHEL、CentOS幾個版本測試過。不同版本可能安裝等有所差別,後續再補充完善。
1:首先檢查zabbix_server的版本
# zabbix_server --version
zabbix_server (Zabbix) 3.0.9
Revision 67444 19 April 2017, compilation time: Apr 23 2017 18:05:43
Copyright (C) 2017 Zabbix SIA
License GPLv2+: GNU GPL version 2 or later <http://gnu.org/licenses/gpl.html>.
This is free software: you are free to change and redistribute it according to
the license. There is NO WARRANTY, to the extent permitted by law
2:檢查被監控伺服器的Linux發行版本
例如 RHEL或CentOS
# more /etc/redhat-release
Red Hat Enterprise Linux Server release 5.7 (Tikanga)
# more /etc/issue
Oracle Linux Server release 5.7
Kernel \r on an \m
3: 根據Zabbix Server的版本和Linux發行版本選擇去下載對應的Zabbix Agent安裝包
這個測試環境,我們就選擇下載zabbix-agent-3.0.9-1.el5.x86_64.rpm這個RMP包,下載地址為http://repo.zabbix.com/zabbix/3.0/rhel/5/x86_64/
# rpm -ivh zabbix-agent-3.0.9-1.el5.x86_64.rpm
warning: zabbix-agent-3.0.9-1.el5.x86_64.rpm: Header V3 DSA signature: NOKEY, key ID 79ea5ed4
Preparing... ########################################### [100%]
1:zabbix-agent ########################################### [100%]
當然,如果伺服器可以訪問外網,也可以使用下麵命令直接安裝。
#rpm -ivh http://repo.zabbix.com/zabbix/3.0/rhel/5/x86_64/zabbix-agent-3.0.9-1.el5.x86_64.rpm
或者你配置了yum源,那就更簡單方便
#yum -y install zabbix-agent
我們知道,預設情況下Zabbix Server一般從客戶端主動獲取數據,當然客戶端也可以主動將數據推送給服務端,客戶端通過zabbix_sender指令來實現向服務端主動推送數據。這裡不介紹zabbix_sender的安裝、配置。後續打算單獨介紹。
4:修改Zabbix-Agent的配置文件
首先找到zabbix_agentd.conf的位置,可以使用 rpm -ql zabbix-agent或 rpm -ql zabbix-agent | grep zabbix_agentd.conf
# rpm -ql zabbix-agent
/etc/init.d/zabbix-agent
/etc/logrotate.d/zabbix-agent
/etc/zabbix/zabbix_agentd.conf
/etc/zabbix/zabbix_agentd.d
/etc/zabbix/zabbix_agentd.d/userparameter_mysql.conf
/usr/sbin/zabbix_agentd
/usr/share/doc/zabbix-agent-3.0.9
/usr/share/doc/zabbix-agent-3.0.9/AUTHORS
/usr/share/doc/zabbix-agent-3.0.9/COPYING
/usr/share/doc/zabbix-agent-3.0.9/ChangeLog
/usr/share/doc/zabbix-agent-3.0.9/NEWS
/usr/share/doc/zabbix-agent-3.0.9/README
/usr/share/man/man8/zabbix_agentd.8.gz
/var/log/zabbix
/var/run/zabbix
# rpm -ql zabbix-agent | grep zabbix_agentd.conf
/etc/zabbix/zabbix_agentd.conf
編輯參數文件zabbix_agentd.conf
### 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 #用Zabbix_Server的IP地址替換127.0.0.1
### Option: ServerActive
# List of comma delimited IP:port (or hostname:port) pairs of Zabbix servers for active checks.
# If port is not specified, default port is used.
# IPv6 addresses must be enclosed in square brackets if port for that host is specified.
# If port is not specified, square brackets for IPv6 addresses are optional.
# If this parameter is not specified, active checks are disabled.
# Example: ServerActive=127.0.0.1:20051,zabbix.domain,[::1]:30051,::1,[12fc::1]
#
# Mandatory: no
# Default:
# ServerActive=
ServerActive=127.0.0.1 #用Zabbix_Server的IP地址替換127.0.0.1
### Option: Hostname
# Unique, case sensitive hostname.
# Required for active checks and must match hostname as configured on the server.
# Value is acquired from HostnameItem if undefined.
#
# Mandatory: no
# Default:
# Hostname=
Hostname=Zabbix server #Zabbix客戶端主機名替換Zabbix server
5:啟動Zabbix-agent服務
啟動Zabbix-Agent的幾種方式,註意實際環境,有些Linux版本並不支持下麵的一些方式。
方式1: