summaryrefslogtreecommitdiffstats
path: root/web/attachments/265606-nagios-plugins-1.4.11-check_dig_fix-1.patch
diff options
context:
space:
mode:
Diffstat (limited to 'web/attachments/265606-nagios-plugins-1.4.11-check_dig_fix-1.patch')
-rw-r--r--web/attachments/265606-nagios-plugins-1.4.11-check_dig_fix-1.patch48
1 files changed, 48 insertions, 0 deletions
diff --git a/web/attachments/265606-nagios-plugins-1.4.11-check_dig_fix-1.patch b/web/attachments/265606-nagios-plugins-1.4.11-check_dig_fix-1.patch
new file mode 100644
index 0000000..d1a3516
--- /dev/null
+++ b/web/attachments/265606-nagios-plugins-1.4.11-check_dig_fix-1.patch
@@ -0,0 +1,48 @@
1Date: 07 Feburary 2008
2Author: Jethro Carr <jethro.carr@jethrocarr.com> working for Prophecy Networks NZ.
3Details: Fixed check_dig plugin to make the dig command in the backend run for the specified time period.
4
5--- nagios-plugins-1.4.1/plugins/check_dig.c 2005-01-27 10:21:01.000000000 +1300
6--- nagios-plugins-1.4.11.orig/plugins/check_dig.c 2007-01-29 10:46:41.000000000 +1300
7+++ nagios-plugins-1.4.11/plugins/check_dig.c 2008-02-07 10:59:46.000000000 +1300
8@@ -54,6 +54,8 @@
9
10 #define UNDEFINED 0
11 #define DEFAULT_PORT 53
12+#define DEFAULT_TRIES 3
13+#define DEFAULT_TIMEOUT 10
14
15 char *query_address = NULL;
16 char *record_type = "A";
17@@ -61,6 +63,7 @@
18 char *dns_server = NULL;
19 int verbose = FALSE;
20 int server_port = DEFAULT_PORT;
21+int number_tries = DEFAULT_TRIES;
22 double warning_interval = UNDEFINED;
23 double critical_interval = UNDEFINED;
24 struct timeval tv;
25@@ -76,6 +79,7 @@
26 long microsec;
27 double elapsed_time;
28 int result = STATE_UNKNOWN;
29+ timeout_interval = DEFAULT_TIMEOUT;
30
31 setlocale (LC_ALL, "");
32 bindtextdomain (PACKAGE, LOCALEDIR);
33@@ -88,9 +92,13 @@
34 if (process_arguments (argc, argv) == ERROR)
35 usage_va(_("Could not parse arguments"));
36
37+ /* dig applies the timeout to each try, so we need to work around this */
38+ int timeout_interval_dig = ceil((double) timeout_interval / (double) number_tries);
39+
40 /* get the command to run */
41- asprintf (&command_line, "%s @%s -p %d %s -t %s",
42- PATH_TO_DIG, dns_server, server_port, query_address, record_type);
43+ asprintf (&command_line, "%s @%s -p %d %s -t %s +tries=%d +time=%d",
44+ PATH_TO_DIG, dns_server, server_port, query_address, record_type, number_tries, timeout_interval_dig);
45+
46
47 alarm (timeout_interval);
48 gettimeofday (&tv, NULL);