aboutsummaryrefslogtreecommitdiff
path: root/plugins/check_dns.c
diff options
context:
space:
mode:
authorGravatar Matthew Kent <mattkent@users.sourceforge.net> 2004-12-10 05:57:33 +0000
committerGravatar Matthew Kent <mattkent@users.sourceforge.net> 2004-12-10 05:57:33 +0000
commitb5868eb17a6cb8700e27065fad9f6977632cfc99 (patch)
treefeb14cf29c917478f8537881142c6777f4bf315c /plugins/check_dns.c
parente446a43f10518e8f6ce9c3c350a91fac0ba95f81 (diff)
downloadmonitoring-plugins-b5868eb17a6cb8700e27065fad9f6977632cfc99.tar.gz
Error catching improvements from Ollie Cook
git-svn-id: https://nagiosplug.svn.sourceforge.net/svnroot/nagiosplug/nagiosplug/trunk@1022 f882894a-f735-0410-b71e-b25c423dba1c
Diffstat (limited to 'plugins/check_dns.c')
-rw-r--r--plugins/check_dns.c14
1 files changed, 13 insertions, 1 deletions
diff --git a/plugins/check_dns.c b/plugins/check_dns.c
index c30adac7..b0ab23ca 100644
--- a/plugins/check_dns.c
+++ b/plugins/check_dns.c
@@ -150,6 +150,10 @@ main (int argc, char **argv)
/* scan stderr */
while (fgets (input_buffer, MAX_INPUT_BUFFER - 1, child_stderr)) {
+
+ if (verbose)
+ printf ("%s", input_buffer);
+
if (error_scan (input_buffer) != STATE_OK) {
result = max_state (result, error_scan (input_buffer));
output = strdup (1 + index (input_buffer, ':'));
@@ -163,7 +167,7 @@ main (int argc, char **argv)
/* close stdout */
if (spclose (child_process)) {
result = max_state (result, STATE_WARNING);
- if (!strcmp (output, ""))
+ if (output == NULL || !strcmp (output, ""))
output = strdup (_("nslookup returned error status"));
}
@@ -240,6 +244,14 @@ error_scan (char *input_buffer)
strstr (input_buffer, ": REFUSED")))
die (STATE_CRITICAL, _("Connection to DNS %s was refused\n"), dns_server);
+ /* Query refused (usually by an ACL in the namserver) */
+ else if (strstr (input_buffer, "Query refused"))
+ die (STATE_CRITICAL, _("Query was refused by DNS server at %s\n"), dns_server);
+
+ /* No information (e.g. nameserver IP has two PTR records) */
+ else if (strstr (input_buffer, "No information"))
+ die (STATE_CRITICAL, _("No information returned by DNS server at %s\n"), dns_server);
+
/* Host or domain name does not exist */
else if (strstr (input_buffer, "Non-existent") ||
strstr (input_buffer, "** server can't find") ||