Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Downstream bug: check_dns has strange output if domain is not found #412

Closed
smooge opened this issue Aug 22, 2018 · 3 comments
Closed

Downstream bug: check_dns has strange output if domain is not found #412

smooge opened this issue Aug 22, 2018 · 3 comments
Labels

Comments

@smooge
Copy link

smooge commented Aug 22, 2018

This was opened in Red Hat Bugzilla https://bugzilla.redhat.com/show_bug.cgi?id=1620274 but looks better suited for an upstream bug

Description of problem:
check_dns has strange and unexpected output if domain is not found

Version-Release number of selected component (if applicable):
rpm -qf /usr/lib64/nagios/plugins/check_dns
nagios-plugins-dns-2.2.1-14.20180725git3429dad.el7.x86_64
(epel-testing)

How reproducible:
always

Steps to Reproduce:
/usr/lib64/nagios/plugins/check_dns -H 1.1.1.1.sbl.spamhaus.org -q A -s 1.1.1.1

Actual results:
DNS WARNING - 1.1.1.1

Expected results:
a message containing somehow the NXDOMAIN result

Additional info:

related strace shows that original information is received:

[pid 12394] write(1, "Server:\t\t1.1.1.1\nAddress:\t1.1.1.1#53\n\n** server can't find 88.217.158.108.sbl.spamhaus.org: NXDOMAIN\n\n", 102) = 102
[pid 12393] <... read resumed> "Server:\t\t1.1.1.1\nAddress:\t1.1.1.1#53\n\n** server can't find 88.217.158.108.sbl.spamhaus.org: NXDOMAIN\n\n", 4096) = 102

@jalbstmeijer
Copy link

I'd like to confirm this unwanted behavior. Not only the output seems incomplete, also I would expect a critical state;

v1.4.15 works as expected:

check_dns -H www.google.com -s 127.0.0.1; echo $?
DNS OK: 0.010 seconds response time. www.google.com returns 172.217.19.196|time=0.009652s;;;0.000000
0

check_dns -H XXX.google.com -s 127.0.0.1; echo $?
Domain XXX.google.com was not found by the server
2

but v2.2.1 not;

check_dns -H www.google.com -s 127.0.0.1; echo $?
DNS OK: 0.116 seconds response time. www.google.com returns 74.125.193.103,74.125.193.104,74.125.193.105,74.125.193.106,74.125.193.147,74.125.193.99|time=0.116325s;;;0.000000
0

check_dns -H XXX.google.com -s 127.0.0.1; echo $?
DNS WARNING - 127.0.0.1
1

@jalbstmeijer
Copy link

Issue does not seem check_dns version related, but related to the underlying nslookup and the fact that the newer one exits with other exit codes besides 0.

version part of bind-utils-9.8.2:
system1~]# /usr/bin/nslookup -sil XXX.google 127.0.0.1; echo $?
Server: 127.0.0.1
Address: 127.0.0.1#53

** server can't find XXX.google.com: NXDOMAIN

1

part of bind-utils-9.3.6:
system2~]# /usr/bin/nslookup -sil XXX.google.com 127.0.0.1; echo $?
Server: 127.0.0.1
Address: 127.0.0.1#53

** server can't find XXX.google.com: NXDOMAIN

0

Fix could be;

--- plugins/check_dns.c.back 2018-10-19 09:18:17.402795124 -0400
+++ plugins/check_dns.c 2018-10-19 09:39:58.465156153 -0400
@@ -135,7 +135,7 @@
printf ("%s\n", command_line);

/* run the command */

  • if((np_runcmd(command_line, &chld_out, &chld_err, 0)) != 0) {
  • if((np_runcmd(command_line, &chld_out, &chld_err, 0)) != 0 && (np_runcmd(command_line, &chld_out, &chld_err, 0)) != 1) {
    msg = strdup(_("nslookup returned an error status"));
    result = STATE_WARNING;
    }

@sawolf sawolf added the Bug label Nov 25, 2019
@sawolf
Copy link
Member

sawolf commented Nov 25, 2019

This seems to be fixed by #494. If either of you find that the issue isn't fixed in maint, let me know and I'll reopen this issue.

@sawolf sawolf closed this as completed Nov 25, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants