[Nagiosplug-checkins] CVS: nagiosplug/plugins-scripts check_ntp.pl,1.18,1.19
Subhendu Ghosh
sghosh at users.sourceforge.net
Mon Oct 13 19:41:07 CEST 2003
Update of /cvsroot/nagiosplug/nagiosplug/plugins-scripts
In directory sc8-pr-cvs1:/tmp/cvs-serv32399
Modified Files:
check_ntp.pl
Log Message:
Bug 773588: added check to warn on matching # candidates only
Index: check_ntp.pl
===================================================================
RCS file: /cvsroot/nagiosplug/nagiosplug/plugins-scripts/check_ntp.pl,v
retrieving revision 1.18
retrieving revision 1.19
diff -C2 -r1.18 -r1.19
*** check_ntp.pl 16 May 2003 17:32:24 -0000 1.18
--- check_ntp.pl 14 Oct 2003 02:40:31 -0000 1.19
***************
*** 155,159 ****
my $jitter = undef;
my $syspeer = undef;
! my $candidates = 0;
my $msg; # first line of output to print if format is invalid
--- 155,160 ----
my $jitter = undef;
my $syspeer = undef;
! my $candidate = 0;
! my @candidates;
my $msg; # first line of output to print if format is invalid
***************
*** 253,256 ****
--- 254,260 ----
# Field 11: dispersion/jitter
#
+ # According to bug 773588 Some solaris xntpd implementations seemto match on
+ # "#" even though the docs say it exceeds maximum distance. Providing patch
+ # here which will generate a warining.
if ($have_ntpq) {
***************
*** 265,274 ****
# number of candidates on <host> for sys.peer
if (/^(\*|\+|\#|o])/) {
! ++$candidates;
! print "Candiate count= $candidates\n" if ($verbose);
}
!
# match sys.peer or pps.peer
! if (/^(\*|o)([-0-9.\s]+)\s+([-0-9A-Za-z.]+)\s+([-0-9.]+)\s+([lumb]+)\s+([-0-9m.]+)\s+([-0-9.]+)\s+([-0-9.]+)\s+([-0-9.]+)\s+([-0-9.]+)\s+([-0-9.]+)/) {
$syspeer = $2;
$stratum = $4;
--- 269,279 ----
# number of candidates on <host> for sys.peer
if (/^(\*|\+|\#|o])/) {
! ++$candidate;
! push (@candidates, $_);
! print "Candiate count= $candidate\n" if ($verbose);
}
!
# match sys.peer or pps.peer
! if (/^(\*|o)([-0-9.\s]+)\s+([-0-9A-Za-z.]+)\s+([-0-9.]+)\s+([lumb-]+)\s+([-0-9m.]+)\s+([-0-9.]+)\s+([-0-9.]+)\s+([-0-9.]+)\s+([-0-9.]+)\s+([-0-9.]+)/) {
$syspeer = $2;
$stratum = $4;
***************
*** 285,290 ****
--- 290,321 ----
}
}
+
}
close NTPQ;
+
+ # if we did not match sys.peer or pps.peer but matched # candidates only
+ # generate a warning
+ # based on bug id 773588
+ unless (defined $syspeer) {
+ if ($#candidates >0) {
+ foreach my $c (@candidates) {
+ $c =~ /^(#)([-0-9.\s]+)\s+([-0-9A-Za-z.]+)\s+([-0-9.]+)\s+([lumb-]+)\s+([-0-9m.]+)\s+([-0-9.]+)\s+([-0-9.]+)\s+([-0-9.]+)\s+([-0-9.]+)\s+([-0-9.]+)/;
+ $syspeer = $2;
+ $stratum = $4;
+ $jitter = $11;
+ print "candidate match $c \n" if $verbose;
+ if ($jitter > $jcrit) {
+ print "Candidate match - Jitter_crit = $11 :$jcrit\n" if ($verbose);
+ $jitter_error = $ERRORS{'CRITICAL'};
+ }elsif ($jitter > $jwarn ) {
+ print "Candidate match - Jitter_warn = $11 :$jwarn \n" if ($verbose);
+ $jitter_error = $ERRORS{'WARNING'};
+ } else {
+ $jitter_error = $ERRORS{'WARNING'};
+ }
+ }
+
+ }
+ }
}
}
More information about the Commits
mailing list