安装 Zabbix-Agent,添加监视 CentOS 7 主机。

Zabbix-Agent

添加 Zabbix 软件仓库

安装软件仓库配置包,这个包包含了 yum(软件包管理器)的配置文件。

## 
#  rpm -ivh http://repo.zabbix.com/zabbix/4.0/rhel/7/x86_64/zabbix-release-4.0-1.el7.noarch.rpm

[root@ec-b ~]# rpm -ivh http://repo.zabbix.com/zabbix/4.0/rhel/7/x86_64/zabbix-release-4.0-1.el7.noarch.rpm
获取http://repo.zabbix.com/zabbix/4.0/rhel/7/x86_64/zabbix-release-4.0-1.el7.noarch.rpm
警告:/var/tmp/rpm-tmp.Xtj4gy: 头V4 RSA/SHA512 Signature, 密钥 ID a14fe591: NOKEY
准备中...                          ################################# [100%]
正在升级/安装...
   1:zabbix-release-4.0-1.el7         ################################# [100%]
## 
#  yum install zabbix-agent
#  注意 zabbix-agent 和 zabbix-server 的版本要一致

[root@ec-b zabbix]# yum install zabbix-agent
......
Running transaction check Running transaction test Transaction test succeeded Running transaction Warning: RPMDB altered outside of yum.   Installing : zabbix-agent-4.0.5-1.el7.x86_64                                                                     1/1    Verifying  : zabbix-agent-4.0.5-1.el7.x86_64                                                                     1/1  Installed:   zabbix-agent.x86_64 0:4.0.5-1.el7                                                                                     Complete! 

修改 “/etc/zabbix/zabbix_agentd.conf” 配置文件的 Server、ServerActive、Hostname

# /etc/zabbix/zabbix_agentd.conf

### Option: Server
#       List of comma delimited IP addresses, optionally in CIDR notation, or DNS names of Zabbix servers and Zabbix proxies.
#       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
#       and '::/0' will allow any IPv4 or IPv6 address.
#       '0.0.0.0/0' can be used to allow any IPv4 address.
#       Example: Server=127.0.0.1,192.168.1.0/24,::1,2001:db8::/32,zabbix.example.com
#
# Mandatory: yes, if StartAgents is not explicitly set to 0
# Default:
# Server=
# Server=172.16.1.61
Server=ec-a

### Option: ServerActive
#       List of comma delimited IP:port (or DNS name:port) pairs of Zabbix servers and Zabbix proxies 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=172.16.1.61
ServerActive=ec-a

### 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=172.16.1.62
Hostname=ec-b
启动 zabbix-agent
# 启动 zabbix-agent
[root@ec-b zabbix]# systemctl start zabbix-agent.service

# 激活开机启动 zabbix-agent
[root@ec-b zabbix]# systemctl enable zabbix-agent.service 
Created symlink from /etc/systemd/system/multi-user.target.wants/zabbix-agent.service to /usr/lib/systemd/system/zabbix-agent.service.




Zabbix-Web

在浏览器中打开 http://localhost:8081/, localhost 为 Zabbix-server 宿主机 IP

默认账号的用户名、密码是:Admin 和 zabbix, 输入用户名密码登录,即可看到主界面。

Configuration – Hosts – Create Host
Fill in Host Information


[为隐藏内容,请登录(login)以显示!]

参考资料:
https://www.zabbix.com/documentation/4.0