1、配置Zabbix的YUM源:rpm -ivh https://mirrors.aliyun.com/zabbix/zabbix/3.0/rhel/7/x86_64/zabbix-release-3.0-1.el7.noarch.rpm
[root@localhost ~]# rpm -ivh https://mirrors.aliyun.com/zabbix/zabbix/3.0/rhel/7/x86_64/zabbix-release-3.0-1.el7.noarch.rpm Retrieving https://mirrors.aliyun.com/zabbix/zabbix/3.0/rhel/7/x86_64/zabbix-release-3.0-1.el7.noarch.rpm warning: /var/tmp/rpm-tmp.9DTb8R: Header V4 DSA/SHA1 Signature, key ID 79ea5ed4: NOKEY Preparing... ################################# [100%] Updating / installing... 1:zabbix-release-3.0-1.el7 ################################# [100%]
2、安装Zabbix-agent:yum -y install zabbix-agent
[root@localhost ~]# yum -y install zabbix-agent Loaded plugins: fastestmirror base | 3.6 kB 00:00:00 epel | 3.2 kB 00:00:00 extras | 3.4 kB 00:00:00 updates | 3.4 kB 00:00:00 zabbix | 2.9 kB 00:00:00 zabbix-non-supported | 951 B 00:00:00 (1/8): base/7/x86_64/group_gz | 166 kB 00:00:00 (2/8): epel/x86_64/group_gz | 88 kB 00:00:00 (3/8): epel/x86_64/updateinfo | 932 kB 00:00:00 (4/8): updates/7/x86_64/primary_db | 2.7 MB 00:00:00 (5/8): epel/x86_64/primary | 3.5 MB 00:00:00 (6/8): base/7/x86_64/primary_db | 5.9 MB 00:00:01 (7/8): extras/7/x86_64/primary_db | 149 kB 00:00:05 (8/8): zabbix/x86_64/primary_db | 127 kB 00:00:09 zabbix-non-supported/x86_64/primary | 1.6 kB 00:00:00 Determining fastest mirrors * base: mirrors.aliyun.com * epel: mirrors.aliyun.com * extras: mirrors.aliyun.com * updates: mirrors.aliyun.com epel 12592/12592 zabbix-non-supported 4/4 Resolving Dependencies --> Running transaction check ---> Package zabbix-agent.x86_64 0:3.0.18-1.el7 will be installed --> Finished Dependency Resolution Dependencies Resolved =================================================================================================== Package Arch Version Repository Size =================================================================================================== Installing: zabbix-agent x86_64 3.0.18-1.el7 zabbix 341 k Transaction Summary =================================================================================================== Install 1 Package Total download size: 341 k Installed size: 1.3 M Downloading packages: warning: /var/cache/yum/x86_64/7/zabbix/packages/zabbix-agent-3.0.18-1.el7.x86_64.rpm: Header V4 DSA/SHA1 Signature, key ID 79ea5ed4: NOKEY Public key for zabbix-agent-3.0.18-1.el7.x86_64.rpm is not installed zabbix-agent-3.0.18-1.el7.x86_64.rpm | 341 kB 00:00:32 Retrieving key from file:///etc/pki/rpm-gpg/RPM-GPG-KEY-ZABBIX Importing GPG key 0x79EA5ED4: Userid : "Zabbix SIA <packager@zabbix.com>" Fingerprint: fbab d5fb 2025 5eca b22e e194 d13d 58e4 79ea 5ed4 Package : zabbix-release-3.0-1.el7.noarch (installed) From : /etc/pki/rpm-gpg/RPM-GPG-KEY-ZABBIX Running transaction check Running transaction test Transaction test succeeded Running transaction Warning: RPMDB altered outside of yum. ** Found 2 pre-existing rpmdb problem(s), 'yum check' output follows: 2:postfix-2.10.1-6.el7.x86_64 has missing requires of libmysqlclient.so.18()(64bit) 2:postfix-2.10.1-6.el7.x86_64 has missing requires of libmysqlclient.so.18(libmysqlclient_18)(64bit) Installing : zabbix-agent-3.0.18-1.el7.x86_64 1/1 Verifying : zabbix-agent-3.0.18-1.el7.x86_64 1/1 Installed: zabbix-agent.x86_64 0:3.0.18-1.el7 Complete!
3、修改Zabbix客户端配置文件(/etc/zabbix/zabbix_agentd.conf)中的Server参数为远端Zabbix服务端IP地址
Server=172.16.0.39
4、启动Zabbix-agent程序并添加自启动:systemctl start zabbix-agent && systemctl enable zabbix-agent
[root@localhost ~]# systemctl start zabbix-agent && systemctl enable zabbix-agent Created symlink from /etc/systemd/system/multi-user.target.wants/zabbix-agent.service to /usr/lib/systemd/system/zabbix-agent.service.
[root@localhost ~]# ss -lnat State Recv-Q Send-Q Local Address:Port Peer Address:Port LISTEN 0 128 127.0.0.1:9000 *:* LISTEN 0 128 *:80 *:* LISTEN 0 128 *:22 *:* LISTEN 0 128 *:10050 *:* ESTAB 0 0 172.16.0.209:22 172.16.4.143:61264 LISTEN 0 80 :::3306 :::* LISTEN 0 128 :::22 :::* LISTEN 0 128 :::10050 :::*
5、Zabbix Server中添加客户端主机:配置>>主机>>创建主机