ntp/ 0000755 0000000 0000000 00000000000 10346101462 010352 5 ustar root root ntp/Requester/ 0000755 0000000 0000000 00000000000 11703342315 012333 5 ustar root root ntp/Requester/ntptrace.pm 0000644 0000000 0000000 00000004345 10346077755 014536 0 ustar root root # NtpTraceReqWorker is a helper class for the Requester::ntptrace class # below. NtptraceReqWorker runs ntptrace in the background (since it may # take some time) package NtpTraceReqWorker; use CmdWorker; our(@ISA); @ISA = qw( CmdWorker ); # create a new Worker executing command $comm and putting # the results into $info hash sub new { my( $this, $info, $comm ) = @_; print " creating NtpTraceReqWorker for $comm\n" if( $BigSister::common::dl > 2 ); my $self = CmdWorker::new( $this, $comm ); $self->{"ntptrace.info"} = $info; $info->{0}->{"text"} = ""; $info->{0}->{"status"} = 0; return $self; } sub process { my( $self, $line ) = @_; print " processing ntptrace:$line\n" if( $BigSister::common::dl > 6 ); my $info = $self->{"ntptrace.info"}->{0}; unless( $info->{"text"} ) { if( $line =~ /stratum (\d+).*offset ([0-9-.]+).*distance ([0-9-.]+)/ ) { $info->{"stratum"} = $1; $info->{"offset"} = $2; $info->{"distance"} = $3; $info->{"status"} = ($1>=16) ? 1 : 2; print " ntptrace: got info\n" if( $BigSister::common::dl > 7 ); } elsif( $line =~ /\*Timeout\*/ ) { $info->{"status"} = 0; print " ntptrace: timeout\n" if( $BigSister::common::dl > 7 ); } } if( $line =~ /\*Not Synchronized\*/ ) { $info->{"status"} = 1; } $info->{"text"} .= "$line\n"; } package Requester::ntptrace; use strict; use Requester::Requester; our(@ISA); @ISA = qw(Requester::Requester); my $requester = new Requester::ntptrace; my $comm = "ntptrace -n "; sub new { my ($this, $args ) = @_; my $class = ref($this) || $this; my $self = {}; bless($self, $class); $self->register( "ntptrace" ); return $self; } sub criticalness { return 0; } sub consumes { return 0; } # the default "request()" method is good enough for our purposes sub getinfo { my( $self ) = @_; my $info = { 0 => {} }; my $hostcomm = $comm." ".($self->{"env"}->{"nodeinstance"}->{"host"}); my $worker = new NtpTraceReqWorker( $info, $hostcomm ); $worker->{"Test.info"} = $info; return $worker; } sub available { my( $self ) = @_; return( $self->command_available( "ntptrace", "invalid", "options" ) ); } 1; ntp/README 0000644 0000000 0000000 00000001310 10021401074 011215 0 ustar root root The ntp module implements the ntp health check. This health check polls a remote (or local) machine via the Network Time Protocol. It reports red if the target machine does not answer NTP requests at all. It reports yellow if the target machine is answering but is not synchronized with its masters/peers. The module requires the ntptrace command to be available on the machine it is running. SYNTAX (please use the testers command in order to get an up-to-date syntax description) ntp Monitors NTP server via ntptrace command item: string column name we should report the results under perf: integer number time in minutes between sending performance data (0 for no performance data) ntp/graphtemplates 0000644 0000000 0000000 00000001021 07722751376 013332 0 ustar root root # # NTP offset # graph ntp_offset input ntp.offset.(\d) value-type gauge value-identifier $HOST.ntp_offset input-interval $shortInterval input-deadtime $shortDeadTime graph-id $HOST.ntp_times unit-label s legend offset size 400x120 title NTP Timing # # NTP synch distance # graph ntp_distance input ntp.distance.(\d) value-type gauge value-identifier $HOST.ntp_distance input-interval $shortInterval input-deadtime $shortDeadTime graph-id $HOST.ntp_times unit-label s legend sync distance size 400x120 title NTP Timing ntp/module.info 0000644 0000000 0000000 00000000116 10346101461 012511 0 ustar root root module = ntp descr = NTP Server Monitor version = 01.01 author = Thomas Aeby ntp/tests.cfg 0000644 0000000 0000000 00000002667 07724576143 012232 0 ustar root root # # NTP monitor test ntp_NTP { static set name "ntp"; static set domain ntptrace; static set description "Monitors NTP server via ntptrace command"; pernode set report_item "ntp"; set perf_frequency 0; set niceness 2; static set arguments "item:string:column name we should report the results under" "perf:int:time in minutes between sending performance data (0 for no performance data)"; pernode precheck { set test_available domain_available( ${domain} ); } init { instance import item report_item; instance import perf perf_frequency; } pernode monitor { get ${domain}.status.0 ${domain}.text.0 ${domain}.offset.0 ${domain}.distance.0 ${domain}.stratum.0; pernode set status ${${domain}.status.0}; pernode set text ${${domain}.text.0}; pernode set offset ${${domain}.offset.0}; pernode set distance ${${domain}.distance.0}; pernode set stratum ${${domain}.stratum.0}; } report { debug 5 status ${status} stratum ${stratum} offset ${offset} distance ${distance}; status red ${status} == 0 "&red ntp dead"; status yellow ${status} == 1 "&yellow ntp running unsynchronized"; status green ${status} == 2 "&green ntp OK"; comment html "
${text}"; } pernode perf { export always ntp.stratum, ${stratum}; export always ntp.offset, ${offset}; export always ntp.distance, ${distance}; } }