linux各版本zabbix-agent的安裝


 

https://www.zabbix.com/documentation/current/
官方的文檔


ubuntu 安裝zabbix agent
#sudo apt-get install zabbix-agent
安裝完后會自動啟動: zabbix_server.conf (服務端配置文件)在/etc/zabbix目錄下 如果安裝了agent端,那zabbix_agentd.conf 也會在/etc/zabbix目錄下。 這個zabbix_agentd.conf 在Server和ServerActive兩處指定了zabbixserver的IP地址.

# vim /etc/zabbix/zabbix_agentd.conf
Server=10.0.0.49
修改完后重啟服務
/etc/init.d/zabbix-agent restart

如果vi后提示Can't open file for writing,則表明權限不夠,則需要sudo vim /etc/zabbix/zabbix_agentd.conf來編輯該文件

 


suse11sp3、suse12 安裝 zabbix-agent

1、添加repo源
suse11SP3
zypper addrepo http://download.opensuse.org/repositories/server:/monitoring/SLE_11_SP3/ server_monitoring
zypper update
suse12
zypper addrepo http://download.opensuse.org/repositories/server:/monitoring/SLE_12/ server_monitoring
zypper update

2、安裝zabbix-agent
zypper install zabbix-agent

3、編輯/etc/zabbix/zabbix-agentd.conf文件
PidFile=/run/zabbix/zabbix_agentd.pid
LogFile=/var/log/zabbix/zabbix_agentd.log
LogFileSize=5 (設置zabbix日志當到達5M時自動回滾,0表示disabled)
Server=zabbix (zabbix server端的ip或主機名)
ListenPort=10050
ServerActive=zabbix (zabbix server端的ip或主機名,在這里可以改變端口號)
Hostname=zabbix_agent
Timeout=30
AllowRoot=1 (設置是否允許以root用戶啟動,值有1和0,0表示禁止以root用戶啟動)
UnsafeUserParameters=1 (設置是否允許自定義監控,值有1和0,0表示disable)
EnableRemoteCommands=1 (設置是否允許來自zabbix server端的遠程命令,值有1和0,0表示不允許)
LogRemoteCommands=1 (設置是否允許日志文件以warning級別記錄來自zabbix server端的遠程命令,值有1和0,0表示disabled)

4、啟動zabbix-agentd服務並加入開機自啟動
suse11sp3:
service zabbix-agentd start
chkconfig zabbix-agentd on

suse12:
systemctl start zabbix-agentd
systemctl enable zabbix-agentd

 

CentOS 安裝及配置 zabbxi-agent

1.安裝zabbix 軟件源
CentOS/RHEL 7:
rpm -Uvh http://repo.zabbix.com/zabbix/3.4/rhel/7/x86_64/zabbix-release-3.4-2.el7.noarch.rpm

CentOS/RHEL 6:
rpm -Uvh http://repo.zabbix.com/zabbix/3.4/rhel/6/x86_64/zabbix-release-3.4-1.el6.noarch.rpm


2.安裝zabbix-agent
yum -y install zabbix-agent
yum install zabbix-sender zabbix-agent zabbix-get


3.在 /etc/zabbix/zabbix_agentd.conf 中更改:
Server=<zbx-server的ip>
ServerActive=<zbx-server的ip>
Hostname=<本機的名字>

4.重啟services,設置啟動和開機項
centos7設置開機啟動
systemctl start zabbix-agent.service
systemctl enable zabbix-agent.service

centos6設置開機啟動
service zabbix-agent restart
chkconfig --add zabbix-agent
chkconfig --list zabbix-agent

5.防火牆開通tcp 10050端口
centos的FW的防火牆位置/etc/sysconfig/iptables

-A INPUT -m state --state NEW -m tcp -p tcp --dport 10050 -j ACCEPT
注意要修改下防火牆文件的順序,開放的端口放在前面
重啟防火牆service iptables restart

ps:關閉防火牆的配置如下
systemctl stop firewalld
systemctl disable firewalld


5.1防火牆開通tcp 10050端口(centos7.X,使用firewall-cmd命令)
firewall-cmd --zone=public --add-port=10050/tcp --permanent 添加端口
firewall-cmd --reload 重啟防火牆服務
firewall-cmd --query-port=10050/tcp,查詢某個端口是否開放

 

 

 

 

 

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM