[Nagiosplug-checkins] CVS: nagiosplug/plugins-scripts check_ntp.pl,1.7,1.8

Subhendu Ghosh sghosh at users.sourceforge.net
Tue Sep 3 19:13:02 CEST 2002


Update of /cvsroot/nagiosplug/nagiosplug/plugins-scripts
In directory usw-pr-cvs1:/tmp/cvs-serv27525/plugins-scripts

Modified Files:
	check_ntp.pl 
Log Message:
dispersion check now controlled by warn and crit

Index: check_ntp.pl
===================================================================
RCS file: /cvsroot/nagiosplug/nagiosplug/plugins-scripts/check_ntp.pl,v
retrieving revision 1.7
retrieving revision 1.8
diff -C2 -r1.7 -r1.8
*** check_ntp.pl	8 Jun 2002 00:33:50 -0000	1.7
--- check_ntp.pl	4 Sep 2002 02:12:05 -0000	1.8
***************
*** 77,82 ****
  	 "h"   => \$opt_h, "help"       => \$opt_h,
  	 "v" => \$verbose, "verbose"  => \$verbose,
! 	 "w=s" => \$opt_w, "warning=s"  => \$opt_w,   # offset|adjust warning if above this number
! 	 "c=s" => \$opt_c, "critical=s" => \$opt_c,   # offset|adjust critical if above this number
  	 "H=s" => \$opt_H, "hostname=s" => \$opt_H);
  
--- 77,82 ----
  	 "h"   => \$opt_h, "help"       => \$opt_h,
  	 "v" => \$verbose, "verbose"  => \$verbose,
! 	 "w=f" => \$opt_w, "warning=f"  => \$opt_w,   # offset|adjust warning if above this number
! 	 "c=f" => \$opt_c, "critical=f" => \$opt_c,   # offset|adjust critical if above this number
  	 "H=s" => \$opt_H, "hostname=s" => \$opt_H);
  
***************
*** 99,109 ****
  }
  
! ($opt_w) || ($opt_w = shift) || ($opt_w = 60);
! my $warning = $1 if ($opt_w =~ /([0-9]+)/);
  
! ($opt_c) || ($opt_c = shift) || ($opt_c = 120);
! my $critical = $1 if ($opt_c =~ /([0-9]+)/);
  
! if ($opt_c < $opt_w) {
  	print "Critical offset should be larger than warning offset\n";
  	print_usage();
--- 99,110 ----
  }
  
! ($opt_w) || ($opt_w = 60);
! my $warning = $1 if ($opt_w =~ /([0-9.]+)/);
  
! ($opt_c) || ($opt_c = 120);
! my $critical = $1 if ($opt_c =~ /([0-9.]+)/);
  
! 
! if ($critical < $warning ) {
  	print "Critical offset should be larger than warning offset\n";
  	print_usage();
***************
*** 190,198 ****
  			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 {
--- 191,199 ----
  			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 gt $critical) {
! 					print "Dispersion_crit = $8 :$critical\n" if ($verbose);
  					$dispersion_error = $ERRORS{'CRITICAL'};
! 				} elsif ($8 gt $warning ) {
! 					print "Dispersion_warn = $8 :$warning \n" if ($verbose);
  					$dispersion_error = $ERRORS{'WARNING'};
  				} else {
***************
*** 253,257 ****
  
  sub print_usage () {
! 	print "Usage: $PROGNAME -H <host> [-w <warn>] [-c <crit>]\n";
  }
  
--- 254,258 ----
  
  sub print_usage () {
! 	print "Usage: $PROGNAME -H <host> [-w <warn>] [-c <crit>] [-v verbose]\n";
  }
  
***************
*** 264,267 ****
--- 265,270 ----
  	print "<warn> = Clock offset in seconds at which a warning message will be generated.\n	Defaults to 60.\n";
  	print "<crit> = Clock offset in seconds at which a critical message will be generated.\n	Defaults to 120.\n\n";
+ 	print "The same warning and critical values are used to check against the dispersion \n";
+ 	print "column of ntpdc/xntpdc for the host being queried.\n\n";
  	support();
  }





More information about the Commits mailing list