[Nagiosplug-devel] [ nagiosplug-Patches-1798774 ] check_ntp: honor ntp flags

SourceForge.net noreply at sourceforge.net
Fri Sep 21 14:22:03 CEST 2007


Patches item #1798774, was opened at 2007-09-20 09:52
Message generated for change (Comment added) made by dermoth
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=397599&aid=1798774&group_id=29880

Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: Bugfix
Group: None
Status: Open
Resolution: None
Priority: 5
Private: No
Submitted By: MAtteo HCE Valsasna (mvalsasna)
>Assigned to: Thomas Guyot (dermoth)
Summary: check_ntp: honor ntp flags

Initial Comment:
Patch against Plugin Version (-V output): check_ntp (nagios-plugins 1.4.9) 1.25
Plugin Name: check_ntp
Example Plugin Commandline: ./check_ntp -H <hostname>
Tested on operating system: 
nagios host: debian etch i386, Version 2.0b3
NTP server: openwrt kamikaze 7.07 running openntpd 3.9.1p1 
Tested on architecture: 
nagios host: i386
NTP server: mips   
Tested with compiler: gcc version 4.1.2 20061115 (prerelease) (Debian 4.1.1-21)


check_ntp fails to check ntp flags in the response it receives from servers, and accepts servers who respond with a valid stratum but with flags bit set to 11 (LI_ALARM). 
those servers were then refused by clients.

this patch adds a check for ntp flags value, so that  servers with flags != 00 (LI_NOWARNING) are discarded

because of the complex structure of the plugin, which checks all IP addresses that correspond to the hostname given, and gives OK if at least one of them is OK, I couldn't easily add an explanatory error message

additionally, if offset_result==STATE_CRITICAL (which happens also if all servers are rejected due to NTP flags), perfdata_line would have been used without being initialized, leading to printing of garbage, or possibly worse. 
this is corrected in the last chunk of the patch, by initializing perfdata_line

----------------------------------------------------------------------

>Comment By: Thomas Guyot (dermoth)
Date: 2007-09-21 08:22

Message:
Logged In: YES 
user_id=375623
Originator: NO

Thanks for submitting. I will review/test it shortly and get it included.

----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=397599&aid=1798774&group_id=29880




More information about the Devel mailing list