diff options
Diffstat (limited to 'plugins/check_dig.c')
| -rw-r--r-- | plugins/check_dig.c | 97 |
1 files changed, 48 insertions, 49 deletions
diff --git a/plugins/check_dig.c b/plugins/check_dig.c index 8eb2b9b3..f80a9dc2 100644 --- a/plugins/check_dig.c +++ b/plugins/check_dig.c | |||
| @@ -1,37 +1,49 @@ | |||
| 1 | /****************************************************************************** | 1 | /***************************************************************************** |
| 2 | * | 2 | * |
| 3 | * Program: SNMP plugin for Nagios | 3 | * This program is free software; you can redistribute it and/or modify |
| 4 | * License: GPL | 4 | * it under the terms of the GNU General Public License as published by |
| 5 | * | 5 | * the Free Software Foundation; either version 2 of the License, or |
| 6 | * License Information: | 6 | * (at your option) any later version. |
| 7 | * | 7 | * |
| 8 | * This program is free software; you can redistribute it and/or modify | 8 | * This program is distributed in the hope that it will be useful, |
| 9 | * it under the terms of the GNU General Public License as published by | 9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 10 | * the Free Software Foundation; either version 2 of the License, or | 10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 11 | * (at your option) any later version. | 11 | * GNU General Public License for more details. |
| 12 | * | 12 | * |
| 13 | * This program is distributed in the hope that it will be useful, | 13 | * You should have received a copy of the GNU General Public License |
| 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | 14 | * along with this program; if not, write to the Free Software |
| 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 15 | * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. |
| 16 | * GNU General Public License for more details. | 16 | * |
| 17 | * | 17 | *****************************************************************************/ |
| 18 | * You should have received a copy of the GNU General Public License | 18 | |
| 19 | * along with this program; if not, write to the Free Software | 19 | const char *progname = "check_dig"; |
| 20 | * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. | 20 | const char *revision = "$Revision$"; |
| 21 | *****************************************************************************/ | 21 | const char *copyright = "2002-2003"; |
| 22 | const char *authors = "Nagios Plugin Development Team"; | ||
| 23 | const char *email = "nagiosplug-devel@lists.sourceforge.net"; | ||
| 24 | const char *summary = "Test the DNS service on the specified host using dig\n"; | ||
| 25 | |||
| 26 | const char *option_summary = "-H host -l lookup [-t timeout] [-v]"; | ||
| 27 | |||
| 28 | const char *options = "\ | ||
| 29 | -H, --hostname=STRING or IPADDRESS\n\ | ||
| 30 | Check server on the indicated host\n\ | ||
| 31 | -l, --lookup=STRING\n\ | ||
| 32 | machine name to lookup\n\ | ||
| 33 | -t, --timeout=INTEGER\n\ | ||
| 34 | Seconds before connection attempt times out (default: %d)\n\ | ||
| 35 | -v, --verbose\n\ | ||
| 36 | Print extra information (command-line use only)\n\ | ||
| 37 | -h, --help\n\ | ||
| 38 | Print detailed help screen\n\ | ||
| 39 | -V, --version\n\ | ||
| 40 | Print version information\n\n"; | ||
| 22 | 41 | ||
| 23 | #include "config.h" | 42 | #include "config.h" |
| 24 | #include "common.h" | 43 | #include "common.h" |
| 25 | #include "utils.h" | 44 | #include "utils.h" |
| 26 | #include "popen.h" | 45 | #include "popen.h" |
| 27 | 46 | ||
| 28 | const char *progname = "check_dig"; | ||
| 29 | #define REVISION "$Revision$" | ||
| 30 | #define COPYRIGHT "2000-2002" | ||
| 31 | #define AUTHOR "Karl DeBisschop" | ||
| 32 | #define EMAIL "karl@debisschop.net" | ||
| 33 | #define SUMMARY "Test the DNS service on the specified host using dig\n" | ||
| 34 | |||
| 35 | int process_arguments (int, char **); | 47 | int process_arguments (int, char **); |
| 36 | int validate_arguments (void); | 48 | int validate_arguments (void); |
| 37 | void print_help (void); | 49 | void print_help (void); |
| @@ -210,7 +222,7 @@ process_arguments (int argc, char **argv) | |||
| 210 | } | 222 | } |
| 211 | } | 223 | } |
| 212 | else { | 224 | else { |
| 213 | asprintf (&dns_server, "127.0.0.1"); | 225 | dns_server = strdup ("127.0.0.1"); |
| 214 | } | 226 | } |
| 215 | } | 227 | } |
| 216 | 228 | ||
| @@ -234,25 +246,13 @@ validate_arguments (void) | |||
| 234 | void | 246 | void |
| 235 | print_help (void) | 247 | print_help (void) |
| 236 | { | 248 | { |
| 237 | print_revision (progname, "$Revision$"); | 249 | print_revision (progname, revision); |
| 238 | printf | 250 | printf |
| 239 | ("Copyright (c) %s %s <%s>\n\n%s\n", | 251 | ("Copyright (c) %s %s <%s>\n\n%s\n", |
| 240 | COPYRIGHT, AUTHOR, EMAIL, SUMMARY); | 252 | copyright, authors, email, summary); |
| 241 | print_usage (); | 253 | print_usage (); |
| 242 | printf | 254 | printf ("\nOptions:\n"); |
| 243 | ("\nOptions:\n" | 255 | printf (options, DEFAULT_SOCKET_TIMEOUT); |
| 244 | " -H, --hostname=STRING or IPADDRESS\n" | ||
| 245 | " Check server on the indicated host\n" | ||
| 246 | " -l, --lookup=STRING\n" | ||
| 247 | " machine name to lookup\n" | ||
| 248 | " -t, --timeout=INTEGER\n" | ||
| 249 | " Seconds before connection attempt times out (default: %d)\n" | ||
| 250 | " -v, --verbose\n" | ||
| 251 | " Print extra information (command-line use only)\n" | ||
| 252 | " -h, --help\n" | ||
| 253 | " Print detailed help screen\n" | ||
| 254 | " -V, --version\n" | ||
| 255 | " Print version information\n\n", DEFAULT_SOCKET_TIMEOUT); | ||
| 256 | support (); | 256 | support (); |
| 257 | } | 257 | } |
| 258 | 258 | ||
| @@ -263,8 +263,7 @@ print_help (void) | |||
| 263 | void | 263 | void |
| 264 | print_usage (void) | 264 | print_usage (void) |
| 265 | { | 265 | { |
| 266 | printf | 266 | printf ("Usage: %s %s\n", progname, option_summary); |
| 267 | ("Usage: %s -H host -l lookup [-t timeout] [-v]\n" | 267 | printf (" %s (-h|--help)\n", progname); |
| 268 | " %s --help\n" | 268 | printf (" %s (-V|--version)\n", progname); |
| 269 | " %s --version\n", progname, progname, progname); | ||
| 270 | } | 269 | } |
