summaryrefslogtreecommitdiffstats
path: root/plugins
diff options
context:
space:
mode:
Diffstat (limited to 'plugins')
-rw-r--r--plugins/check_dig.c16
1 files changed, 13 insertions, 3 deletions
diff --git a/plugins/check_dig.c b/plugins/check_dig.c
index 37a9a467..286efbeb 100644
--- a/plugins/check_dig.c
+++ b/plugins/check_dig.c
@@ -57,6 +57,7 @@ char *query_address = NULL;
57char *record_type = "A"; 57char *record_type = "A";
58char *expected_address = NULL; 58char *expected_address = NULL;
59char *dns_server = NULL; 59char *dns_server = NULL;
60char *dig_args = "";
60int verbose = FALSE; 61int verbose = FALSE;
61int server_port = DEFAULT_PORT; 62int server_port = DEFAULT_PORT;
62double warning_interval = UNDEFINED; 63double warning_interval = UNDEFINED;
@@ -87,8 +88,8 @@ main (int argc, char **argv)
87 usage_va(_("Could not parse arguments")); 88 usage_va(_("Could not parse arguments"));
88 89
89 /* get the command to run */ 90 /* get the command to run */
90 asprintf (&command_line, "%s @%s -p %d %s -t %s", 91 asprintf (&command_line, "%s @%s -p %d %s -t %s %s",
91 PATH_TO_DIG, dns_server, server_port, query_address, record_type); 92 PATH_TO_DIG, dns_server, server_port, query_address, record_type, dig_args);
92 93
93 alarm (timeout_interval); 94 alarm (timeout_interval);
94 gettimeofday (&tv, NULL); 95 gettimeofday (&tv, NULL);
@@ -190,6 +191,7 @@ process_arguments (int argc, char **argv)
190 {"warning", required_argument, 0, 'w'}, 191 {"warning", required_argument, 0, 'w'},
191 {"critical", required_argument, 0, 'c'}, 192 {"critical", required_argument, 0, 'c'},
192 {"timeout", required_argument, 0, 't'}, 193 {"timeout", required_argument, 0, 't'},
194 {"dig-arguments", required_argument, 0, 'A'},
193 {"verbose", no_argument, 0, 'v'}, 195 {"verbose", no_argument, 0, 'v'},
194 {"version", no_argument, 0, 'V'}, 196 {"version", no_argument, 0, 'V'},
195 {"help", no_argument, 0, 'h'}, 197 {"help", no_argument, 0, 'h'},
@@ -203,7 +205,7 @@ process_arguments (int argc, char **argv)
203 return ERROR; 205 return ERROR;
204 206
205 while (1) { 207 while (1) {
206 c = getopt_long (argc, argv, "hVvt:l:H:w:c:T:p:a:", longopts, &option); 208 c = getopt_long (argc, argv, "hVvt:l:H:w:c:T:p:a:A:", longopts, &option);
207 209
208 if (c == -1 || c == EOF) 210 if (c == -1 || c == EOF)
209 break; 211 break;
@@ -254,6 +256,9 @@ process_arguments (int argc, char **argv)
254 usage_va(_("Timeout interval must be a positive integer - %s"), optarg); 256 usage_va(_("Timeout interval must be a positive integer - %s"), optarg);
255 } 257 }
256 break; 258 break;
259 case 'A': /* dig arguments */
260 dig_args = strdup(optarg);
261 break;
257 case 'v': /* verbose */ 262 case 'v': /* verbose */
258 verbose = TRUE; 263 verbose = TRUE;
259 break; 264 break;
@@ -320,9 +325,14 @@ print_help (void)
320 printf (" %s\n",_("record type to lookup (default: A)")); 325 printf (" %s\n",_("record type to lookup (default: A)"));
321 printf (" %s\n","-a, --expected_address=STRING"); 326 printf (" %s\n","-a, --expected_address=STRING");
322 printf (" %s\n",_("an address expected to be in the answer section.if not set, uses whatever was in -l")); 327 printf (" %s\n",_("an address expected to be in the answer section.if not set, uses whatever was in -l"));
328 printf (" %s\n","-A, --dig-arguments=STRING");
329 printf (" %s\n",_("pass STRING as argument(s) to dig"));
323 printf (_(UT_WARN_CRIT)); 330 printf (_(UT_WARN_CRIT));
324 printf (_(UT_TIMEOUT), DEFAULT_SOCKET_TIMEOUT); 331 printf (_(UT_TIMEOUT), DEFAULT_SOCKET_TIMEOUT);
325 printf (_(UT_VERBOSE)); 332 printf (_(UT_VERBOSE));
333 printf ("%s\n", _("Examples:"));
334 printf (" %s\n", "check_dig -H DNSSERVER -l www.example.com -A \"+tcp\"");
335 printf (" %s\n", "This will send a tcp query to DNSSERVER for www.example.com");
326 printf (_(UT_SUPPORT)); 336 printf (_(UT_SUPPORT));
327} 337}
328 338