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/230926-check_ntp.c.patch | 70 ++++++++++++++++++++++++++++++++ 1 file changed, 70 insertions(+) create mode 100644 web/attachments/230926-check_ntp.c.patch (limited to 'web/attachments/230926-check_ntp.c.patch') diff --git a/web/attachments/230926-check_ntp.c.patch b/web/attachments/230926-check_ntp.c.patch new file mode 100644 index 0000000..7b59002 --- /dev/null +++ b/web/attachments/230926-check_ntp.c.patch @@ -0,0 +1,70 @@ +--- check_ntp.c.orig 2007-04-10 08:17:18.000000000 +0100 ++++ check_ntp.c 2007-05-29 12:41:58.000000000 +0100 +@@ -47,6 +47,7 @@ + + static char *server_address=NULL; + static int verbose=0; ++static int max_hosts=0; + static double owarn=60; + static double ocrit=120; + static short do_jitter=0; +@@ -372,7 +373,15 @@ + } + + /* count the number of returned hosts, and allocate stuff accordingly */ +- for(ai_tmp=ai; ai_tmp!=NULL; ai_tmp=ai_tmp->ai_next){ num_hosts++; } ++ for(ai_tmp=ai; ai_tmp!=NULL; ai_tmp=ai_tmp->ai_next){ ++ num_hosts++; ++ /* Reached max # hosts to compare ? */ ++ if(max_hosts && num_hosts >= max_hosts && ai_tmp->ai_next) { ++printf("chopping at %d\n", num_hosts); ++ freeaddrinfo(ai_tmp->ai_next); ++ ai_tmp->ai_next = NULL; ++ } ++ } + req=(ntp_message*)malloc(sizeof(ntp_message)*num_hosts); + if(req==NULL) die(STATE_UNKNOWN, "can not allocate ntp message array"); + socklist=(int*)malloc(sizeof(int)*num_hosts); +@@ -651,6 +660,7 @@ + {"critical", required_argument, 0, 'c'}, + {"jwarn", required_argument, 0, 'j'}, + {"jcrit", required_argument, 0, 'k'}, ++ {"maxhosts", required_argument, 0, 'm'}, + {"timeout", required_argument, 0, 't'}, + {"hostname", required_argument, 0, 'H'}, + {0, 0, 0, 0} +@@ -661,7 +671,7 @@ + usage ("\n"); + + while (1) { +- c = getopt_long (argc, argv, "Vhv46w:c:j:k:t:H:", longopts, &option); ++ c = getopt_long (argc, argv, "Vhv46w:c:j:k:t:H:m:", longopts, &option); + if (c == -1 || c == EOF || c == 1) + break; + +@@ -677,6 +687,9 @@ + case 'v': + verbose++; + break; ++ case 'm': ++ max_hosts = atoi(optarg); ++ break; + case 'w': + owarn = atof(optarg); + break; +@@ -848,6 +861,8 @@ + printf (" %s\n", _("Warning value for jitter")); + printf (" %s\n", "-k, --critical=DOUBLE"); + printf (" %s\n", _("Critical value for jitter")); ++ printf (" %s\n", "-m, --maxhosts=INTEGER"); ++ printf (" %s\n", _("Max hosts to check - for where host expands to multiple addresses")); + printf (_(UT_TIMEOUT), DEFAULT_SOCKET_TIMEOUT); + printf (_(UT_VERBOSE)); + printf (_(UT_SUPPORT)); +@@ -857,5 +872,5 @@ + print_usage(void) + { + printf (_("Usage:")); +- printf("%s -H [-w ] [-c ] [-j ] [-k ] [-v verbose]\n", progname); ++ printf("%s -H [-w ] [-c ] [-j ] [-k ] [-v verbose] [-m ]\n", progname); + } -- cgit v1.2.3-74-g34f1