summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 1c13d63)
raw | patch | inline | side by side (parent: 1c13d63)
author | Subhendu Ghosh <sghosh@users.sourceforge.net> | |
Wed, 25 May 2005 03:37:48 +0000 (03:37 +0000) | ||
committer | Subhendu Ghosh <sghosh@users.sourceforge.net> | |
Wed, 25 May 2005 03:37:48 +0000 (03:37 +0000) |
git-svn-id: https://nagiosplug.svn.sourceforge.net/svnroot/nagiosplug/nagiosplug/trunk@1179 f882894a-f735-0410-b71e-b25c423dba1c
plugins-scripts/check_ntp.pl | patch | blob | history |
index 90cf7904d99ad2dcf2897ac41487c11aaec8b9d0..d0167cdedd019e38c3af543bb055382f5407dd5c 100755 (executable)
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);
"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,
# 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;
#### 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 () {
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.