番茄系统家园 - 免费重装系统!简单装系统,人人都是装机大师!
当前位置:首页>电脑故障 > Zabbix 5.x的Template Module ICMP Ping浅析

Zabbix 5.x的Template Module ICMP Ping浅析

来源:番茄系统家园浏览:时间:2022-03-21 10:31:18

Zabbix 5.x的Template Module ICMP Ping浅析

本文转载自微信公众号「DBA闲思杂想录」,作者潇湘隐者。转载本文请联系DBA闲思杂想录公众号。

Zabbix 5.*默认自带了模板Template ModuleICMPPing。它用来监控主机或设备的存活状态以及网络情况,主要是监控丢包率和响应时间两个指标。Template ModuleICMPPing模板有三个item,如下截图所示:

Zabbix 5.x的Template Module ICMP Ping浅析

Template Module ICMP Ping的配置

1:检查或安装fping

Zabbix使用外部命令fping处理ICMPping的请求,而不是ping命令,而fping不包含在Zabbix的发行版本中。所以需要额外安装fping命令的相关包。

检查是否安装了fping命令:

[root@Zabbix ~]# yum list installed | grep fpingfping.x86_643.16-1.el8@zabbix-non-supported

如果没有安装过fping,就必须安装fping。如果没有配置yum源的话,需要用其它方式安装,例如可以下载安装包进行RPM安装,此处略过。

yum install fping -y

由于fping默认是root权限工作,而Zabbix Proxy或ZabbixServer是zabbix用户运行的,所以需要对fping程序设置setuid权限,如果在自定义key的时候需要用到netstat命令,也同样要设置setuid,否则不能获取到数据,而日志中提示权拒绝。

locatefping/usr/sbin/fping/usr/sbin/fping6/usr/share/doc/fping/usr/share/doc/fping/COPYING/usr/share/doc/fping/ChangeLog/usr/share/doc/fping/README/usr/share/man/man8/fping.8.gz/usr/share/man/man8/fping6.8.gz#chownroot:zabbix/usr/sbin/fping#chmod 4710 /usr/sbin/fping

2:在Zabbix Server和Zabbix Proxy端的配置文件里面打开注释

在zabbix_server.conf或zabbix_proxy.conf中把FpingLocation或Fping6Location路径修改为刚安装的fping命令的路径。如果安装路径和配置文件中FpingLocation/Fping6Location默认的路径一致,其实也可以不用修改。

默认设置如下所示:

Option: FpingLocation# Location of fping.# Make sure that fping binaryhas

root ownership and SUID flag set.## Mandatory: no#Default:#FpingLocation=/usr/sbin/fping ### Option: Fping6Location# Location offping6.#Make sure that fping6 binary has root ownership and SUID flag set.#Make emptyif your fping utility is capable to process IPv6 addresses.##Mandatory: no#Default:# Fping6Location=/usr/sbin/fping6

3:引用模板

在被监控的主机或设备上应用这个模板,或者在其他模板中引用这个模板(很多翻译是“链接的模板”,个人感觉这个翻译怪怪的),如下所示,在TemplateOSWindows by Zabbix agent中引用了Template Module ICMP Ping模板,那么只要应用模板TemplateOSWindows by Zabbix agent 就会监控主机或设备了。

Zabbix 5.x的Template Module ICMP Ping浅析

Template Module ICMP Ping的选项介绍

在被监控的主机或设备上对应的“最新数据”(Latest data)——“Status”下面有三个监控项

ICMP loss

ICMP ping

ICMP response time

Zabbix 5.x的Template Module ICMP Ping浅析

Zabbix 5.x的Template Module ICMP Ping浅析

关于这些item的key,可以参考官方文档,下面节选部分内容如下:

Defaults, limits and description of values for ICMP check parameters:

ParameterUnitDescriptionFping's flagDefaults set byAllowed limits

by Zabbix

fpingZabbixminmax

packetsnumbernumber of request packets to a target-C

3110000

intervalmillisecondstime to wait between successive packets-p1000

20unlimited

sizebytespacket size in bytes

56 bytes on x86, 68 bytes on x86_64-b56 or 68

2465507

timeoutmillisecondsfping v3.x - timeout to wait after last packetsent,affected by -C flag

fping v4.x - individual timeout for each packet-tfping 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 withtheitem parameter interval mentioned in the table above, which corresponds tofpingoption -p) and -S source IP address (or -I in older fping versions).Thoseoptions are auto-detected by running checks with different optioncombinations.Zabbix tries to detect the minimal value in milliseconds thatfping allows touse with -i by trying 3 values: 0, 1 and 10. The value thatfirst succeeds isthen used for subsequent ICMP checks. This process is done byeach ICMP pingerprocess individually.

Auto-detected fping options are invalidated every hour and detected againonthe next attempt to perform ICMP check. Set DebugLevel>=4 in order toviewdetails of this process in the server or proxy log file.

Warning: fping defaults can differ depending on platform and version - ifindoubt, check fping documentation.

Zabbix writes IP addresses to be checked by any of three icmpping* keys toatemporary file, which is then passed to fping. If items have differentkeyparameters, only ones with identical key parameters are written to asinglefile.

All IP addresses written to the single file will be checked by fpinginparallel, so Zabbix icmp pinger process will spend fixed amount oftimedisregarding the number of IP addresses in the file.

ICMP loss掉包的案例截图:

Zabbix 5.x的Template Module ICMP Ping浅析

ICMP ping掉包的案例截图

Zabbix 5.x的Template Module ICMP Ping浅析

ICMP response time 就是时延或者响应时间

Zabbix 5.x的Template Module ICMP Ping浅析

参考资料:

https://www.zabbix.com/documentation/current/manual/config/items/itemtypes/simple_checks#icmp_pings

推荐系统

  • 雨林木风 winxp下载 纯净版 永久激活 winxp ghost系统 sp3 系统下载

    雨林木风 winxp下载 纯净版 永久激活 winxp ghost系统 sp3 系统下载64位
    系统大小:0MB系统类型:WinXP

    雨林木风在系统方面技术积累雄厚深耕多年,打造了国内重装系统行业知名品牌,雨林木风WindowsXP其系统口碑得到许多人认可,积累了广大的用户群体,是一款稳定流畅的系统,雨林木风 winxp下载 纯净版 永久激活 winxp ghost系统 sp3 系统下载,有需要的朋友速度下载吧。

    系统等级:
    进入下载 >
  • 萝卜家园win7纯净版 ghost系统下载 x64 联想电脑专用

    萝卜家园win7纯净版 ghost系统下载 x64 联想电脑专用64位
    系统大小:0MB系统类型:Win7

    萝卜家园win7纯净版是款非常纯净的win7系统,此版本优化更新了大量的驱动,帮助用户们进行舒适的使用,更加的适合家庭办公的使用,方便用户,有需要的用户们快来下载安装吧。

    系统等级:
    进入下载 >
  • 雨林木风xp系统 xp系统纯净版 winXP ghost xp sp3 纯净版系统下载

    雨林木风xp系统 xp系统纯净版 winXP ghost xp sp3 纯净版系统下载64位
    系统大小:1.01GB系统类型:WinXP

    雨林木风xp系统 xp系统纯净版 winXP ghost xp sp3 纯净版系统下载,雨林木风WinXP系统技术积累雄厚深耕多年,采用了新的系统功能和硬件驱动,可以更好的发挥系统的性能,优化了系统、驱动对硬件的加速,加固了系统安全策略,运行环境安全可靠稳定。

    系统等级:
    进入下载 >
  • 萝卜家园win10企业版 免激活密钥 激活工具 V2023 X64位系统下载

    萝卜家园win10企业版 免激活密钥 激活工具 V2023 X64位系统下载64位
    系统大小:0MB系统类型:Win10

    萝卜家园在系统方面技术积累雄厚深耕多年,打造了国内重装系统行业的萝卜家园品牌,(win10企业版,win10 ghost,win10镜像),萝卜家园win10企业版 免激活密钥 激活工具 ghost镜像 X64位系统下载,其系统口碑得到许多人认可,积累了广大的用户群体,萝卜家园win10纯净版是一款稳定流畅的系统,一直以来都以用户为中心,是由萝卜家园win10团队推出的萝卜家园

    系统等级:
    进入下载 >
  • 萝卜家园windows10游戏版 win10游戏专业版 V2023 X64位系统下载

    萝卜家园windows10游戏版 win10游戏专业版 V2023 X64位系统下载64位
    系统大小:0MB系统类型:Win10

    萝卜家园windows10游戏版 win10游戏专业版 ghost X64位 系统下载,萝卜家园在系统方面技术积累雄厚深耕多年,打造了国内重装系统行业的萝卜家园品牌,其系统口碑得到许多人认可,积累了广大的用户群体,萝卜家园win10纯净版是一款稳定流畅的系统,一直以来都以用户为中心,是由萝卜家园win10团队推出的萝卜家园win10国内镜像版,基于国内用户的习惯,做

    系统等级:
    进入下载 >
  • windows11下载 萝卜家园win11专业版 X64位 V2023官网下载

    windows11下载 萝卜家园win11专业版 X64位 V2023官网下载64位
    系统大小:0MB系统类型:Win11

    萝卜家园在系统方面技术积累雄厚深耕多年,windows11下载 萝卜家园win11专业版 X64位 官网正式版可以更好的发挥系统的性能,优化了系统、驱动对硬件的加速,使得软件在WINDOWS11系统中运行得更加流畅,加固了系统安全策略,WINDOWS11系统在家用办公上跑分表现都是非常优秀,完美的兼容各种硬件和软件,运行环境安全可靠稳定。

    系统等级:
    进入下载 >