From 0b6423f9c99d9edf8c96fefd0f6c453859395aa1 Mon Sep 17 00:00:00 2001 From: Holger Weiss Date: Mon, 30 Sep 2013 00:03:24 +0200 Subject: Import Nagios Plugins site Import the Nagios Plugins web site, Cronjobs, infrastructure scripts, and configuration files. --- web/attachments/344028-check_ntp_time.c.diff | 65 ++++++++++++++++++++++++++++ 1 file changed, 65 insertions(+) create mode 100644 web/attachments/344028-check_ntp_time.c.diff (limited to 'web/attachments/344028-check_ntp_time.c.diff') diff --git a/web/attachments/344028-check_ntp_time.c.diff b/web/attachments/344028-check_ntp_time.c.diff new file mode 100644 index 0000000..bb07962 --- /dev/null +++ b/web/attachments/344028-check_ntp_time.c.diff @@ -0,0 +1,65 @@ +Index: check_ntp_time.c +=================================================================== +--- check_ntp_time.c (revision 2244) ++++ check_ntp_time.c (working copy) +@@ -48,6 +48,7 @@ + static int quiet=0; + static char *owarn="60"; + static char *ocrit="120"; ++static int time_offset=0; + + int process_arguments (int, char **); + thresholds *offset_thresholds = NULL; +@@ -394,7 +395,7 @@ + gettimeofday(&recv_time, NULL); + DBG(print_ntp_message(&req[i])); + respnum=servers[i].num_responses++; +- servers[i].offset[respnum]=calc_offset(&req[i], &recv_time); ++ servers[i].offset[respnum]=calc_offset(&req[i], &recv_time)+time_offset; + if(verbose) { + printf("offset %.10g\n", servers[i].offset[respnum]); + } +@@ -449,6 +450,7 @@ + {"use-ipv4", no_argument, 0, '4'}, + {"use-ipv6", no_argument, 0, '6'}, + {"quiet", no_argument, 0, 'q'}, ++ {"time-offset", optional_argument, 0, 'o'}, + {"warning", required_argument, 0, 'w'}, + {"critical", required_argument, 0, 'c'}, + {"timeout", required_argument, 0, 't'}, +@@ -462,7 +464,7 @@ + usage ("\n"); + + while (1) { +- c = getopt_long (argc, argv, "Vhv46qw:c:t:H:p:", longopts, &option); ++ c = getopt_long (argc, argv, "Vhv46qw:c:t:H:p:o:", longopts, &option); + if (c == -1 || c == EOF || c == 1) + break; + +@@ -498,6 +500,9 @@ + case 't': + socket_timeout=atoi(optarg); + break; ++ case 'o': ++ time_offset=atoi(optarg); ++ break; + case '4': + address_family = AF_INET; + break; +@@ -609,6 +614,8 @@ + printf (" %s\n", _("Offset to result in warning status (seconds)")); + printf (" %s\n", "-c, --critical=THRESHOLD"); + printf (" %s\n", _("Offset to result in critical status (seconds)")); ++ printf (" %s\n", "-o, --time_offset="); ++ printf (" %s\n", _("Offset of the ntp server relative to local server(seconds)")); + printf (_(UT_TIMEOUT), DEFAULT_SOCKET_TIMEOUT); + printf (_(UT_VERBOSE)); + +@@ -639,6 +646,6 @@ + print_usage(void) + { + printf (_("Usage:")); +- printf(" %s -H [-w ] [-c ] [-v verbose]\n", progname); ++ printf(" %s -H [-w ] [-c ] [-v verbose] [-o