summaryrefslogtreecommitdiffstats
path: root/plugins-scripts/check_ntp.pl
diff options
context:
space:
mode:
Diffstat (limited to 'plugins-scripts/check_ntp.pl')
-rwxr-xr-xplugins-scripts/check_ntp.pl13
1 files changed, 9 insertions, 4 deletions
diff --git a/plugins-scripts/check_ntp.pl b/plugins-scripts/check_ntp.pl
index 90cf7904..d0167cde 100755
--- a/plugins-scripts/check_ntp.pl
+++ b/plugins-scripts/check_ntp.pl
@@ -61,7 +61,7 @@ require 5.004;
61use POSIX; 61use POSIX;
62use strict; 62use strict;
63use Getopt::Long; 63use Getopt::Long;
64use vars qw($opt_V $opt_h $opt_H $opt_t $opt_w $opt_c $opt_j $opt_k $verbose $PROGNAME $def_jitter $ipv4 $ipv6); 64use vars qw($opt_V $opt_h $opt_H $opt_t $opt_w $opt_c $opt_O $opt_j $opt_k $verbose $PROGNAME $def_jitter $ipv4 $ipv6);
65use lib utils.pm; 65use lib utils.pm;
66use utils qw($TIMEOUT %ERRORS &print_revision &support); 66use utils qw($TIMEOUT %ERRORS &print_revision &support);
67 67
@@ -90,6 +90,7 @@ GetOptions
90 "6" => \$ipv6, "use-ipv6" => \$ipv6, 90 "6" => \$ipv6, "use-ipv6" => \$ipv6,
91 "w=f" => \$opt_w, "warning=f" => \$opt_w, # offset|adjust warning if above this number 91 "w=f" => \$opt_w, "warning=f" => \$opt_w, # offset|adjust warning if above this number
92 "c=f" => \$opt_c, "critical=f" => \$opt_c, # offset|adjust critical if above this number 92 "c=f" => \$opt_c, "critical=f" => \$opt_c, # offset|adjust critical if above this number
93 "O" => \$opt_O, "zero-offset" => \$opt_O, # zero-offset bad
93 "j=s" => \$opt_j, "jwarn=i" => \$opt_j, # jitter warning if above this number 94 "j=s" => \$opt_j, "jwarn=i" => \$opt_j, # jitter warning if above this number
94 "k=s" => \$opt_k, "jcrit=i" => \$opt_k, # jitter critical if above this number 95 "k=s" => \$opt_k, "jcrit=i" => \$opt_k, # jitter critical if above this number
95 "t=s" => \$opt_t, "timeout=i" => \$opt_t, 96 "t=s" => \$opt_t, "timeout=i" => \$opt_t,
@@ -218,7 +219,9 @@ while (<NTPDATE>) {
218 # it's probably always bogus, but let's be paranoid here. 219 # it's probably always bogus, but let's be paranoid here.
219 # Has been reported that 0.0000 happens in a production environment 220 # Has been reported that 0.0000 happens in a production environment
220 # on Solaris 8 so this check should be taken out - SF tracker 1150777 221 # on Solaris 8 so this check should be taken out - SF tracker 1150777
221 #if ($offset == 0) { undef $offset;} 222 if (defined $opt_O ) {
223 if ($offset == 0) { undef $offset;}
224 }
222 225
223 $ntpdate_error = defined ($offset) ? $ERRORS{"OK"} : $ERRORS{"CRITICAL"}; 226 $ntpdate_error = defined ($offset) ? $ERRORS{"OK"} : $ERRORS{"CRITICAL"};
224 print "ntperr = $ntpdate_error \n" if $verbose; 227 print "ntperr = $ntpdate_error \n" if $verbose;
@@ -425,7 +428,7 @@ exit $state;
425#### subs 428#### subs
426 429
427sub print_usage () { 430sub print_usage () {
428 print "Usage: $PROGNAME -H <host> [-46] [-w <warn>] [-c <crit>] [-j <warn>] [-k <crit>] [-v verbose]\n"; 431 print "Usage: $PROGNAME -H <host> [-46] [-O] [-w <warn>] [-c <crit>] [-j <warn>] [-k <crit>] [-v verbose]\n";
429} 432}
430 433
431sub print_help () { 434sub print_help () {
@@ -436,7 +439,9 @@ sub print_help () {
436 print " 439 print "
437Checks the local timestamp offset versus <host> with ntpdate 440Checks the local timestamp offset versus <host> with ntpdate
438Checks the jitter/dispersion of clock signal between <host> and its sys.peer with ntpq\n 441Checks the jitter/dispersion of clock signal between <host> and its sys.peer with ntpq\n
439-w ( --warning) 442-O (--zero-offset)
443 A zero offset on \"ntpdate\" will generate a CRITICAL.\n
444-w (--warning)
440 Clock offset in seconds at which a warning message will be generated.\n Defaults to $DEFAULT_OFFSET_WARN. 445 Clock offset in seconds at which a warning message will be generated.\n Defaults to $DEFAULT_OFFSET_WARN.
441-c (--critical) 446-c (--critical)
442 Clock offset in seconds at which a critical message will be generated.\n Defaults to $DEFAULT_OFFSET_CRIT. 447 Clock offset in seconds at which a critical message will be generated.\n Defaults to $DEFAULT_OFFSET_CRIT.