[Nagiosplug-devel] [ nagiosplug-Bugs-1251096 ] check_ntp perl warnings

SourceForge.net noreply at sourceforge.net
Mon Dec 19 05:19:10 CET 2005


Bugs item #1251096, was opened at 2005-08-03 16:49
Message generated for change (Settings changed) made by peterpramb
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=397597&aid=1251096&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: Parsing problem
Group: Release (specify)
>Status: Open
Resolution: None
Priority: 5
Submitted By: Peter Pramberger (peterpramb)
Assigned to: Harper Mann (harpermann)
Summary: check_ntp perl warnings

Initial Comment:
Using check_ntp.pl from plugins 1.4.1 produces some
warnings if the checked host is not reachable or
responding before timeout. These warnings produce an
UNKNOWN state in Nagios.

See the attached patch for clarification.

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

Comment By: Peter Pramberger (peterpramb)
Date: 2005-12-19 14:16

Message:
Logged In: YES 
user_id=182996

Hi!

Sorry for my late response.

There is still the "(not parsed) isn't numeric" warning in
the output of check_ntp (1.31). Please see the attached
command output.

And check_ntp has problems with FQDN, where check_ntp aborts
with "No target host specified" (see below). Single
hostnames work.

# ./check_ntp -H ntp01.somedomain.at -v
No target host specified

There is a small typo in the host matching regex.


Regards,
Peter

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

Comment By: Harper Mann (harpermann)
Date: 2005-11-30 01:50

Message:
Logged In: YES 
user_id=939531

Hi Peter and Johan,

Thanks for filing this bug.

check_ntp wasn't properly handing a bad exit status from the
external programs it calls (ntpdate and ntpq), so jitter
wasn't set.  Added check of $? on close and proper error
output if status from the sub program call completion is
non-zero.  This includes "host not found".

Please verify this is fixed in your environment.  I'll
reopen the bug if you find any problems.

Regards,

- Harper

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

Comment By: Johan Fischer (fischaz)
Date: 2005-11-18 02:46

Message:
Logged In: YES 
user_id=459934

Below patch (that I can't seem to be able to attach)

diff -Naur
nagios-plugins-1.4.2.orig/plugins-scripts/check_ntp.pl
nagios-plugins-1.4.2/plugins-scripts/check_ntp.pl
--- nagios-plugins-1.4.2.orig/plugins-scripts/check_ntp.pl
2005-05-26 00:05:41.000000000 +1000
+++ nagios-plugins-1.4.2/plugins-scripts/check_ntp.pl
2005-11-18 12:39:07.000000000 +1100
@@ -309,7 +309,6 @@
 				}
 			} else {
 				print "No match!\n" if $verbose;
-				$jitter = '(not parsed)';
 			}
 			
 		}
@@ -365,7 +364,7 @@
 
 } elsif ($have_ntpq && $jitter_error != $ERRORS{'OK'}) {
 	$state = $jitter_error;
-	$answer = "Jitter $jitter too high";
+	$answer = 'Jitter ' . ((defined $jitter) ? $jitter : '-')
. ' too high';
 	if (defined($offset) && abs($offset) > $ocrit) {
 		$state = $ERRORS{'CRITICAL'};
 		$answer = "Jitter error and offset $offset sec > +/-
$ocrit sec";
@@ -401,13 +400,13 @@
 	if (abs($offset) > $ocrit) {
 		$state = $ERRORS{'CRITICAL'};
 		$answer = "Offset $offset sec > +/- $ocrit sec, jitter
$jitter msec";
-	} elsif (abs($jitter) > $jcrit ) {
+	} elsif (defined($jitter) && abs($jitter) > $jcrit ) {
 		$state = $ERRORS{'CRITICAL'};
 		$answer = "Jitter $jitter msec> +/- $jcrit msec, offset
$offset sec";
 	} elsif (abs($offset) > $owarn) {
 		$state = $ERRORS{'WARNING'};
 		$answer = "Offset $offset sec > +/- $owarn sec, jitter
$jitter msec";
-	} elsif (abs($jitter) > $jwarn ) {
+	} elsif (defined($jitter) && abs($jitter) > $jwarn ) {
 		$state = $ERRORS{'WARNING'};
 		$answer = "Jitter $jitter msec> +/- $jwarn msec, offset
$offset sec";
 
@@ -421,7 +420,7 @@
 foreach my $key (keys %ERRORS) {
 	if ($state==$ERRORS{$key}) {
 #		print ("NTP $key: $answer");
-		print ("NTP $key: $answer|offset=$offset, jitter=" .
$jitter/1000 .	",peer_stratum=$stratum\n");
+		print ("NTP $key: $answer|offset=$offset, jitter=" .
((defined $jitter) ? $jitter/1000 : '-') .
",peer_stratum=$stratum\n");
 		last;
 	}
 }


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

Comment By: Johan Fischer (fischaz)
Date: 2005-11-18 02:45

Message:
Logged In: YES 
user_id=459934

The attached patch is wrong. It will override the value of
the jitter.

Basically the jitter is defined as undef at the begginning,
then should be overriden for each server with selected by
the regex. It should not be touched otherwise.

On the other side, more tests need to be done to see if
jitter is defined (and in that case, it will be a numeric)
and print it.

So it means more test at the end of the script to parse the
results.


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

Comment By: Charles Bueche (cbueche)
Date: 2005-10-27 10:30

Message:
Logged In: YES 
user_id=299377

duplicate with 1267741

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

Comment By: Ade Rixon (aderixon)
Date: 2005-10-21 12:12

Message:
Logged In: YES 
user_id=145082

This is still a problem in 1.4.2, can someone review before
next release, please? The warning is:

Argument "(not parsed)" isn't numeric in abs at ./check_ntp
line 401.

...Caused by assigning a string value ('(not parsed)') to
$jitter.

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

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




More information about the Devel mailing list