[Nagiosplug-devel] [ nagiosplug-Bugs-1251096 ] check_ntp perl warnings
SourceForge.net
noreply at sourceforge.net
Thu Apr 27 07:09:24 CEST 2006
Bugs item #1251096, was opened at 2005-08-03 15:49
Message generated for change (Comment added) made by aderixon
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: Ade Rixon (aderixon)
Date: 2006-04-27 15:08
Message:
Logged In: YES
user_id=145082
Still broken in 1.4.3, any progress?
RFC 1035 sec. 2.3.1 describes "classic" domain naming,
although it doesn't allow for domain names beginning with
numerics. RFC 2181 sec. 11 appears to suggest that any
characters may be used in domain names.
----------------------------------------------------------------------
Comment By: Joachim Schrod (jschrod)
Date: 2006-01-24 11:07
Message:
Logged In: YES
user_id=70318
Good point about leading digits. Before I upload a new patch
- does anybody here know the most current RFC where valid
host- and domainname syntax is described? We should/could
use that for hostname checking.
----------------------------------------------------------------------
Comment By: Peter Pramberger (peterpramb)
Date: 2006-01-24 10:33
Message:
Logged In: YES
user_id=182996
Verified and works.
There is still an issue with the domain name regex, which
doesn't match domains starting with a digit rather than a
letter. Maybe the regex can be extended to match these too.
# ./check_ntp -H ntp03.10domain.at
No target host specified
----------------------------------------------------------------------
Comment By: Joachim Schrod (jschrod)
Date: 2006-01-16 19:21
Message:
Logged In: YES
user_id=70318
Patch #1407587 fixes these problems. It works in multi-peer
situations, supports unreachable hosts, supports unknown
hosts, and outputs no warnings any more.
It also corrects the exit status check and doesn't abort any
more, but uses the intended control flow for error messages
by ntpdate and ntpq. When either ntpdate or ntpq exited with
an exit code != 0, the whole script was aborted with die,
instead of outputting proper "NTP CRITICAL" messages.
It also supports FQDNs where one element has only one char.
----------------------------------------------------------------------
Comment By: Peter Pramberger (peterpramb)
Date: 2005-12-19 13: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 00: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 01: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 01: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 09:30
Message:
Logged In: YES
user_id=299377
duplicate with 1267741
----------------------------------------------------------------------
Comment By: Ade Rixon (aderixon)
Date: 2005-10-21 11: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