已索引
报错信息:More than 100 items having missing data for more than 10 minutes
处理方法
1.检查 zabbix proxy、 zabbix server 及 zabbix db 是否均做好时间同步。这个建议平时就纳入监控。
2.检查 zabbix agent 所在主机,即被监控服务器的时间是否同步。这个建议平时就纳入监控。
但是,尽管 windows 主机也做了 NTP 时间同步,但是过了一段时间后,仍然会发生很大的偏移。Linux 目前没有发现该问题。
3.检查 zabbix 相关服务器的资源是否紧张,这个 zabbix 本身就自带监控,只要没告警,这方面原因的可能性就不大。
4.点击 zabbix "管理" > "队列",再点"Queue details",查看具体是哪些主机的哪些指标没有采集到数据,再具体分析。
分析的时候,zabbix agent 的日志也会给我们提供非常有用的价值,下面是一个常见的故障案例(Windows)。
故障案例(Windows)
队列显示一台 Windows 服务器已经2天没有取到数据了,查看这台服务器的最新数据,发现只有 ping 检测有值。
打开这台服务器的 zabbix agent 日志,有报错内容如下:
1692:20240204:150655.802 active check configuration update from [137.43.93.50:10051] started to fail (cannot connect to [[137.43.93.50]:10051]:[0x00002747] 由于系统缓冲区空间不足或队列已满,不能执行套接字上的操作。)
由于其它主机并没有报错,所以先不考虑是 proxy 或 server 端的问题,先分析被监控服务器。
cmd> netstat -an | find /c "TIME_WAIT"
16378
cmd> netstat -an | find /c "1005"
42
我们发现有很多 TIME_WAIT 状态的 socket 未释放。
出现一定数量的TIME_WAIT连接是正常现象,但是大量的TIME_WAIT连接会占用系统本地端口,导致不能再创建新的TCP连接。
释放现有的 TIME_WAIT 链接需要重启,但后期会再次出现(497天),如果想根本解决这个问题,可以参考如下两种方法(仍然需要重启生效)。
方法一:关于 windows 存在大量无法释放的 TIME_WAIT 状态连接,微软提供了一个受支持的修复程序,但是需要联系微软官方去获取。
All the TCP/IP ports that are in a TIME_WAIT status are not closed after 497 days from system startup in Windows Vista, in Windows 7, in Windows Server 2008 and in Windows Server 2008 R2 - Microsoft Support
https://support.microsoft.com/en-us/topic/all-the-tcp-ip-ports-that-are-in-a-time-wait-status-are-not-closed-after-497-days-from-system-startup-in-windows-vista-in-windows-7-in-windows-server-2008-and-in-windows-server-2008-r2-38c81adc-d990-c6f7-3689-91cca5d19a20
方法二:You receive the error 'WSAENOBUFS (10055)' when you try to connect from TCP ports greater than 5000
https://learn.microsoft.com/en-us/troubleshoot/windows-client/networking/connect-tcp-greater-than-5000-error-wsaenobufs-10055
在注册表编辑器左侧依次点击“HKEY_LOCAL_MACHINESYSTEMCurrentControlSetServicesTcpipParameters”路径。
在注册表编辑器右侧创建新的 REG_DWORD 值 TcpTimedWaitDelay,将此值设置为十进制30,此值将等待时间设置为 30 秒。
TcpTimedWaitDelay 表示从关闭连接开始直到这个连接能够释放并重用的时间。
这段时间,是 2MSL 时间,称为两倍最大段生存期。
缺省为240秒,最低为30秒,最高为300秒。建议设为30秒。
通过降低 TcpTimedWaitDelay 的值,TCP/IP 可以更快地释放关闭的连接,并为新连接提供更多资源。
微软的说明:An additional TCPTimedWaitDelay registry parameter determines how long a closed port waits until the closed port can be reused.
创建新的 REG_DWORD 值 MaxUserPort(可略)
这个值需要根据服务器的实际应用负载来修改,不建议盲目地按照网上的改成65534。
一般来说,新增 TcpTimedWaitDelay 之后就能够解决这个问题了,如果还是解决不了,就可以考虑修改 MaxUserPort。
MaxUserPort 表示当应用程序向系统请求获取可用的用户端口时,TCP/IP 可指定的最大端口号。
微软的说明:
Value Name: MaxUserPort
Value Type: DWORD
Value data: 65534
Valid Range: 5000-65534 (decimal)
Default: 0x1388 (5000 decimal)
Description: This parameter controls the maximum port number that is used when a program requests any available user port from the system. Typically, ephemeral (short-lived) ports are allocated between the values of 1024 and 5000 inclusive.