diff options
author | Subhendu Ghosh <sghosh@users.sourceforge.net> | 2005-05-25 03:37:48 +0000 |
---|---|---|
committer | Subhendu Ghosh <sghosh@users.sourceforge.net> | 2005-05-25 03:37:48 +0000 |
commit | 4aa2652a5451bca4d19a2e4b7fcb5141c24c3d65 (patch) | |
tree | bd5630711d84c8f60b742d984fbf0a4236a1078e | |
parent | 1c13d632b4a3b4cc0f11ba4cad6de0c3f799a26c (diff) | |
download | monitoring-plugins-4aa2652a5451bca4d19a2e4b7fcb5141c24c3d65.tar.gz |
new option for zero offset - 1159317
git-svn-id: https://nagiosplug.svn.sourceforge.net/svnroot/nagiosplug/nagiosplug/trunk@1179 f882894a-f735-0410-b71e-b25c423dba1c
-rwxr-xr-x | plugins-scripts/check_ntp.pl | 13 |
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; | |||
61 | use POSIX; | 61 | use POSIX; |
62 | use strict; | 62 | use strict; |
63 | use Getopt::Long; | 63 | use Getopt::Long; |
64 | use vars qw($opt_V $opt_h $opt_H $opt_t $opt_w $opt_c $opt_j $opt_k $verbose $PROGNAME $def_jitter $ipv4 $ipv6); | 64 | use 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); |
65 | use lib utils.pm; | 65 | use lib utils.pm; |
66 | use utils qw($TIMEOUT %ERRORS &print_revision &support); | 66 | use 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 | ||
427 | sub print_usage () { | 430 | sub 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 | ||
431 | sub print_help () { | 434 | sub print_help () { |
@@ -436,7 +439,9 @@ sub print_help () { | |||
436 | print " | 439 | print " |
437 | Checks the local timestamp offset versus <host> with ntpdate | 440 | Checks the local timestamp offset versus <host> with ntpdate |
438 | Checks the jitter/dispersion of clock signal between <host> and its sys.peer with ntpq\n | 441 | Checks 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. |