Zabbix Agent 安装2

2022-03-22 11:48:31 浏览数 (1)

默认情况下 zabbix_agentd 会监听在 0.0.0.0:10050 上面,所以要将防火墙打开,以方便与zabbix server之间的通信


启动zabbix-agent

代码语言:javascript复制
[root@zbx-target zabbix]# /etc/init.d/zabbix-agent start 
Starting Zabbix agent:                                     [  OK  ]
[root@zbx-target zabbix]# ps faux | grep zabbix | grep -v grep 
zabbix   26124  0.0  0.0  77336  1144 ?        S    16:11   0:00 zabbix_agentd -c /etc/zabbix/zabbix_agentd.conf
zabbix   26126  0.0  0.0  77336  1564 ?        S    16:11   0:00  _ zabbix_agentd: collector [idle 1 sec]          
zabbix   26127  0.0  0.0  77336   968 ?        S    16:11   0:00  _ zabbix_agentd: listener #1 [waiting for connection]
zabbix   26128  0.0  0.0  77336  1108 ?        S    16:11   0:00  _ zabbix_agentd: listener #2 [waiting for connection]
zabbix   26129  0.0  0.0  77336   968 ?        S    16:11   0:00  _ zabbix_agentd: listener #3 [waiting for connection]
zabbix   26130  0.0  0.0  77348  1136 ?        S    16:11   0:00  _ zabbix_agentd: active checks #1 [idle 1 sec]   
[root@zbx-target zabbix]# netstat  -ant | grep 10050
tcp        0      0 0.0.0.0:10050               0.0.0.0:*                   LISTEN      
tcp        0      0 192.168.66.5:10050          192.168.66.123:38010         TIME_WAIT   
tcp        0      0 192.168.66.5:10050          192.168.66.123:38072         TIME_WAIT   
tcp        0      0 :::10050                    :::*                        LISTEN      
[root@zbx-target zabbix]# 

当它可以开机启动

代码语言:javascript复制
[root@zbx-target zabbix]# chkconfig  --list | grep zabbix
zabbix-agent   	0:off	1:off	2:off	3:off	4:off	5:off	6:off
[root@zbx-target zabbix]# chkconfig  zabbix-agent on 
[root@zbx-target zabbix]# chkconfig  --list | grep zabbix
zabbix-agent   	0:off	1:off	2:on	3:on	4:on	5:on	6:off
[root@zbx-target zabbix]# 

使用zabbix-server测试连接

代码语言:javascript复制
[root@zbx-server script]# zabbix_get -s zbx-target -p 10050 -k "system.cpu.load[all,avg1]"
0.010000
[root@zbx-server script]# zabbix_get -s zbx-target -p 10050 -k "system.cpu.load[all,avg5]"
0.020000
[root@zbx-server script]# zabbix_get -s zbx-target -p 10050 -k "system.cpu.load[all,avg15]"
0.010000
[root@zbx-server script]# zabbix_get -s zbx-target -p 10050 -k "net.tcp.listen[10050]"
1
[root@zbx-server script]# zabbix_get -s zbx-target -p 10050 -k "net.tcp.listen[10051]"
0
[root@zbx-server script]# zabbix_get -s zbx-target -p 10050 -k "system.boottime"
1449836322
[root@zbx-server script]# zabbix_get -s zbx-target -p 10050 -k "agent.version"
2.4.7
[root@zbx-server script]# zabbix_get -s zbx-target -p 10050 -k "net.if.discovery"
{"data":[{"{#IFNAME}":"lo"},{"{#IFNAME}":"em1"},{"{#IFNAME}":"em2"},{"{#IFNAME}":"em3"},{"{#IFNAME}":"em4"}]}
[root@zbx-server script]# zabbix_get -s zbx-target -p 10050 -k "system.cpu.discovery"
{"data":[{"{#CPU.NUMBER}":0,"{#CPU.STATUS}":"online"},{"{#CPU.NUMBER}":1,"{#CPU.STATUS}":"online"},{"{#CPU.NUMBER}":2,"{#CPU.STATUS}":"online"},{"{#CPU.NUMBER}":3,"{#CPU.STATUS}":"online"},{"{#CPU.NUMBER}":4,"{#CPU.STATUS}":"online"},{"{#CPU.NUMBER}":5,"{#CPU.STATUS}":"online"},{"{#CPU.NUMBER}":6,"{#CPU.STATUS}":"online"},{"{#CPU.NUMBER}":7,"{#CPU.STATUS}":"online"},{"{#CPU.NUMBER}":8,"{#CPU.STATUS}":"online"},{"{#CPU.NUMBER}":9,"{#CPU.STATUS}":"online"},{"{#CPU.NUMBER}":10,"{#CPU.STATUS}":"online"},{"{#CPU.NUMBER}":11,"{#CPU.STATUS}":"online"},{"{#CPU.NUMBER}":12,"{#CPU.STATUS}":"online"},{"{#CPU.NUMBER}":13,"{#CPU.STATUS}":"online"},{"{#CPU.NUMBER}":14,"{#CPU.STATUS}":"online"},{"{#CPU.NUMBER}":15,"{#CPU.STATUS}":"online"}]}
[root@zbx-server script]# zabbix_get -s zbx-target -p 10050 -k "system.sw.arch"
x86_64
[root@zbx-server script]# 

可以正常获取检测结果,说明连接通畅,更多的监控条目可以参考 Zabbix agent items ,这些条目的详细解释可以参考 Zabbix agent

Zabbix中已经集成了大量的常用监控条目,不用过多配置就可以直接使用

0 人点赞