summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: cc80829)
raw | patch | inline | side by side (parent: cc80829)
author | Subhendu Ghosh <sghosh@users.sourceforge.net> | |
Tue, 14 Oct 2003 02:40:31 +0000 (02:40 +0000) | ||
committer | Subhendu Ghosh <sghosh@users.sourceforge.net> | |
Tue, 14 Oct 2003 02:40:31 +0000 (02:40 +0000) |
git-svn-id: https://nagiosplug.svn.sourceforge.net/svnroot/nagiosplug/nagiosplug/trunk@744 f882894a-f735-0410-b71e-b25c423dba1c
plugins-scripts/check_ntp.pl | patch | blob | history |
index 10079b693b4afa2b3cbfe21b8b55bc28df60e161..0546761b5e2fc27006d7c321a644fe8ff0e683f6 100755 (executable)
my $offset = undef;
my $jitter = undef;
my $syspeer = undef;
-my $candidates = 0;
+my $candidate = 0;
+my @candidates;
my $msg; # first line of output to print if format is invalid
my $state = $ERRORS{'UNKNOWN'};
# Field 10: offset
# 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) {
}
# number of candidates on <host> for sys.peer
if (/^(\*|\+|\#|o])/) {
- ++$candidates;
- print "Candiate count= $candidates\n" if ($verbose);
+ ++$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.]+)/) {
+ 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;
$jitter = $11;
$jitter_error = $ERRORS{'OK'};
}
}
+
}
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'};
+ }
+ }
+
+ }
+ }
}
}