一、安装zabbix-agent:
### --- 添加zabbix仓库:
[root@localhost ~]# rpm -Uvh https://repo.zabbix.com/zabbix/4.0/rhel/7/x86_64/zabbix-release-4.0-1.el7.noarch.rpm
~~~ 把zabbix.repo文件里面的内容替换为以下内容:
[root@localhost ~]# cat>/etc/yum.repos.d/zabbix.repo<<EOF
[zabbix]
name=Zabbix Official Repository - $basearch
baseurl=https://mirrors.tuna.tsinghua.edu.cn/zabbix/zabbix/4.0/rhel/7/$basearch/
enabled=1
gpgcheck=1
gpgkey=https://mirrors.tuna.tsinghua.edu.cn/zabbix/RPM-GPG-KEY-ZABBIX-A14FE591
[zabbix-non-supported]
name=Zabbix Official Repository non-supported - $basearch
baseurl=https://mirrors.tuna.tsinghua.edu.cn/zabbix/non-supported/rhel/7/$basearch/
enabled=1
gpgkey=https://mirrors.tuna.tsinghua.edu.cn/zabbix/RPM-GPG-KEY-ZABBIX
gpgcheck=1
EOF
~~~ Zabbix前端需要基本安装中不提供的其他软件包。您需要在将运行Zabbix前端的系统中启用可选rpm的存储库:
[root@localhost ~]# yum-config-manager --enable rhel-7-server-optional-rpms
### --- 使用如下命令安装zabbix-agent
[root@localhost ~]# yum -y install zabbix-agent
### --- 启动zabbix-agent -y
[root@localhost ~]# systemctl start zabbix-agent.service
[root@localhost ~]# systemctl enable zabbix-agent.service
~~~ 日志文件地址:
[root@localhost ~]# cat /var/log/zabbix/zabbix_agentd.log
二、效验所安装的是否正常:
### --- 通过如下命令进行效验:
~~~ zabbix-server 监听端口为tcp 10051
~~~ zabbix-agent 监听端口为tcp 10050
[root@localhost ~]# ss -tunlp
三、以root身份运行代理
### --- 要覆盖此行为,请创建文件:
[root@localhost ~]# vim /etc/systemd/system/zabbix-agent.service.d/orride.conf
[Service]
User=root
Group=root
### --- 重新加载守护程序并重启zabbix-agent服务:
[root@localhost ~]# systemctl daemon-reload
[root@localhost ~]# systemctl restart zabbix-agent