diff options
Diffstat (limited to 'plugins')
-rw-r--r-- | plugins/check_dig.c | 622 |
1 files changed, 297 insertions, 325 deletions
diff --git a/plugins/check_dig.c b/plugins/check_dig.c index be7a610..37e0e24 100644 --- a/plugins/check_dig.c +++ b/plugins/check_dig.c | |||
@@ -1,30 +1,30 @@ | |||
1 | /***************************************************************************** | 1 | /***************************************************************************** |
2 | * | 2 | * |
3 | * Monitoring check_dig plugin | 3 | * Monitoring check_dig plugin |
4 | * | 4 | * |
5 | * License: GPL | 5 | * License: GPL |
6 | * Copyright (c) 2002-2008 Monitoring Plugins Development Team | 6 | * Copyright (c) 2002-2008 Monitoring Plugins Development Team |
7 | * | 7 | * |
8 | * Description: | 8 | * Description: |
9 | * | 9 | * |
10 | * This file contains the check_dig plugin | 10 | * This file contains the check_dig plugin |
11 | * | 11 | * |
12 | * | 12 | * |
13 | * This program is free software: you can redistribute it and/or modify | 13 | * This program is free software: you can redistribute it and/or modify |
14 | * it under the terms of the GNU General Public License as published by | 14 | * it under the terms of the GNU General Public License as published by |
15 | * the Free Software Foundation, either version 3 of the License, or | 15 | * the Free Software Foundation, either version 3 of the License, or |
16 | * (at your option) any later version. | 16 | * (at your option) any later version. |
17 | * | 17 | * |
18 | * This program is distributed in the hope that it will be useful, | 18 | * This program is distributed in the hope that it will be useful, |
19 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | 19 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
20 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 20 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
21 | * GNU General Public License for more details. | 21 | * GNU General Public License for more details. |
22 | * | 22 | * |
23 | * You should have received a copy of the GNU General Public License | 23 | * You should have received a copy of the GNU General Public License |
24 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | 24 | * along with this program. If not, see <http://www.gnu.org/licenses/>. |
25 | * | 25 | * |
26 | * | 26 | * |
27 | *****************************************************************************/ | 27 | *****************************************************************************/ |
28 | 28 | ||
29 | /* Hackers note: | 29 | /* Hackers note: |
30 | * There are typecasts to (char *) from _("foo bar") in this file. | 30 | * There are typecasts to (char *) from _("foo bar") in this file. |
@@ -41,13 +41,13 @@ const char *email = "devel@monitoring-plugins.org"; | |||
41 | #include "utils.h" | 41 | #include "utils.h" |
42 | #include "runcmd.h" | 42 | #include "runcmd.h" |
43 | 43 | ||
44 | int process_arguments (int, char **); | 44 | int process_arguments(int, char **); |
45 | int validate_arguments (void); | 45 | int validate_arguments(void); |
46 | void print_help (void); | 46 | void print_help(void); |
47 | void print_usage (void); | 47 | void print_usage(void); |
48 | 48 | ||
49 | #define UNDEFINED 0 | 49 | #define UNDEFINED 0 |
50 | #define DEFAULT_PORT 53 | 50 | #define DEFAULT_PORT 53 |
51 | #define DEFAULT_TRIES 2 | 51 | #define DEFAULT_TRIES 2 |
52 | 52 | ||
53 | char *query_address = NULL; | 53 | char *query_address = NULL; |
@@ -63,318 +63,290 @@ double warning_interval = UNDEFINED; | |||
63 | double critical_interval = UNDEFINED; | 63 | double critical_interval = UNDEFINED; |
64 | struct timeval tv; | 64 | struct timeval tv; |
65 | 65 | ||
66 | int | 66 | int main(int argc, char **argv) { |
67 | main (int argc, char **argv) | 67 | char *command_line; |
68 | { | 68 | output chld_out, chld_err; |
69 | char *command_line; | 69 | char *msg = NULL; |
70 | output chld_out, chld_err; | 70 | size_t i; |
71 | char *msg = NULL; | 71 | char *t; |
72 | size_t i; | 72 | long microsec; |
73 | char *t; | 73 | double elapsed_time; |
74 | long microsec; | 74 | int result = STATE_UNKNOWN; |
75 | double elapsed_time; | 75 | int timeout_interval_dig; |
76 | int result = STATE_UNKNOWN; | 76 | |
77 | int timeout_interval_dig; | 77 | setlocale(LC_ALL, ""); |
78 | 78 | bindtextdomain(PACKAGE, LOCALEDIR); | |
79 | setlocale (LC_ALL, ""); | 79 | textdomain(PACKAGE); |
80 | bindtextdomain (PACKAGE, LOCALEDIR); | 80 | |
81 | textdomain (PACKAGE); | 81 | /* Set signal handling and alarm */ |
82 | 82 | if (signal(SIGALRM, runcmd_timeout_alarm_handler) == SIG_ERR) | |
83 | /* Set signal handling and alarm */ | 83 | usage_va(_("Cannot catch SIGALRM")); |
84 | if (signal (SIGALRM, runcmd_timeout_alarm_handler) == SIG_ERR) | 84 | |
85 | usage_va(_("Cannot catch SIGALRM")); | 85 | /* Parse extra opts if any */ |
86 | 86 | argv = np_extra_opts(&argc, argv, progname); | |
87 | /* Parse extra opts if any */ | 87 | |
88 | argv=np_extra_opts (&argc, argv, progname); | 88 | if (process_arguments(argc, argv) == ERROR) |
89 | 89 | usage_va(_("Could not parse arguments")); | |
90 | if (process_arguments (argc, argv) == ERROR) | 90 | |
91 | usage_va(_("Could not parse arguments")); | 91 | /* dig applies the timeout to each try, so we need to work around this */ |
92 | 92 | timeout_interval_dig = timeout_interval / number_tries + number_tries; | |
93 | /* dig applies the timeout to each try, so we need to work around this */ | 93 | |
94 | timeout_interval_dig = timeout_interval / number_tries + number_tries; | 94 | /* get the command to run */ |
95 | 95 | xasprintf(&command_line, "%s %s %s -p %d @%s %s %s +retry=%d +time=%d", PATH_TO_DIG, dig_args, query_transport, server_port, dns_server, | |
96 | /* get the command to run */ | 96 | query_address, record_type, number_tries, timeout_interval_dig); |
97 | xasprintf (&command_line, "%s %s %s -p %d @%s %s %s +retry=%d +time=%d", | 97 | |
98 | PATH_TO_DIG, dig_args, query_transport, server_port, dns_server, query_address, record_type, number_tries, timeout_interval_dig); | 98 | alarm(timeout_interval); |
99 | 99 | gettimeofday(&tv, NULL); | |
100 | alarm (timeout_interval); | 100 | |
101 | gettimeofday (&tv, NULL); | 101 | if (verbose) { |
102 | 102 | printf("%s\n", command_line); | |
103 | if (verbose) { | 103 | if (expected_address != NULL) { |
104 | printf ("%s\n", command_line); | 104 | printf(_("Looking for: '%s'\n"), expected_address); |
105 | if(expected_address != NULL) { | 105 | } else { |
106 | printf (_("Looking for: '%s'\n"), expected_address); | 106 | printf(_("Looking for: '%s'\n"), query_address); |
107 | } else { | 107 | } |
108 | printf (_("Looking for: '%s'\n"), query_address); | 108 | } |
109 | } | 109 | |
110 | } | 110 | /* run the command */ |
111 | 111 | if (np_runcmd(command_line, &chld_out, &chld_err, 0) != 0) { | |
112 | /* run the command */ | 112 | result = STATE_WARNING; |
113 | if(np_runcmd(command_line, &chld_out, &chld_err, 0) != 0) { | 113 | msg = (char *)_("dig returned an error status"); |
114 | result = STATE_WARNING; | 114 | } |
115 | msg = (char *)_("dig returned an error status"); | 115 | |
116 | } | 116 | for (i = 0; i < chld_out.lines; i++) { |
117 | 117 | /* the server is responding, we just got the host name... */ | |
118 | for(i = 0; i < chld_out.lines; i++) { | 118 | if (strstr(chld_out.line[i], ";; ANSWER SECTION:")) { |
119 | /* the server is responding, we just got the host name... */ | 119 | |
120 | if (strstr (chld_out.line[i], ";; ANSWER SECTION:")) { | 120 | /* loop through the whole 'ANSWER SECTION' */ |
121 | 121 | for (; i < chld_out.lines; i++) { | |
122 | /* loop through the whole 'ANSWER SECTION' */ | 122 | /* get the host address */ |
123 | for(; i < chld_out.lines; i++) { | 123 | if (verbose) |
124 | /* get the host address */ | 124 | printf("%s\n", chld_out.line[i]); |
125 | if (verbose) | 125 | |
126 | printf ("%s\n", chld_out.line[i]); | 126 | if (strcasestr(chld_out.line[i], (expected_address == NULL ? query_address : expected_address)) != NULL) { |
127 | 127 | msg = chld_out.line[i]; | |
128 | if (strcasestr (chld_out.line[i], (expected_address == NULL ? query_address : expected_address)) != NULL) { | 128 | result = STATE_OK; |
129 | msg = chld_out.line[i]; | 129 | |
130 | result = STATE_OK; | 130 | /* Translate output TAB -> SPACE */ |
131 | 131 | t = msg; | |
132 | /* Translate output TAB -> SPACE */ | 132 | while ((t = strchr(t, '\t')) != NULL) |
133 | t = msg; | 133 | *t = ' '; |
134 | while ((t = strchr(t, '\t')) != NULL) *t = ' '; | 134 | break; |
135 | break; | 135 | } |
136 | } | 136 | } |
137 | } | 137 | |
138 | 138 | if (result == STATE_UNKNOWN) { | |
139 | if (result == STATE_UNKNOWN) { | 139 | msg = (char *)_("Server not found in ANSWER SECTION"); |
140 | msg = (char *)_("Server not found in ANSWER SECTION"); | 140 | result = STATE_WARNING; |
141 | result = STATE_WARNING; | 141 | } |
142 | } | 142 | |
143 | 143 | /* we found the answer section, so break out of the loop */ | |
144 | /* we found the answer section, so break out of the loop */ | 144 | break; |
145 | break; | 145 | } |
146 | } | 146 | } |
147 | } | 147 | |
148 | 148 | if (result == STATE_UNKNOWN) { | |
149 | if (result == STATE_UNKNOWN) { | 149 | msg = (char *)_("No ANSWER SECTION found"); |
150 | msg = (char *)_("No ANSWER SECTION found"); | 150 | result = STATE_CRITICAL; |
151 | result = STATE_CRITICAL; | 151 | } |
152 | } | 152 | |
153 | 153 | /* If we get anything on STDERR, at least set warning */ | |
154 | /* If we get anything on STDERR, at least set warning */ | 154 | if (chld_err.buflen > 0) { |
155 | if(chld_err.buflen > 0) { | 155 | result = max_state(result, STATE_WARNING); |
156 | result = max_state(result, STATE_WARNING); | 156 | if (!msg) |
157 | if(!msg) for(i = 0; i < chld_err.lines; i++) { | 157 | for (i = 0; i < chld_err.lines; i++) { |
158 | msg = strchr(chld_err.line[0], ':'); | 158 | msg = strchr(chld_err.line[0], ':'); |
159 | if(msg) { | 159 | if (msg) { |
160 | msg++; | 160 | msg++; |
161 | break; | 161 | break; |
162 | } | 162 | } |
163 | } | 163 | } |
164 | } | 164 | } |
165 | 165 | ||
166 | microsec = deltime (tv); | 166 | microsec = deltime(tv); |
167 | elapsed_time = (double)microsec / 1.0e6; | 167 | elapsed_time = (double)microsec / 1.0e6; |
168 | 168 | ||
169 | if (critical_interval > UNDEFINED && elapsed_time > critical_interval) | 169 | if (critical_interval > UNDEFINED && elapsed_time > critical_interval) |
170 | result = STATE_CRITICAL; | 170 | result = STATE_CRITICAL; |
171 | 171 | ||
172 | else if (warning_interval > UNDEFINED && elapsed_time > warning_interval) | 172 | else if (warning_interval > UNDEFINED && elapsed_time > warning_interval) |
173 | result = STATE_WARNING; | 173 | result = STATE_WARNING; |
174 | 174 | ||
175 | printf ("DNS %s - %.3f seconds response time (%s)|%s\n", | 175 | printf("DNS %s - %.3f seconds response time (%s)|%s\n", state_text(result), elapsed_time, |
176 | state_text (result), elapsed_time, | 176 | msg ? msg : _("Probably a non-existent host/domain"), |
177 | msg ? msg : _("Probably a non-existent host/domain"), | 177 | fperfdata("time", elapsed_time, "s", (warning_interval > UNDEFINED ? true : false), warning_interval, |
178 | fperfdata("time", elapsed_time, "s", | 178 | (critical_interval > UNDEFINED ? true : false), critical_interval, true, 0, false, 0)); |
179 | (warning_interval>UNDEFINED ? true:false), | 179 | return result; |
180 | warning_interval, | ||
181 | (critical_interval>UNDEFINED ? true:false), | ||
182 | critical_interval, | ||
183 | true, 0, false, 0)); | ||
184 | return result; | ||
185 | } | 180 | } |
186 | 181 | ||
187 | |||
188 | |||
189 | /* process command-line arguments */ | 182 | /* process command-line arguments */ |
190 | int | 183 | int process_arguments(int argc, char **argv) { |
191 | process_arguments (int argc, char **argv) | 184 | int c; |
192 | { | 185 | |
193 | int c; | 186 | int option = 0; |
194 | 187 | static struct option longopts[] = {{"hostname", required_argument, 0, 'H'}, | |
195 | int option = 0; | 188 | {"query_address", required_argument, 0, 'l'}, |
196 | static struct option longopts[] = { | 189 | {"warning", required_argument, 0, 'w'}, |
197 | {"hostname", required_argument, 0, 'H'}, | 190 | {"critical", required_argument, 0, 'c'}, |
198 | {"query_address", required_argument, 0, 'l'}, | 191 | {"timeout", required_argument, 0, 't'}, |
199 | {"warning", required_argument, 0, 'w'}, | 192 | {"dig-arguments", required_argument, 0, 'A'}, |
200 | {"critical", required_argument, 0, 'c'}, | 193 | {"verbose", no_argument, 0, 'v'}, |
201 | {"timeout", required_argument, 0, 't'}, | 194 | {"version", no_argument, 0, 'V'}, |
202 | {"dig-arguments", required_argument, 0, 'A'}, | 195 | {"help", no_argument, 0, 'h'}, |
203 | {"verbose", no_argument, 0, 'v'}, | 196 | {"record_type", required_argument, 0, 'T'}, |
204 | {"version", no_argument, 0, 'V'}, | 197 | {"expected_address", required_argument, 0, 'a'}, |
205 | {"help", no_argument, 0, 'h'}, | 198 | {"port", required_argument, 0, 'p'}, |
206 | {"record_type", required_argument, 0, 'T'}, | 199 | {"use-ipv4", no_argument, 0, '4'}, |
207 | {"expected_address", required_argument, 0, 'a'}, | 200 | {"use-ipv6", no_argument, 0, '6'}, |
208 | {"port", required_argument, 0, 'p'}, | 201 | {0, 0, 0, 0}}; |
209 | {"use-ipv4", no_argument, 0, '4'}, | 202 | |
210 | {"use-ipv6", no_argument, 0, '6'}, | 203 | if (argc < 2) |
211 | {0, 0, 0, 0} | 204 | return ERROR; |
212 | }; | 205 | |
213 | 206 | while (1) { | |
214 | if (argc < 2) | 207 | c = getopt_long(argc, argv, "hVvt:l:H:w:c:T:p:a:A:46", longopts, &option); |
215 | return ERROR; | 208 | |
216 | 209 | if (c == -1 || c == EOF) | |
217 | while (1) { | 210 | break; |
218 | c = getopt_long (argc, argv, "hVvt:l:H:w:c:T:p:a:A:46", longopts, &option); | 211 | |
219 | 212 | switch (c) { | |
220 | if (c == -1 || c == EOF) | 213 | case 'h': /* help */ |
221 | break; | 214 | print_help(); |
222 | 215 | exit(STATE_UNKNOWN); | |
223 | switch (c) { | 216 | case 'V': /* version */ |
224 | case 'h': /* help */ | 217 | print_revision(progname, NP_VERSION); |
225 | print_help (); | 218 | exit(STATE_UNKNOWN); |
226 | exit (STATE_UNKNOWN); | 219 | case 'H': /* hostname */ |
227 | case 'V': /* version */ | 220 | host_or_die(optarg); |
228 | print_revision (progname, NP_VERSION); | 221 | dns_server = optarg; |
229 | exit (STATE_UNKNOWN); | 222 | break; |
230 | case 'H': /* hostname */ | 223 | case 'p': /* server port */ |
231 | host_or_die(optarg); | 224 | if (is_intpos(optarg)) { |
232 | dns_server = optarg; | 225 | server_port = atoi(optarg); |
233 | break; | 226 | } else { |
234 | case 'p': /* server port */ | 227 | usage_va(_("Port must be a positive integer - %s"), optarg); |
235 | if (is_intpos (optarg)) { | 228 | } |
236 | server_port = atoi (optarg); | 229 | break; |
237 | } | 230 | case 'l': /* address to lookup */ |
238 | else { | 231 | query_address = optarg; |
239 | usage_va(_("Port must be a positive integer - %s"), optarg); | 232 | break; |
240 | } | 233 | case 'w': /* warning */ |
241 | break; | 234 | if (is_nonnegative(optarg)) { |
242 | case 'l': /* address to lookup */ | 235 | warning_interval = strtod(optarg, NULL); |
243 | query_address = optarg; | 236 | } else { |
244 | break; | 237 | usage_va(_("Warning interval must be a positive integer - %s"), optarg); |
245 | case 'w': /* warning */ | 238 | } |
246 | if (is_nonnegative (optarg)) { | 239 | break; |
247 | warning_interval = strtod (optarg, NULL); | 240 | case 'c': /* critical */ |
248 | } | 241 | if (is_nonnegative(optarg)) { |
249 | else { | 242 | critical_interval = strtod(optarg, NULL); |
250 | usage_va(_("Warning interval must be a positive integer - %s"), optarg); | 243 | } else { |
251 | } | 244 | usage_va(_("Critical interval must be a positive integer - %s"), optarg); |
252 | break; | 245 | } |
253 | case 'c': /* critical */ | 246 | break; |
254 | if (is_nonnegative (optarg)) { | 247 | case 't': /* timeout */ |
255 | critical_interval = strtod (optarg, NULL); | 248 | if (is_intnonneg(optarg)) { |
256 | } | 249 | timeout_interval = atoi(optarg); |
257 | else { | 250 | } else { |
258 | usage_va(_("Critical interval must be a positive integer - %s"), optarg); | 251 | usage_va(_("Timeout interval must be a positive integer - %s"), optarg); |
259 | } | 252 | } |
260 | break; | 253 | break; |
261 | case 't': /* timeout */ | 254 | case 'A': /* dig arguments */ |
262 | if (is_intnonneg (optarg)) { | 255 | dig_args = strdup(optarg); |
263 | timeout_interval = atoi (optarg); | 256 | break; |
264 | } | 257 | case 'v': /* verbose */ |
265 | else { | 258 | verbose = true; |
266 | usage_va(_("Timeout interval must be a positive integer - %s"), optarg); | 259 | break; |
267 | } | 260 | case 'T': |
268 | break; | 261 | record_type = optarg; |
269 | case 'A': /* dig arguments */ | 262 | break; |
270 | dig_args = strdup(optarg); | 263 | case 'a': |
271 | break; | 264 | expected_address = optarg; |
272 | case 'v': /* verbose */ | 265 | break; |
273 | verbose = true; | 266 | case '4': |
274 | break; | 267 | query_transport = "-4"; |
275 | case 'T': | 268 | break; |
276 | record_type = optarg; | 269 | case '6': |
277 | break; | 270 | query_transport = "-6"; |
278 | case 'a': | 271 | break; |
279 | expected_address = optarg; | 272 | default: /* usage5 */ |
280 | break; | 273 | usage5(); |
281 | case '4': | 274 | } |
282 | query_transport = "-4"; | 275 | } |
283 | break; | 276 | |
284 | case '6': | 277 | c = optind; |
285 | query_transport = "-6"; | 278 | if (dns_server == NULL) { |
286 | break; | 279 | if (c < argc) { |
287 | default: /* usage5 */ | 280 | host_or_die(argv[c]); |
288 | usage5(); | 281 | dns_server = argv[c]; |
289 | } | 282 | } else { |
290 | } | 283 | if (strcmp(query_transport, "-6") == 0) |
291 | 284 | dns_server = strdup("::1"); | |
292 | c = optind; | 285 | else |
293 | if (dns_server == NULL) { | 286 | dns_server = strdup("127.0.0.1"); |
294 | if (c < argc) { | 287 | } |
295 | host_or_die(argv[c]); | 288 | } |
296 | dns_server = argv[c]; | 289 | |
297 | } | 290 | return validate_arguments(); |
298 | else { | ||
299 | if (strcmp(query_transport,"-6") == 0) | ||
300 | dns_server = strdup("::1"); | ||
301 | else | ||
302 | dns_server = strdup ("127.0.0.1"); | ||
303 | } | ||
304 | } | ||
305 | |||
306 | return validate_arguments (); | ||
307 | } | 291 | } |
308 | 292 | ||
309 | 293 | int validate_arguments(void) { | |
310 | 294 | if (query_address != NULL) | |
311 | int | 295 | return OK; |
312 | validate_arguments (void) | 296 | else |
313 | { | 297 | return ERROR; |
314 | if (query_address != NULL) | ||
315 | return OK; | ||
316 | else | ||
317 | return ERROR; | ||
318 | } | 298 | } |
319 | 299 | ||
300 | void print_help(void) { | ||
301 | char *myport; | ||
320 | 302 | ||
303 | xasprintf(&myport, "%d", DEFAULT_PORT); | ||
321 | 304 | ||
322 | void | 305 | print_revision(progname, NP_VERSION); |
323 | print_help (void) | ||
324 | { | ||
325 | char *myport; | ||
326 | 306 | ||
327 | xasprintf (&myport, "%d", DEFAULT_PORT); | 307 | printf("Copyright (c) 2000 Karl DeBisschop <kdebisschop@users.sourceforge.net>\n"); |
308 | printf(COPYRIGHT, copyright, email); | ||
328 | 309 | ||
329 | print_revision (progname, NP_VERSION); | 310 | printf(_("This plugin tests the DNS service on the specified host using dig")); |
330 | 311 | ||
331 | printf ("Copyright (c) 2000 Karl DeBisschop <kdebisschop@users.sourceforge.net>\n"); | 312 | printf("\n\n"); |
332 | printf (COPYRIGHT, copyright, email); | ||
333 | 313 | ||
334 | printf (_("This plugin tests the DNS service on the specified host using dig")); | 314 | print_usage(); |
335 | 315 | ||
336 | printf ("\n\n"); | 316 | printf(UT_HELP_VRSN); |
337 | 317 | ||
338 | print_usage (); | 318 | printf(UT_EXTRA_OPTS); |
339 | 319 | ||
340 | printf (UT_HELP_VRSN); | 320 | printf(UT_HOST_PORT, 'p', myport); |
341 | 321 | ||
342 | printf (UT_EXTRA_OPTS); | 322 | printf(" %s\n", "-4, --use-ipv4"); |
323 | printf(" %s\n", _("Force dig to only use IPv4 query transport")); | ||
324 | printf(" %s\n", "-6, --use-ipv6"); | ||
325 | printf(" %s\n", _("Force dig to only use IPv6 query transport")); | ||
326 | printf(" %s\n", "-l, --query_address=STRING"); | ||
327 | printf(" %s\n", _("Machine name to lookup")); | ||
328 | printf(" %s\n", "-T, --record_type=STRING"); | ||
329 | printf(" %s\n", _("Record type to lookup (default: A)")); | ||
330 | printf(" %s\n", "-a, --expected_address=STRING"); | ||
331 | printf(" %s\n", _("An address expected to be in the answer section. If not set, uses whatever")); | ||
332 | printf(" %s\n", _("was in -l")); | ||
333 | printf(" %s\n", "-A, --dig-arguments=STRING"); | ||
334 | printf(" %s\n", _("Pass STRING as argument(s) to dig")); | ||
335 | printf(UT_WARN_CRIT); | ||
336 | printf(UT_CONN_TIMEOUT, DEFAULT_SOCKET_TIMEOUT); | ||
337 | printf(UT_VERBOSE); | ||
343 | 338 | ||
344 | printf (UT_HOST_PORT, 'p', myport); | 339 | printf("\n"); |
340 | printf("%s\n", _("Examples:")); | ||
341 | printf(" %s\n", "check_dig -H DNSSERVER -l www.example.com -A \"+tcp\""); | ||
342 | printf(" %s\n", "This will send a tcp query to DNSSERVER for www.example.com"); | ||
345 | 343 | ||
346 | printf (" %s\n","-4, --use-ipv4"); | 344 | printf(UT_SUPPORT); |
347 | printf (" %s\n",_("Force dig to only use IPv4 query transport")); | ||
348 | printf (" %s\n","-6, --use-ipv6"); | ||
349 | printf (" %s\n",_("Force dig to only use IPv6 query transport")); | ||
350 | printf (" %s\n","-l, --query_address=STRING"); | ||
351 | printf (" %s\n",_("Machine name to lookup")); | ||
352 | printf (" %s\n","-T, --record_type=STRING"); | ||
353 | printf (" %s\n",_("Record type to lookup (default: A)")); | ||
354 | printf (" %s\n","-a, --expected_address=STRING"); | ||
355 | printf (" %s\n",_("An address expected to be in the answer section. If not set, uses whatever")); | ||
356 | printf (" %s\n",_("was in -l")); | ||
357 | printf (" %s\n","-A, --dig-arguments=STRING"); | ||
358 | printf (" %s\n",_("Pass STRING as argument(s) to dig")); | ||
359 | printf (UT_WARN_CRIT); | ||
360 | printf (UT_CONN_TIMEOUT, DEFAULT_SOCKET_TIMEOUT); | ||
361 | printf (UT_VERBOSE); | ||
362 | |||
363 | printf ("\n"); | ||
364 | printf ("%s\n", _("Examples:")); | ||
365 | printf (" %s\n", "check_dig -H DNSSERVER -l www.example.com -A \"+tcp\""); | ||
366 | printf (" %s\n", "This will send a tcp query to DNSSERVER for www.example.com"); | ||
367 | |||
368 | printf (UT_SUPPORT); | ||
369 | } | 345 | } |
370 | 346 | ||
371 | 347 | void print_usage(void) { | |
372 | 348 | printf("%s\n", _("Usage:")); | |
373 | void | 349 | printf("%s -l <query_address> [-H <host>] [-p <server port>]\n", progname); |
374 | print_usage (void) | 350 | printf(" [-T <query type>] [-w <warning interval>] [-c <critical interval>]\n"); |
375 | { | 351 | printf(" [-t <timeout>] [-a <expected answer address>] [-v]\n"); |
376 | printf ("%s\n", _("Usage:")); | ||
377 | printf ("%s -l <query_address> [-H <host>] [-p <server port>]\n", progname); | ||
378 | printf (" [-T <query type>] [-w <warning interval>] [-c <critical interval>]\n"); | ||
379 | printf (" [-t <timeout>] [-a <expected answer address>] [-v]\n"); | ||
380 | } | 352 | } |