diff options
author | Karl DeBisschop <kdebisschop@users.sourceforge.net> | 2003-08-02 16:42:57 (GMT) |
---|---|---|
committer | Karl DeBisschop <kdebisschop@users.sourceforge.net> | 2003-08-02 16:42:57 (GMT) |
commit | b07cec408f61acd3c34ad1c03b212bba9b66c454 (patch) | |
tree | 4a906eebd467e2d71687e57205d07368f2adcc1b /plugins/check_dns.c | |
parent | f4e6b2a946c087c096e38415210219fe1c870822 (diff) | |
download | monitoring-plugins-b07cec408f61acd3c34ad1c03b212bba9b66c454.tar.gz |
establish "UT_" namespace for usage text in #defines
git-svn-id: https://nagiosplug.svn.sourceforge.net/svnroot/nagiosplug/nagiosplug/trunk@631 f882894a-f735-0410-b71e-b25c423dba1c
Diffstat (limited to 'plugins/check_dns.c')
-rw-r--r-- | plugins/check_dns.c | 37 |
1 files changed, 17 insertions, 20 deletions
diff --git a/plugins/check_dns.c b/plugins/check_dns.c index d96e9bb..eae5880 100644 --- a/plugins/check_dns.c +++ b/plugins/check_dns.c | |||
@@ -73,7 +73,7 @@ print_help (void) | |||
73 | 73 | ||
74 | print_usage (); | 74 | print_usage (); |
75 | 75 | ||
76 | printf (_(HELP_VRSN)); | 76 | printf (_(UT_HELP_VRSN)); |
77 | 77 | ||
78 | printf (_("\ | 78 | printf (_("\ |
79 | -H, --hostname=HOST\n\ | 79 | -H, --hostname=HOST\n\ |
@@ -83,7 +83,7 @@ print_help (void) | |||
83 | -a, --expected-address=IP-ADDRESS\n\ | 83 | -a, --expected-address=IP-ADDRESS\n\ |
84 | Optional IP address you expect the DNS server to return\n")); | 84 | Optional IP address you expect the DNS server to return\n")); |
85 | 85 | ||
86 | printf (_(TIMEOUT), DEFAULT_SOCKET_TIMEOUT); | 86 | printf (_(UT_TIMEOUT), DEFAULT_SOCKET_TIMEOUT); |
87 | 87 | ||
88 | printf (_("\n\ | 88 | printf (_("\n\ |
89 | This plugin uses the nslookup program to obtain the IP address\n\ | 89 | This plugin uses the nslookup program to obtain the IP address\n\ |
@@ -155,9 +155,9 @@ main (int argc, char **argv) | |||
155 | 155 | ||
156 | if (strstr (input_buffer, ".in-addr.arpa")) { | 156 | if (strstr (input_buffer, ".in-addr.arpa")) { |
157 | if ((temp_buffer = strstr (input_buffer, "name = "))) | 157 | if ((temp_buffer = strstr (input_buffer, "name = "))) |
158 | address = strscpy (address, temp_buffer + 7); | 158 | address = strdup (temp_buffer + 7); |
159 | else { | 159 | else { |
160 | output = strscpy (output, _("Unknown error (plugin)")); | 160 | output = strdup (_("Unknown error (plugin)")); |
161 | result = STATE_WARNING; | 161 | result = STATE_WARNING; |
162 | } | 162 | } |
163 | } | 163 | } |
@@ -195,7 +195,7 @@ main (int argc, char **argv) | |||
195 | 195 | ||
196 | result = error_scan (input_buffer); | 196 | result = error_scan (input_buffer); |
197 | if (result != STATE_OK) { | 197 | if (result != STATE_OK) { |
198 | output = strscpy (output, 1 + index (input_buffer, ':')); | 198 | output = strdup (1 + index (input_buffer, ':')); |
199 | strip (output); | 199 | strip (output); |
200 | break; | 200 | break; |
201 | } | 201 | } |
@@ -206,7 +206,7 @@ main (int argc, char **argv) | |||
206 | while (fgets (input_buffer, MAX_INPUT_BUFFER - 1, child_stderr)) { | 206 | while (fgets (input_buffer, MAX_INPUT_BUFFER - 1, child_stderr)) { |
207 | if (error_scan (input_buffer) != STATE_OK) { | 207 | if (error_scan (input_buffer) != STATE_OK) { |
208 | result = max_state (result, error_scan (input_buffer)); | 208 | result = max_state (result, error_scan (input_buffer)); |
209 | output = strscpy (output, 1 + index (input_buffer, ':')); | 209 | output = strdup (1 + index (input_buffer, ':')); |
210 | strip (output); | 210 | strip (output); |
211 | } | 211 | } |
212 | } | 212 | } |
@@ -218,7 +218,7 @@ main (int argc, char **argv) | |||
218 | if (spclose (child_process)) { | 218 | if (spclose (child_process)) { |
219 | result = max_state (result, STATE_WARNING); | 219 | result = max_state (result, STATE_WARNING); |
220 | if (!strcmp (output, "")) | 220 | if (!strcmp (output, "")) |
221 | output = strscpy (output, _("nslookup returned error status")); | 221 | output = strdup (_("nslookup returned error status")); |
222 | } | 222 | } |
223 | 223 | ||
224 | /* If we got here, we should have an address string, | 224 | /* If we got here, we should have an address string, |
@@ -268,42 +268,39 @@ error_scan (char *input_buffer) | |||
268 | strstr (input_buffer, "the `-sil[ent]' option to prevent this message from appearing.")) | 268 | strstr (input_buffer, "the `-sil[ent]' option to prevent this message from appearing.")) |
269 | return STATE_OK; | 269 | return STATE_OK; |
270 | 270 | ||
271 | /* the DNS lookup timed out */ | ||
272 | else if (strstr (input_buffer, "Timed out")) | ||
273 | terminate (STATE_WARNING, "Request timed out at server\n"); | ||
274 | |||
275 | /* DNS server is not running... */ | 271 | /* DNS server is not running... */ |
276 | else if (strstr (input_buffer, "No response from server")) | 272 | else if (strstr (input_buffer, "No response from server")) |
277 | terminate (STATE_CRITICAL, "No response from name server %s\n", dns_server); | 273 | terminate (STATE_CRITICAL, _("No response from name server %s\n"), dns_server); |
278 | 274 | ||
279 | /* Host name is valid, but server doesn't have records... */ | 275 | /* Host name is valid, but server doesn't have records... */ |
280 | else if (strstr (input_buffer, "No records")) | 276 | else if (strstr (input_buffer, "No records")) |
281 | terminate (STATE_CRITICAL, "Name server %s has no records\n", dns_server); | 277 | terminate (STATE_CRITICAL, _("Name server %s has no records\n"), dns_server); |
282 | 278 | ||
283 | /* Connection was refused */ | 279 | /* Connection was refused */ |
284 | else if (strstr (input_buffer, "Connection refused") || | 280 | else if (strstr (input_buffer, "Connection refused") || |
285 | (strstr (input_buffer, "** server can't find") && | 281 | (strstr (input_buffer, "** server can't find") && |
286 | strstr (input_buffer, ": REFUSED")) || | 282 | strstr (input_buffer, ": REFUSED")) || |
287 | (strstr (input_buffer, "Refused"))) | 283 | (strstr (input_buffer, "Refused"))) |
288 | terminate (STATE_CRITICAL, "Connection to name server %s was refused\n", dns_server); | 284 | terminate (STATE_CRITICAL, _("Connection to name server %s was refused\n"), dns_server); |
289 | 285 | ||
290 | /* Host or domain name does not exist */ | 286 | /* Host or domain name does not exist */ |
291 | else if (strstr (input_buffer, "Non-existent") || | 287 | else if (strstr (input_buffer, "Non-existent") || |
292 | strstr (input_buffer, "** server can't find") || | 288 | strstr (input_buffer, "** server can't find") || |
293 | strstr (input_buffer,"NXDOMAIN")) | 289 | strstr (input_buffer,"NXDOMAIN")) |
294 | terminate (STATE_CRITICAL, "Domain %s was not found by the server\n", query_address); | 290 | terminate (STATE_CRITICAL, _("Domain %s was not found by the server\n"), query_address); |
295 | 291 | ||
296 | /* Network is unreachable */ | 292 | /* Network is unreachable */ |
297 | else if (strstr (input_buffer, "Network is unreachable")) | 293 | else if (strstr (input_buffer, "Network is unreachable")) |
298 | terminate (STATE_CRITICAL, "Network is unreachable\n"); | 294 | terminate (STATE_CRITICAL, _("Network is unreachable\n")); |
299 | 295 | ||
300 | /* Internal server failure */ | 296 | /* Internal server failure */ |
301 | else if (strstr (input_buffer, "Server failure")) | 297 | else if (strstr (input_buffer, "Server failure")) |
302 | terminate (STATE_CRITICAL, "Server failure for %s\n", dns_server); | 298 | terminate (STATE_CRITICAL, _("Server failure for %s\n"), dns_server); |
303 | 299 | ||
304 | /* Request error */ | 300 | /* Request error or the DNS lookup timed out */ |
305 | else if (strstr (input_buffer, "Format error")) | 301 | else if (strstr (input_buffer, "Format error") || |
306 | terminate (STATE_WARNING, "Format error\n"); | 302 | strstr (input_buffer, "Timed out")) |
303 | return STATE_WARNING; | ||
307 | 304 | ||
308 | return STATE_OK; | 305 | return STATE_OK; |
309 | 306 | ||