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/52602-nagios.time.diff | 89 ++++++++++++++++++++++++++++++++++ 1 file changed, 89 insertions(+) create mode 100644 web/attachments/52602-nagios.time.diff (limited to 'web/attachments/52602-nagios.time.diff') diff --git a/web/attachments/52602-nagios.time.diff b/web/attachments/52602-nagios.time.diff new file mode 100644 index 0000000..f6ccc62 --- /dev/null +++ b/web/attachments/52602-nagios.time.diff @@ -0,0 +1,89 @@ +--- /tmp/nagios-plugins-1.3.0/plugins/check_time.c 2003-02-15 23:48:46.000000000 +1100 ++++ nagios-plugins-1.3.0/plugins/check_time.c 2003-06-06 10:43:32.000000000 +1000 +@@ -61,7 +61,7 @@ + int check_critical_diff = FALSE; + int server_port = TIME_PORT; + char *server_address = NULL; +- ++int use_udp = FALSE; + + int process_arguments (int, char **); + void print_usage (void); +@@ -85,7 +85,13 @@ + time (&start_time); + + /* try to connect to the host at the given port number */ +- if (my_tcp_connect (server_address, server_port, &sd) != STATE_OK) { ++ if (use_udp) { ++ result = my_udp_connect (server_address, server_port, &sd); ++ } else { ++ result = my_tcp_connect (server_address, server_port, &sd); ++ } ++ ++ if (result != STATE_OK) { + if (check_critical_time == TRUE) + result = STATE_CRITICAL; + else if (check_warning_time == TRUE) +@@ -94,7 +100,21 @@ + result = STATE_UNKNOWN; + terminate (result, + "TIME UNKNOWN - could not connect to server %s, port %d\n", +- server_address, server_port); ++ server_address, server_port); ++ } ++ ++ if (use_udp) { ++ if (send (sd, "", 0, 0) < 0) { ++ if (check_critical_time == TRUE) ++ result = STATE_CRITICAL; ++ else if (check_warning_time == TRUE) ++ result = STATE_WARNING; ++ else ++ result = STATE_UNKNOWN; ++ terminate (result, ++ "TIME UNKNOWN - could not send UDP request to server %s, port %d\n", ++ server_address, server_port); ++ } + } + + /* watch for the connection string */ +@@ -170,6 +190,7 @@ + {"timeout", required_argument, 0, 't'}, + {"version", no_argument, 0, 'V'}, + {"help", no_argument, 0, 'h'}, ++ {"udp", no_argument, 0, 'u'}, + {0, 0, 0, 0} + }; + #endif +@@ -193,10 +214,10 @@ + while (1) { + #ifdef HAVE_GETOPT_H + c = +- getopt_long (argc, argv, "hVH:w:c:W:C:p:t:", long_options, ++ getopt_long (argc, argv, "hVH:w:c:W:C:p:t:u", long_options, + &option_index); + #else +- c = getopt (argc, argv, "hVH:w:c:W:C:p:t:"); ++ c = getopt (argc, argv, "hVH:w:c:W:C:p:t:u"); + #endif + + if (c == -1 || c == EOF) +@@ -275,6 +296,9 @@ + usage ("Timeout interval must be a nonnegative integer\n"); + socket_timeout = atoi (optarg); + break; ++ case 'u': ++ /* udp */ ++ use_udp = TRUE; + } + } + +@@ -338,6 +362,8 @@ + " Seconds before connection times out (default: %d)\n" + " -p, --port=INTEGER\n" + " Port number (default: %d)\n" ++ " -u, --udp\n" ++ " Use UDP to connect, not TCP\n" + " -h, --help\n" + " Print detailed help screen\n" + " -V, --version\n" -- cgit v1.2.3-74-g34f1