诺禾-Linux平台Zabbix Agent的装置配置

Linux平台Zabbix Agent的装置配置

这里简单总结一下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 © 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:

service zabbix-agent start

Starting Zabbix agent: [ OK ]

service zabbix-agent stop

Shutting down Zabbix agent: [ OK ]

service zabbix-agent status

zabbix_agentd (pid 8120) is running…

方式2:

systemctl start zabbix-agent.service

systemctl stop zabbix-agent.service

方式3:

/etc/init.d/zabbix-agent start

/etc/init.d/zabbix-agent stop

/etc/init.d/zabbix-agent status

6: 设置zabbix-agent效劳开机自启动

chkconfig --add zabbix-agent

chkconfig --list | grep zabbix-agent

zabbix-agent 0:off 1:off 2:off 3:off 4:off 5:off 6:off

7: 检查被监控的Linux效劳器防火墙能否开通tcp 10050端口

这个十分简单,不做过多论述。但是必需检查确认,否则Zabbix Server没法获取数据。

假如运用iptables管理管理防火墙,例如(CentOS 5,6)

修正配置文件,防火墙的配置文件/etc/sysconfig/iptables,新增下面这样的一条配置

-A RH-Firewall-1-INPUT -p tcp --dport 10050 -j ACCEPT

重启防火墙service iptables restart

假如运用firewalld管理防火墙(例如,CentOS 7.x)

firewall-cmd --zone=public --add-port=10050/tcp --permanent 添加端口

firewall-cmd --reload 重启防火墙效劳

firewall-cmd --query-port=10050/tcp,查询某个端口能否开放

版本问题:

留意事项:关于Zabbix Server和Zabbix Agent的版本能否要分歧问题,这个尽量分歧,版本分歧,能够防止杂七杂八的问题呈现。官方文档也有相关阐明:Zabbix Server对Zabbix Agent是向下兼容的。但是要留意有些参数需求修正。请留意,高于3.0的Zabbix代理不能与Zabbix效劳器3.0一同运用。详细如下所示:

12 Version compatibility

Supported agents

Zabbix agents from previous Zabbix versions are compatible with Zabbix 3.0. However, you may need to review the configuration of older agents as some parameters have changed, for example, parameters related to logging for versions before 3.0.

To take full advantage of new and improved items, improved performance and reduced memory usage, use the latest 3.0 agent.

Note that Zabbix agent newer than 3.0 cannot be used with Zabbix server 3.0.

固然官方文档提示高于3.0的Zabbix代理不能与Zabbix效劳器3.0一同运用,但是不分明是指大版本还是小版本,关于小版本。例如,我的测试环境Zabbix Server为3.0.9,客户端也能够装置zabbix-agent-3.0.28这个版本,测试暂未发现问题。

你可能感兴趣的:(linux)