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 /plugins-scripts/check_ntp.pl | |
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
Diffstat (limited to 'plugins-scripts/check_ntp.pl')
-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; use POSIX; use strict; use Getopt::Long; -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); +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); use lib utils.pm; use utils qw($TIMEOUT %ERRORS &print_revision &support); @@ -90,6 +90,7 @@ GetOptions "6" => \$ipv6, "use-ipv6" => \$ipv6, "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 + "O" => \$opt_O, "zero-offset" => \$opt_O, # zero-offset bad "j=s" => \$opt_j, "jwarn=i" => \$opt_j, # jitter warning if above this number "k=s" => \$opt_k, "jcrit=i" => \$opt_k, # jitter critical if above this number "t=s" => \$opt_t, "timeout=i" => \$opt_t, @@ -218,7 +219,9 @@ while (<NTPDATE>) { # it's probably always bogus, but let's be paranoid here. # Has been reported that 0.0000 happens in a production environment # on Solaris 8 so this check should be taken out - SF tracker 1150777 - #if ($offset == 0) { undef $offset;} + if (defined $opt_O ) { + if ($offset == 0) { undef $offset;} + } $ntpdate_error = defined ($offset) ? $ERRORS{"OK"} : $ERRORS{"CRITICAL"}; print "ntperr = $ntpdate_error \n" if $verbose; @@ -425,7 +428,7 @@ exit $state; #### subs sub print_usage () { - print "Usage: $PROGNAME -H <host> [-46] [-w <warn>] [-c <crit>] [-j <warn>] [-k <crit>] [-v verbose]\n"; + print "Usage: $PROGNAME -H <host> [-46] [-O] [-w <warn>] [-c <crit>] [-j <warn>] [-k <crit>] [-v verbose]\n"; } sub print_help () { @@ -436,7 +439,9 @@ sub print_help () { print " Checks the local timestamp offset versus <host> with ntpdate Checks the jitter/dispersion of clock signal between <host> and its sys.peer with ntpq\n --w ( --warning) +-O (--zero-offset) + A zero offset on \"ntpdate\" will generate a CRITICAL.\n +-w (--warning) Clock offset in seconds at which a warning message will be generated.\n Defaults to $DEFAULT_OFFSET_WARN. -c (--critical) Clock offset in seconds at which a critical message will be generated.\n Defaults to $DEFAULT_OFFSET_CRIT. |