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,查询某个端口是否开放

 

猜你喜欢

转载自www.cnblogs.com/eccom/p/10641087.html