From 3d4ca92a6b6a99b6c039a5daa2742bf29380dec4 Mon Sep 17 00:00:00 2001 From: Matthias Eble Date: Fri, 14 Mar 2008 23:47:41 +0000 Subject: Added -A/--dig-arguments to check_dig (#1889453/#1874041) git-svn-id: https://nagiosplug.svn.sourceforge.net/svnroot/nagiosplug/nagiosplug/trunk@1943 f882894a-f735-0410-b71e-b25c423dba1c diff --git a/NEWS b/NEWS index b2ce70e..57bf838 100644 --- a/NEWS +++ b/NEWS @@ -15,6 +15,7 @@ This file documents the major additions and syntax changes between releases. check_procs now accepts --ereg-argument-array for a regular expression match to the argument array Reverted back to using pst3 for Solaris systems. Fixed issues re: -m64 needed to compile on 64bit systems If applicable, Gettext linked dynamically instead of statically + check_dig can now pass arguments dig by using -A/--dig-arguments (#1874041/#1889453) 1.4.11 13th December 2007 Fixed check_http regression in 1.4.10 where following redirects to diff --git a/plugins/check_dig.c b/plugins/check_dig.c index 37a9a46..286efbe 100644 --- a/plugins/check_dig.c +++ b/plugins/check_dig.c @@ -57,6 +57,7 @@ char *query_address = NULL; char *record_type = "A"; char *expected_address = NULL; char *dns_server = NULL; +char *dig_args = ""; int verbose = FALSE; int server_port = DEFAULT_PORT; double warning_interval = UNDEFINED; @@ -87,8 +88,8 @@ main (int argc, char **argv) usage_va(_("Could not parse arguments")); /* get the command to run */ - asprintf (&command_line, "%s @%s -p %d %s -t %s", - PATH_TO_DIG, dns_server, server_port, query_address, record_type); + asprintf (&command_line, "%s @%s -p %d %s -t %s %s", + PATH_TO_DIG, dns_server, server_port, query_address, record_type, dig_args); alarm (timeout_interval); gettimeofday (&tv, NULL); @@ -190,6 +191,7 @@ process_arguments (int argc, char **argv) {"warning", required_argument, 0, 'w'}, {"critical", required_argument, 0, 'c'}, {"timeout", required_argument, 0, 't'}, + {"dig-arguments", required_argument, 0, 'A'}, {"verbose", no_argument, 0, 'v'}, {"version", no_argument, 0, 'V'}, {"help", no_argument, 0, 'h'}, @@ -203,7 +205,7 @@ process_arguments (int argc, char **argv) return ERROR; while (1) { - c = getopt_long (argc, argv, "hVvt:l:H:w:c:T:p:a:", longopts, &option); + c = getopt_long (argc, argv, "hVvt:l:H:w:c:T:p:a:A:", longopts, &option); if (c == -1 || c == EOF) break; @@ -254,6 +256,9 @@ process_arguments (int argc, char **argv) usage_va(_("Timeout interval must be a positive integer - %s"), optarg); } break; + case 'A': /* dig arguments */ + dig_args = strdup(optarg); + break; case 'v': /* verbose */ verbose = TRUE; break; @@ -320,9 +325,14 @@ print_help (void) printf (" %s\n",_("record type to lookup (default: A)")); printf (" %s\n","-a, --expected_address=STRING"); printf (" %s\n",_("an address expected to be in the answer section.if not set, uses whatever was in -l")); + printf (" %s\n","-A, --dig-arguments=STRING"); + printf (" %s\n",_("pass STRING as argument(s) to dig")); printf (_(UT_WARN_CRIT)); printf (_(UT_TIMEOUT), DEFAULT_SOCKET_TIMEOUT); printf (_(UT_VERBOSE)); + printf ("%s\n", _("Examples:")); + printf (" %s\n", "check_dig -H DNSSERVER -l www.example.com -A \"+tcp\""); + printf (" %s\n", "This will send a tcp query to DNSSERVER for www.example.com"); printf (_(UT_SUPPORT)); } -- cgit v0.10-9-g596f