summaryrefslogtreecommitdiffstats
path: root/web/attachments/177459-check_ntp.diff
blob: da11eb49f8389caea160e11148915db9ebf68e4a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
--- check_ntp	2006-04-28 07:19:01.546010471 +0200
+++ check_ntp.modified	2006-04-28 07:02:45.236824995 +0200
@@ -56,6 +56,10 @@
 # changed ntpdc to ntpq - jitter/dispersion is in milliseconds
 #
 # Patch for for regex for stratum1 refid.
+#
+# Script modified 2006 April 28 by Johan Nilsson (johan.nilsson@axis.com)
+# 	o Modified script to handle case when ntpdate reports time, but ntpq times out
+#
 
 require 5.004;
 use POSIX;
@@ -427,8 +431,11 @@
 
 foreach my $key (keys %ERRORS) {
 	if ($state==$ERRORS{$key}) {
-#		print ("NTP $key: $answer");
-		print ("NTP $key: $answer|offset=$offset, jitter=" . $jitter/1000 .	",peer_stratum=$stratum\n");
+		if ( defined($jitter) ) {
+			print ("NTP $key: $answer|offset=$offset, jitter=" . $jitter/1000 .     ",peer_stratum=$stratum\n");
+		} else { 
+			print ("NTP $key: $answer");
+		};
 		last;
 	}
 }