一、安装zabbix-agent3.2版本的yum源文件
[root@localhost home]# rpm -ivh https://mirrors.aliyun.com/zabbix/zabbix/3.2/rhel/7/x86_64/zabbix-release-3.2-1.el7.noarch.rpm
二、修改zabbix的repo文件里的yum源地址为阿里云镜像地址
[root@localhost home]# vim /etc/yum.repos.d/zabbix.repo
[zabbix] name=Zabbix Official Repository - $basearch baseurl=http://mirrors.aliyun.com/zabbix/zabbix/3.2/rhel/7/$basearch/ enabled=1 gpgcheck=1 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-ZABBIX-A14FE591 [zabbix-non-supported] name=Zabbix Official Repository non-supported - $basearch baseurl=http://mirrors.aliyun.com/zabbix/non-supported/rhel/7/$basearch/ enabled=1 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-ZABBIX gpgcheck=1
三、yum安装zabbix-agent
[root@localhost home]# yum install zabbix-agent
四、修改zabbix-agent的配置文件
[root@localhost zabbix]# vim /etc/zabbix/zabbix_agentd.conf
Server=172.28.18.75 ServerActive=172.28.18.75 Hostname=172.28.5.124
五、修改zabbix-agent服务配置为开机自启动
[root@localhost zabbix]# systemctl list-unit-files|grep zabbix zabbix-agent.service disabled [root@localhost zabbix]#
当前默认是禁止自启动的,我们修改为开机自启动
[root@localhost 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.
再次查看
[root@localhost zabbix]# systemctl is-enabled zabbix-agent.service enabled
六、启动zabbix-agent服务
[root@localhost zabbix]# systemctl start zabbix-agent.service
查看
[root@localhost zabbix]# systemctl status zabbix-agent.service ● zabbix-agent.service - Zabbix Agent Loaded: loaded (/usr/lib/systemd/system/zabbix-agent.service; enabled; vendor preset: disabled) Active: active (running) since 五 2021-07-02 17:20:36 CST; 7s ago Process: 14798 ExecStart=/usr/sbin/zabbix_agentd -c $CONFFILE (code=exited, status=0/SUCCESS) Main PID: 14800 (zabbix_agentd) CGroup: /system.slice/zabbix-agent.service ├─14800 /usr/sbin/zabbix_agentd -c /etc/zabbix/zabbix_agentd.conf ├─14801 /usr/sbin/zabbix_agentd: collector [idle 1 sec] ├─14802 /usr/sbin/zabbix_agentd: listener #1 [waiting for connection] ├─14803 /usr/sbin/zabbix_agentd: listener #2 [waiting for connection] ├─14804 /usr/sbin/zabbix_agentd: listener #3 [waiting for connection] └─14805 /usr/sbin/zabbix_agentd: active checks #1 [idle 1 sec] 7月 02 17:20:36 localhost.localdomain systemd[1]: Starting Zabbix Agent... 7月 02 17:20:36 localhost.localdomain systemd[1]: Started Zabbix Agent. [root@localhost zabbix]#
启动成功,在zabbix server上执行
[root@zabbix_server home]# zabbix_get -s 172.28.5.124 -p 10050 -k 'system.uname' Linux localhost.localdomain 3.10.0-957.el7.x86_64 #1 SMP Thu Nov 8 23:39:32 UTC 2018 x86_64 [root@zabbix_server home]#
成功获取服务器信息。