环境:
服务端zabbix-server: 192.168.174.132 操作系统Alma Linux9.3
客服端zabbix-agent: 192.168.174.131 操作系统centos7
配置文件目录:
zabbix-agent-----------> /etc/zabbix/zabbix_agentd.conf
日志:------------------ > cat /var/log/zabbix/zabbix_agentd.log
一.、安装zabbix-agent
注:可自行访问zabbix官网安装zabbix-agent
二、开放防火墙
[root@localhost]# firewall-cmd --zone=public --add-port=10050/tcp --permanent
success
[root@localhost]# systemctl restart firewalld
[root@localhost /]# firewall-cmd --list-ports
10050/tcp
三、配置zabbix-agent客服端
文件位置:/etc/zabbix/zabbix_agentd.conf
配置详情:
vim /etc/zabbix/zabbix_agentd.conf
##### Passive checks related ##### 被动检查相关配置
Server=192.168.174.132 #允许zabbix-server的IP到当前服务器上获取数据,可以写多个IP
### Option: ListenPort
# ListenPort=10050 #监听端口
### Option: ListenIP
# ListenIP=0.0.0.0 #监听地址
### Option: StartAgents
StartAgents=1 #被动状态时默认启动的实例数(进程数),为0不监听任何端口
### Option: Hostname
Hostname=zabbix_agent #区分大小写且在zabbix server唯一的值
ServerActive=192.168.174.132
注:Server和ServerActive都是zabbix_server端的ip Hostname是zabbix_agentd端名字必须和zabbix_server后台添加的主机名保持一致
查看10050端口是否开启:netstat -ntpl / ss -ntulp |grep 10050
四、启动客服端
[root@localhost /]# systemctl start zabbix-agent.service
[root@localhost /]# systemctl enable zabbix-agent