[Nagiosplug-checkins] CVS: nagiosplug/plugins-scripts check_ntp.pl,1.5,1.6
Subhendu Ghosh
sghosh at users.sourceforge.net
Wed Jun 5 21:14:02 CEST 2002
Update of /cvsroot/nagiosplug/nagiosplug/plugins-scripts
In directory usw-pr-cvs1:/tmp/cvs-serv29981
Modified Files:
check_ntp.pl
Log Message:
conditional on ntpdc
Index: check_ntp.pl
===================================================================
RCS file: /cvsroot/nagiosplug/nagiosplug/plugins-scripts/check_ntp.pl,v
retrieving revision 1.5
retrieving revision 1.6
diff -C2 -r1.5 -r1.6
*** check_ntp.pl 27 May 2002 02:10:07 -0000 1.5
--- check_ntp.pl 6 Jun 2002 04:13:44 -0000 1.6
***************
*** 120,123 ****
--- 120,129 ----
my $key = undef;
+ # some systems don't have a proper ntpdc/xntpdc
+ if ($utils::PATH_TO_NTPDC && -x $utils::PATH_TO_NTPDC ) {
+ my $have_ntpdc = 1;
+ }else{
+ my $have_ntpdc = 0;
+ }
# Just in case of problems, let's not hang Nagios
***************
*** 177,196 ****
###
! if ( open(NTPDC,"$utils::PATH_TO_NTPDC -s $host 2>&1 |") ) {
! while (<NTPDC>) {
! print $_ if ($verbose);
! if (/([^\s]+)\s+([-0-9.]+)\s+([-0-9.]+)\s+([-0-9.]+)\s+([-0-9.]+)\s+([-0-9.]+)\s+([-0-9.]+)\s+([-0-9.]+)/) {
! if ($8>15) {
! print "Dispersion = $8 \n" if ($verbose);
! $dispersion_error = $ERRORS{'CRITICAL'};
! } elsif ($8>5 && $dispersion_error<$ERRORS{'CRITICAL'}) {
! print "Dispersion = $8 \n" if ($verbose);
! $dispersion_error = $ERRORS{'WARNING'};
! } else {
! $dispersion_error = $ERRORS{'OK'};
}
}
}
- close NTPDC;
}
--- 183,205 ----
###
! if ($have_ntpdc) {
!
! if ( open(NTPDC,"$utils::PATH_TO_NTPDC -s $host 2>&1 |") ) {
! while (<NTPDC>) {
! print $_ if ($verbose);
! if (/([^\s]+)\s+([-0-9.]+)\s+([-0-9.]+)\s+([-0-9.]+)\s+([-0-9.]+)\s+([-0-9.]+)\s+([-0-9.]+)\s+([-0-9.]+)/) {
! if ($8>15) {
! print "Dispersion = $8 \n" if ($verbose);
! $dispersion_error = $ERRORS{'CRITICAL'};
! } elsif ($8>5 && $dispersion_error<$ERRORS{'CRITICAL'}) {
! print "Dispersion = $8 \n" if ($verbose);
! $dispersion_error = $ERRORS{'WARNING'};
! } else {
! $dispersion_error = $ERRORS{'OK'};
! }
}
}
+ close NTPDC;
}
}
***************
*** 206,210 ****
}
! } elsif ($dispersion_error != $ERRORS{'OK'}) {
$state = $dispersion_error;
$answer = "Dispersion too high\n";
--- 215,219 ----
}
! } elsif ($have_ntpdc && $dispersion_error != $ERRORS{'OK'}) {
$state = $dispersion_error;
$answer = "Dispersion too high\n";
More information about the Commits
mailing list