zabbix_agent可以用很多的方法去下载,本文试图通过yum工具去下载。
添加yum源
vim /etc/yum.repos.d/zabbix.repo
[zabbix]
name=zabbix
baseurl=http://repo.zabbix.com/zabbix/4.5/rhel/7/x86_64/
gpgcheck=0
enabled=1
其中baseurl根据操作系统而定。通过命令cat /etc/redhat-release来查看版本。
yum list | grep zabbix
yum install -y zabbix-agent
安装了zabbix-agent
zabbix-agent的配置文件在/etc/zabbix/zabbix_agentd.conf
Server=<zbx-server的ip>
ServerActive=<zbx-server的ip>
Hostname=<本机的名字>
设置启动和开机项
systemctl start zabbix-agent
systemctl enable zabbix-agent
zabbix_agent日志文件路径:cat /var/log/zabbix/zabbix_agentd.log
排错:
错误:
zabbix-agent已经安装,但是在zabbix-server上显示
Get value from agent failed: cannot connect to [[127.0.0.1]:10050]: [111] Connection refused
参考文档:https://www.cnblogs.com/Sungeek/p/9073603.html
检查的是端口和服务是否启动,不过在我测试的时候,端口和服务都是启动的。我又检查了配置文件,配置文件有些问题,我稍微做了一下调整。
然后页面上还是红的。
我有用zabbix_get命令去取了一下zabbix_agent的数值。
zabbix_get -s 192.1.31.65 -k system.cpu.switches
能够取到。
于是我怀疑是用因为服务器端是容器化的关系,于是装了普通版,zabbix_agent正常,可能容器版的zabbix_server不能和原版的zabbix_agent共用?这个有待验证。
添加主机
原文:https://blog.51cto.com/181647568/2479186