linux – Nagios – check_ntp_time – 偏移未知

linux – Nagios – check_ntp_time – 偏移未知,第1张

概述我在子网上运行本地NTP服务器以保持其他子网节点同步,而不是每个节点都与上游服务器同步.但是,在为Nagios实现check_ntp_time插件时,我注意到一个令人沮丧的问题,即nagios一直报告本地节点与本地ntp服务器同步的严重错误. 这是本地ntp服务器上的ntp配置,注意上游服务器条目和限制条目,根据我的研究,这将节点定义为本地节点可以同步的ntp服务器. driftfile /var 我在子网上运行本地NTP服务器以保持其他子网节点同步,而不是每个节点都与上游服务器同步.但是,在为Nagios实现check_ntp_time插件时,我注意到一个令人沮丧的问题,即nagios一直报告本地节点与本地ntp服务器同步的严重错误.

这是本地ntp服务器上的ntp配置,注意上游服务器条目和限制条目,根据我的研究,这将节点定义为本地节点可以同步的ntp服务器.

driftfile /var/lib/ntp/drift# Permit time synchronization with our time source,but do not# permit the source to query or modify the service on this system.restrict default kod limited nomodify notrap nopeer noqueryrestrict -6 default kod limited nomodify notrap nopeer noquery# Permit all access over the loopback interface.  This Could# be tightened as well,but to do so would effect some of# the administrative functions.restrict 127.0.0.1restrict -6 ::1# Makes me able to answer requests from local nodesrestrict 10.0.0.0 mask 255.255.192.0 nomodify notrap# My sourceserver 0.centos.pool.ntp.org iburstserver 1.centos.pool.ntp.orgserver 2.centos.pool.ntp.orglogfile /var/log/ntp/server.logstatistics loopstatsstatsdir /var/log/ntp/filegen peerstats file peers type day link enablefilegen loopstats file loops type day link enable

在本地非ntp服务器节点上,除了限制条目被删除之外,一切都是相同的,并且服务器条目仅引用本地ntp服务器:server ntp.example.com iburst.

每个本地节点都可以解析ntp.example.com.

我遇到的问题是当我从nagios服务器运行以下命令时:

/usr/lib64/nagios/plugins/check_ntp_time -H node-a-1 -v

并输出:

sending request to peer 0response from peer 0: offset -0.002921819687sending request to peer 0response from peer 0: offset -0.0001939535141sending request to peer 0re-sending request to peer 0re-sending request to peer 0re-sending request to peer 0re-sending request to peer 0re-sending request to peer 0re-sending request to peer 0discarding peer 0: stratum=0overall average offset: 0NTP CRITICAL: Offset unkNown|

除了引用上游服务器的本地ntp服务器之外,所有节点都会发生这种情况.起初我认为这是IPtables问题,但我在每个本地ntp节点上都有针孔(允许nagios访问以检查时间差异):

ACCEPT     udp  --  eth0   *       10.0.0.0/18          0.0.0.0/0           multiport dports 123 /* 777 allow ntp access */ state NEW

版本:

nagios-plugins-ntp: 1.4.16ntp: 4.2.6p5-1.el6.centos

非常感谢任何帮助,我真的无法提交nagios工作,直到我得到解决,因为你知道保持服务器时间同步是优先级1.

– 编辑 –

根据评论,这里是各种节点上的ntpq -p的结果:

# Actual NTP Server (10.0.0.2)==============================================================================+propjet.latt.ne 241.199.164.101  2 u  105  128  337   14.578   12.954   7.138+x2la01.hostigat 63.145.169.2     3 u   21  128  377   16.037   13.546   4.090*pacific.latt.ne 241.199.164.101  2 u   72  128  377   15.148   24.434   7.403# Local node 1==============================================================================*service-a-1.sn1 204.2.134.163    3 u    9  128  377    0.228    5.217   1.296# Local node 2==============================================================================*service-a-1.sn1 204.2.134.163    3 u   91  128  377    0.200    3.608   1.167
解决方法 这里的关键是这一个:

discarding peer 0: stratum=0

将自身标识为层0的NTP服务器违反了规范(它保留用于原子钟或类似的东西).几年前我遇到了一些BSD和Mac OS X主机的问题.我最终破解了源代码中的stratum check并为“有问题”的主机维护了一个单独的插件版本.

The offending lines are 254-257(目前,无论如何),如果你想撕掉那个.这是一个黑客,但它对我有用;-)

我在邮件列表中找到了关于它的this thread档案.我认为还有一个我建议添加一个命令行选项来忽略层次检查,但我不认为它有任何牵引力.

关于它还有一个bug report,但就我所知,它还没有产生任何有用的东西.

总结

以上是内存溢出为你收集整理的linux – Nagios – check_ntp_time – 偏移未知全部内容,希望文章能够帮你解决linux – Nagios – check_ntp_time – 偏移未知所遇到的程序开发问题。

如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。

欢迎分享,转载请注明来源:内存溢出

原文地址: http://outofmemory.cn/yw/1038969.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-05-24
下一篇 2022-05-24

发表评论

登录后才能评论

评论列表(0条)

保存