summaryrefslogtreecommitdiffstats
path: root/plugins/check_dns.c
diff options
context:
space:
mode:
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 c30adac..b0ab23c 100644
--- a/plugins/check_dns.c
+++ b/plugins/check_dns.c
@@ -150,6 +150,10 @@ main (int argc, char **argv)
150 150
151 /* scan stderr */ 151 /* scan stderr */
152 while (fgets (input_buffer, MAX_INPUT_BUFFER - 1, child_stderr)) { 152 while (fgets (input_buffer, MAX_INPUT_BUFFER - 1, child_stderr)) {
153
154 if (verbose)
155 printf ("%s", input_buffer);
156
153 if (error_scan (input_buffer) != STATE_OK) { 157 if (error_scan (input_buffer) != STATE_OK) {
154 result = max_state (result, error_scan (input_buffer)); 158 result = max_state (result, error_scan (input_buffer));
155 output = strdup (1 + index (input_buffer, ':')); 159 output = strdup (1 + index (input_buffer, ':'));
@@ -163,7 +167,7 @@ main (int argc, char **argv)
163 /* close stdout */ 167 /* close stdout */
164 if (spclose (child_process)) { 168 if (spclose (child_process)) {
165 result = max_state (result, STATE_WARNING); 169 result = max_state (result, STATE_WARNING);
166 if (!strcmp (output, "")) 170 if (output == NULL || !strcmp (output, ""))
167 output = strdup (_("nslookup returned error status")); 171 output = strdup (_("nslookup returned error status"));
168 } 172 }
169 173
@@ -240,6 +244,14 @@ error_scan (char *input_buffer)
240 strstr (input_buffer, ": REFUSED"))) 244 strstr (input_buffer, ": REFUSED")))
241 die (STATE_CRITICAL, _("Connection to DNS %s was refused\n"), dns_server); 245 die (STATE_CRITICAL, _("Connection to DNS %s was refused\n"), dns_server);
242 246
247 /* Query refused (usually by an ACL in the namserver) */
248 else if (strstr (input_buffer, "Query refused"))
249 die (STATE_CRITICAL, _("Query was refused by DNS server at %s\n"), dns_server);
250
251 /* No information (e.g. nameserver IP has two PTR records) */
252 else if (strstr (input_buffer, "No information"))
253 die (STATE_CRITICAL, _("No information returned by DNS server at %s\n"), dns_server);
254
243 /* Host or domain name does not exist */ 255 /* Host or domain name does not exist */
244 else if (strstr (input_buffer, "Non-existent") || 256 else if (strstr (input_buffer, "Non-existent") ||
245 strstr (input_buffer, "** server can't find") || 257 strstr (input_buffer, "** server can't find") ||