[Pkg-nagios-devel] Bug#360774: check_ntp error: Use of
uninitialized value in division
Herbert Straub
herbert at linuxhacker.at
Tue Apr 4 15:46:17 UTC 2006
Package: nagios-plugins
Version: 1.4.2-5
Severity: normal
Situation: retrieving ntp information of "ntp clients". This is done
with ntpdate. I get this error message:
/usr/lib/nagios/plugins/check_ntp -v -H myntpclient -w 3 -c 10
ntperr = 0
ntperr = 0
myntpclient: timed out, nothing received
Use of uninitialized value in division (/) at
/usr/lib/nagios/plugins/check_ntp line 423.
NTP CRITICAL: Offset -37.599848 sec > +/- 10 sec|offset=-37.599848,
jitter=0,peer_stratum=14
It seems, that ntpdate cannot get the jitter information, but the output
calculate with $jitter. I think, this patch fix this bug:
diff -u /usr/lib/nagios/plugins/check_ntp.SAVE2
/usr/lib/nagios/plugins/check_ntp
--- /usr/lib/nagios/plugins/check_ntp.SAVE2 2006-04-04
17:31:04.000000000 +0200
+++ /usr/lib/nagios/plugins/check_ntp 2006-04-04 17:33:12.000000000 +0200
@@ -420,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 : "not available") .
",peer_stratum=$stratum\n");
last;
}
}
Output:
/usr/lib/nagios/plugins/check_ntp -v -H myntpclient -w 3 -c 10
ntperr = 0
ntperr = 0
myntpclient: timed out, nothing received
NTP CRITICAL: Offset -37.622197 sec > +/- 10 sec|offset=-37.622197,
jitter=not available,peer_stratum=14
Best regards
Herbert Straub
PS: I reported the bug on the nagios-plugin project site:
http://sourceforge.net/tracker/index.php?func=detail&aid=1464321&group_id=29880&atid=397597
More information about the Pkg-nagios-devel
mailing list