summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKarl DeBisschop <kdebisschop@users.sourceforge.net>2003-08-01 23:56:03 (GMT)
committerKarl DeBisschop <kdebisschop@users.sourceforge.net>2003-08-01 23:56:03 (GMT)
commitef749a4de1e2e37cc869477dd35f1dbdda4b6036 (patch)
tree8d1381bc7dc5a9763557a8462529067a22e454b3
parent71fcc19db98094c13b5217a32e390d3336560ace (diff)
downloadmonitoring-plugins-ef749a4de1e2e37cc869477dd35f1dbdda4b6036.tar.gz
terminate in error_scan() so meaningfull errors can be sent
git-svn-id: https://nagiosplug.svn.sourceforge.net/svnroot/nagiosplug/nagiosplug/trunk@628 f882894a-f735-0410-b71e-b25c423dba1c
-rw-r--r--plugins/check_dns.c40
1 files changed, 18 insertions, 22 deletions
diff --git a/plugins/check_dns.c b/plugins/check_dns.c
index 6121af0..d96e9bb 100644
--- a/plugins/check_dns.c
+++ b/plugins/check_dns.c
@@ -270,46 +270,42 @@ error_scan (char *input_buffer)
270 270
271 /* the DNS lookup timed out */ 271 /* the DNS lookup timed out */
272 else if (strstr (input_buffer, "Timed out")) 272 else if (strstr (input_buffer, "Timed out"))
273 return STATE_WARNING; 273 terminate (STATE_WARNING, "Request timed out at server\n");
274 274
275 /* DNS server is not running... */ 275 /* DNS server is not running... */
276 else if (strstr (input_buffer, "No response from server")) 276 else if (strstr (input_buffer, "No response from server"))
277 return STATE_CRITICAL; 277 terminate (STATE_CRITICAL, "No response from name server %s\n", dns_server);
278 278
279 /* Host name is valid, but server doesn't have records... */ 279 /* Host name is valid, but server doesn't have records... */
280 else if (strstr (input_buffer, "No records")) 280 else if (strstr (input_buffer, "No records"))
281 return STATE_WARNING; 281 terminate (STATE_CRITICAL, "Name server %s has no records\n", dns_server);
282
283 /* Host or domain name does not exist */
284 else if (strstr (input_buffer, "Non-existent"))
285 return STATE_CRITICAL;
286 else if (strstr (input_buffer, "** server can't find"))
287 return STATE_CRITICAL;
288 else if(strstr(input_buffer,"NXDOMAIN")) /* 9.x */
289 return STATE_CRITICAL;
290 282
291 /* Connection was refused */ 283 /* Connection was refused */
292 else if (strstr (input_buffer, "Connection refused")) 284 else if (strstr (input_buffer, "Connection refused") ||
293 return STATE_CRITICAL; 285 (strstr (input_buffer, "** server can't find") &&
286 strstr (input_buffer, ": REFUSED")) ||
287 (strstr (input_buffer, "Refused")))
288 terminate (STATE_CRITICAL, "Connection to name server %s was refused\n", dns_server);
289
290 /* Host or domain name does not exist */
291 else if (strstr (input_buffer, "Non-existent") ||
292 strstr (input_buffer, "** server can't find") ||
293 strstr (input_buffer,"NXDOMAIN"))
294 terminate (STATE_CRITICAL, "Domain %s was not found by the server\n", query_address);
294 295
295 /* Network is unreachable */ 296 /* Network is unreachable */
296 else if (strstr (input_buffer, "Network is unreachable")) 297 else if (strstr (input_buffer, "Network is unreachable"))
297 return STATE_CRITICAL; 298 terminate (STATE_CRITICAL, "Network is unreachable\n");
298 299
299 /* Internal server failure */ 300 /* Internal server failure */
300 else if (strstr (input_buffer, "Server failure")) 301 else if (strstr (input_buffer, "Server failure"))
301 return STATE_CRITICAL; 302 terminate (STATE_CRITICAL, "Server failure for %s\n", dns_server);
302
303 /* DNS server refused to service request */
304 else if (strstr (input_buffer, "Refused"))
305 return STATE_CRITICAL;
306 303
307 /* Request error */ 304 /* Request error */
308 else if (strstr (input_buffer, "Format error")) 305 else if (strstr (input_buffer, "Format error"))
309 return STATE_WARNING; 306 terminate (STATE_WARNING, "Format error\n");
310 307
311 else 308 return STATE_OK;
312 return STATE_OK;
313 309
314} 310}
315 311