配置完监控插件后,要重启agent
代码语言:javascript复制Note: 如果不重启,就读不到新添的配置,从服务端尝试获取信息,会出现如下报错
[root@zbx-server zabbix_agentd.d]# zabbix_get -s zbx-target -p 10050 -k "mem.used"
ZBX_NOTSUPPORTED: Unsupported item key.
[root@zbx-server zabbix_agentd.d]# zabbix_get -s zbx-target -p 10050 -k "port.discovery"
ZBX_NOTSUPPORTED: Unsupported item key.
[root@zbx-server zabbix_agentd.d]#
重启agent
代码语言:javascript复制[root@zbx-target zabbix_agentd.d]# /etc/init.d/zabbix-agent restart
Shutting down Zabbix agent: [ OK ]
Starting Zabbix agent: [ OK ]
[root@zbx-target zabbix_agentd.d]#
然后再尝试从服务端进行信息采集
代码语言:javascript复制[root@zbx-server zabbix_agentd.d]# zabbix_get -s zbx-target -p 10050 -k "port.discovery"
{"data":[{"{#OPENPORT}":"57091"},{"{#OPENPORT}":"55581"},{"{#OPENPORT}":"10050"},{"{#OPENPORT}":"10010"},{"{#OPENPORT}":"631"},{"{#OPENPORT}":"111"},{"{#OPENPORT}":"25"},{"{#OPENPORT}":"22"},{"{#OPENPORT}":"END"}]}
[root@zbx-server zabbix_agentd.d]# zabbix_get -s zbx-target -p 10050 -k "mem.used"
623308
[root@zbx-server zabbix_agentd.d]#
一切正常
到此,基础工作已经完成,在此前提下,配置 Templates,创建 Graphs ,拼接 Screens 就可以展示出非常炫目的dashboard效果
命令汇总
wget http://repo.zabbix.com/zabbix/2.4/rhel/6/x86_64/zabbix-release-2.4-1.el6.noarch.rpm
zabbix_get -s zbx-target -p 10050 -k "system.cpu.load[all,avg1]"
zabbix_get -s zbx-target -p 10050 -k "system.cpu.load[all,avg5]"
zabbix_get -s zbx-target -p 10050 -k "system.cpu.load[all,avg15]"
zabbix_get -s zbx-target -p 10050 -k "net.tcp.listen[10050]"
zabbix_get -s zbx-target -p 10050 -k "net.tcp.listen[10051]"
zabbix_get -s zbx-target -p 10050 -k "system.boottime"
zabbix_get -s zbx-target -p 10050 -k "agent.version"
zabbix_get -s zbx-target -p 10050 -k "net.if.discovery"
zabbix_get -s zbx-target -p 10050 -k "system.cpu.discovery"
zabbix_get -s zbx-target -p 10050 -k "system.sw.arch"
cat port.discovery.bash
cat userparameter_DIY.conf
zabbix_get -s zbx-target -p 10050 -k "port.discovery"
zabbix_get -s zbx-target -p 10050 -k "mem.used"
原文地址