summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKarl DeBisschop <kdebisschop@users.sourceforge.net>2003-08-02 05:30:21 +0000
committerKarl DeBisschop <kdebisschop@users.sourceforge.net>2003-08-02 05:30:21 +0000
commita8d8b101cfe6889cb19723f7f0053f4568546a5a (patch)
treeb51895471c96c50884610b2fcdb981cf4c7a7794
parentb90682968140e77e7df009fbc43d562c274e8ce9 (diff)
downloadmonitoring-plugins-a8d8b101cfe6889cb19723f7f0053f4568546a5a.tar.gz
restore informative output that was lost in previous bug fix
git-svn-id: https://nagiosplug.svn.sourceforge.net/svnroot/nagiosplug/nagiosplug/branches/release-1.3.0@629 f882894a-f735-0410-b71e-b25c423dba1c
-rw-r--r--plugins/check_dns.c50
1 files changed, 22 insertions, 28 deletions
diff --git a/plugins/check_dns.c b/plugins/check_dns.c
index 88ef7d7e..4e808bb2 100644
--- a/plugins/check_dns.c
+++ b/plugins/check_dns.c
@@ -209,61 +209,55 @@ main (int argc, char **argv)
209 return result; 209 return result;
210} 210}
211 211
212
212int 213int
213error_scan (char *input_buffer) 214error_scan (char *input_buffer)
214{ 215{
215 216
216 /* the DNS lookup timed out */ 217 /* the DNS lookup timed out */
217 if (strstr (input_buffer, 218 if (strstr (input_buffer, "Note: nslookup is deprecated and may be removed from future releases.") ||
218 "Note: nslookup is deprecated and may be removed from future releases.") 219 strstr (input_buffer, "Consider using the `dig' or `host' programs instead. Run nslookup with") ||
219 || strstr (input_buffer, 220 strstr (input_buffer, "the `-sil[ent]' option to prevent this message from appearing."))
220 "Consider using the `dig' or `host' programs instead. Run nslookup with")
221 || strstr (input_buffer,
222 "the `-sil[ent]' option to prevent this message from appearing."))
223 return STATE_OK; 221 return STATE_OK;
224 222
225 /* the DNS lookup timed out */ 223 /* the DNS lookup timed out */
226 else if (strstr (input_buffer, "Timed out")) 224 else if (strstr (input_buffer, "Timed out"))
227 return STATE_WARNING; 225 terminate (STATE_WARNING, "Request timed out at server\n");
228 226
229 /* DNS server is not running... */ 227 /* DNS server is not running... */
230 else if (strstr (input_buffer, "No response from server")) 228 else if (strstr (input_buffer, "No response from server"))
231 return STATE_CRITICAL; 229 terminate (STATE_CRITICAL, "No response from name server %s\n", dns_server);
232 230
233 /* Host name is valid, but server doesn't have records... */ 231 /* Host name is valid, but server doesn't have records... */
234 else if (strstr (input_buffer, "No records")) 232 else if (strstr (input_buffer, "No records"))
235 return STATE_WARNING; 233 terminate (STATE_CRITICAL, "Name server %s has no records\n", dns_server);
236
237 /* Host or domain name does not exist */
238 else if (strstr (input_buffer, "Non-existent"))
239 return STATE_CRITICAL;
240 else if (strstr (input_buffer, "** server can't find"))
241 return STATE_CRITICAL;
242 else if(strstr(input_buffer,"NXDOMAIN")) /* 9.x */
243 return STATE_CRITICAL;
244 234
245 /* Connection was refused */ 235 /* Connection was refused */
246 else if (strstr (input_buffer, "Connection refused")) 236 else if (strstr (input_buffer, "Connection refused") ||
247 return STATE_CRITICAL; 237 (strstr (input_buffer, "** server can't find") &&
238 strstr (input_buffer, ": REFUSED")) ||
239 (strstr (input_buffer, "Refused")))
240 terminate (STATE_CRITICAL, "Connection to name server %s was refused\n", dns_server);
241
242 /* Host or domain name does not exist */
243 else if (strstr (input_buffer, "Non-existent") ||
244 strstr (input_buffer, "** server can't find") ||
245 strstr (input_buffer,": NXDOMAIN"))
246 terminate (STATE_CRITICAL, "Domain %s was not found by the server\n", query_address);
248 247
249 /* Network is unreachable */ 248 /* Network is unreachable */
250 else if (strstr (input_buffer, "Network is unreachable")) 249 else if (strstr (input_buffer, "Network is unreachable"))
251 return STATE_CRITICAL; 250 terminate (STATE_CRITICAL, "Network is unreachable\n");
252 251
253 /* Internal server failure */ 252 /* Internal server failure */
254 else if (strstr (input_buffer, "Server failure")) 253 else if (strstr (input_buffer, "Server failure"))
255 return STATE_CRITICAL; 254 terminate (STATE_CRITICAL, "Server failure for %s\n", dns_server);
256
257 /* DNS server refused to service request */
258 else if (strstr (input_buffer, "Refused"))
259 return STATE_CRITICAL;
260 255
261 /* Request error */ 256 /* Request error */
262 else if (strstr (input_buffer, "Format error")) 257 else if (strstr (input_buffer, "Format error"))
263 return STATE_WARNING; 258 terminate (STATE_WARNING, "Format error\n");
264 259
265 else 260 return STATE_OK;
266 return STATE_OK;
267 261
268} 262}
269 263