Zabbix5.x的TemplateModuleICMPPing浅析

Zabbix5.x的TemplateModuleICMPPing浅析
Zabbix 5.*默认⾃带了模板Template Module ICMP Ping。它⽤来监控主机或设备的存活状态以及⽹络情况,主要是监控丢包率和响应时间两个指标。Template Module ICMP Ping模板有三个item,如下截图所⽰:
Template Module ICMP Ping的配置
1:检查或安装fping
Zabbix使⽤外部命令fping处理ICMP ping的请求,⽽不是ping命令,⽽fping不含在Zabbix的发⾏版本中。所以需要额外安装fping命令的相关包。
公路排水设计规范检查是否安装了fping命令:
[root@Zabbix ~]# yum list installed | grep fping
fping.x86_64            3.16-1.el8      @zabbix-non-supported
如果没有安装过fping,就必须安装fping。如果没有配置yum源的话,需要⽤其它⽅式安装,例如可以下载安装包进⾏RPM安装,此处略过。
#yum install fping -y
由于fping默认是root权限⼯作,⽽Zabbix Proxy 或Zabbix Server是zabbix⽤户运⾏的,所以需要对fping程序设置setuid权限,如果在⾃定义key的时候需要⽤到netstat命令,也同样要设置setuid,否则不能获取到数据,⽽⽇志中提⽰权拒绝。
# locate fping
/usr/sbin/fping
/usr/sbin/fping6
/usr/share/doc/fping
/usr/share/doc/fping/COPYING
gps数据格式/usr/share/doc/fping/ChangeLog
/usr/share/doc/fping/README
/usr/share/man/man8/
/usr/share/man/man8/
#chown root:zabbix /usr/sbin/fping
#chmod 4710 /usr/sbin/fping
2:在Zabbix Server和Zabbix Proxy端的配置⽂件⾥⾯打开注释
在f或f中把FpingLocation或Fping6Location路径修改为刚安装的fping命令的路径。如果安装路径和配置⽂件中FpingLocation/Fping6Location默认的路径⼀致,其实也可以不⽤修改。
默认设置如下所⽰:
### Option: FpingLocation
#      Location of fping.
#      Make sure that fping binary has root ownership and SUID flag set.
#
# Mandatory: no
# Default:
# FpingLocation=/usr/sbin/fping
### Option: Fping6Location
#      Location of fping6.
#      Make sure that fping6 binary has root ownership and SUID flag set.
#      Make empty if your fping utility is capable to process IPv6 addresses.
#
# Mandatory: no
# Default:
# Fping6Location=/usr/sbin/fping6
3:在被监控的主机或设备上应⽤这个模板,或者在其他模板中引⽤这个模板(很多翻译是“链接的模板”,个⼈感觉这个翻译怪怪的),如下所⽰,在Template OS Windows by Zabbix agent中引⽤了Template Module ICMP Ping模板,那么只要应⽤模板Template OS Windows by Zabbix agent 就会监控主机或设备了。
Template Module ICMP Ping的选项介绍
在被监控的主机或设备上对应的“最新数据”(Latest data)——“Status”下⾯有三个监控项
ICMP loss
ICMP ping
ICMP response time
关于这些item的key,可以参考官⽅⽂档,下⾯节选部分内容如下:
Defaults, limits and description of values for ICMP check parameters:
华中理工大学出版社
Parameter Unit Description Fping's
flag Defaults set by Allowed limits
代销和经销的区别
欧洲见闻录by Zabbix fping Zabbix min max
packets number number of request packets to a target-C3110000 interval milliseconds time to wait between successive packets-p100020unlimited size bytes packet size in bytes
迅雷在线点播56 bytes on x86, 68 bytes on x86_64
-b56 or 682465507
timeout milliseconds fping v3.x - timeout to wait after last packet sent,
affected by -C flag
fping v4.x - individual timeout for each packet -t fping v3.x - 500
fping v4.x - inherited from -p flag, but not
more than 2000
50unlimited
In addition Zabbix uses fping options -i interval ms (do not mix up with the item parameter interval mentioned in the table above, which corresponds to fping option -p) and -S source IP address (or -I in older fping versions). Those options are auto-detected by running checks with different option combinations. Zabbix tries to detect the minimal value in milliseconds that fping allows to use with -i by trying 3 values: 0, 1 and 10. The value that first succeeds is then used for subsequent ICMP checks. This process is done by each ICMP pinger process individually.
Auto-detected fping options are invalidated every hour and detected again on the next attempt to perform ICMP check. Set DebugLevel>=4 in order to view details of this process in the server or proxy log file.
Warning: fping defaults can differ depending on platform and version - if in doubt, check fping documentation.
Zabbix writes IP addresses to be checked by any of three icmpping* keys to a temporary file, which is then passed to fping. If items have different key parameters, only ones with identical key parameters are written to a single file.
All IP addresses written to the single file will be checked by fping in parallel, so Zabbix icmp pinger p
rocess will spend fixed amount of time disregarding the number of IP addresses in the file.
ICMP loss掉包的案例截图:
ICMP ping掉包的案例截图
ICMP response time 就是时延或者响应时间
参考资料:

本文发布于:2024-09-20 22:31:19,感谢您对本站的认可!

本文链接:https://www.17tex.com/xueshu/530039.html

版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。

上一篇:ICMP Flood
标签:安装   设备   需要   命令   路径   监控   响应   模板
留言与评论(共有 0 条评论)
   
验证码:
Copyright ©2019-2024 Comsenz Inc.Powered by © 易纺专利技术学习网 豫ICP备2022007602号 豫公网安备41160202000603 站长QQ:729038198 关于我们 投诉建议