Page 2 of 3
Re: DNS lookup failing even though resolv.conf is correct
Posted: Tue Dec 13, 2016 6:00 pm
by snapon_admin
I already tried that and it still doesn't work, the trap still shows up under unconfigured objects with the IP as the host. I also can't try the other solution because I don't know what you mean by make sure it's the right order. Are you talking about this part?
Re: DNS lookup failing even though resolv.conf is correct
Posted: Tue Dec 13, 2016 6:06 pm
by avandemore
Yes, what are contents /etc/hosts and /usr/local/nagios/etc/hosts/lisgrid01p.cfg
Re: DNS lookup failing even though resolv.conf is correct
Posted: Wed Dec 14, 2016 8:54 am
by snapon_admin
Code: Select all
[root@lisl-ngos-01-pv etc]# cat /etc/hosts
127.0.0.1 localhost.localdomain localhost.localdomain localhost4 localhost4.localdomain4 localhost
::1 localhost.localdomain localhost.localdomain localhost6 localhost6.localdomain6 localhost
10.245.128.172 lisl-ngos-01-pv lisl-ngos-01-pv.snapon.com lisl-ngos-01-pv
10.245.0.1 USSNAPLSAIL-Core
Code: Select all
[root@lisl-ngos-01-pv etc]# cat /usr/local/nagios/etc/hosts/lisgrid01p.cfg
###############################################################################
#
# Host configuration file
#
# Created by: Nagios Core Config Manager 2.6.0
# Date: 2016-12-05 13:03:08
# Version: Nagios 3.x config file
#
# --- DO NOT EDIT THIS FILE BY HAND ---
# Nagios CCM will overwrite all manual settings during the next update if you
# would like to edit files manually, place them in the 'static' directory or
# import your configs into the CCM by placing them in the 'import' directory.
#
###############################################################################
define host {
host_name lisgrid01p
use solaris-server
alias Lisle, IL Grid Monitoring server (Traps)
address lisgrid01p.snapon.com
max_check_attempts 5
check_interval 5
retry_interval 1
check_period xi_timeperiod_24x7
notification_interval 60
notification_period xi_timeperiod_24x7
icon_image solaris.png
_xiwizard passiveobject
register 1
}
###############################################################################
#
# Host configuration file
#
# END OF FILE
#
###############################################################################
Re: DNS lookup failing even though resolv.conf is correct
Posted: Wed Dec 14, 2016 9:02 am
by eloyd
TL;DR (no clue if this applies, but this leaped out at me from the beginning of this thread):
Are you sure your DNS zones are correct? resolv.conf does not query servers until it gets a result, it queries servers until it doesn't get a timeout. So a null result (ie, IP not found) is a non-null result and it will stop querying the list of servers in your resolv.conf file.
"The algorithm used is to try a name server, and if the query times out, try the next, until out of name servers, then repeat trying all the name servers until a maximum number of retries are made."
If you want to spread the load out, you must use the rotate option:
"sets RES_ROTATE in _res.options, which causes round-robin selection of nameservers from among those listed. This has the effect of spreading the query load among all listed servers, rather than having all clients try the first listed server first every time."
Re: DNS lookup failing even though resolv.conf is correct
Posted: Wed Dec 14, 2016 10:21 am
by avandemore
Yeah so you still have no host called the name the trap is coming is as. As said before, it will not work as is.
Re: DNS lookup failing even though resolv.conf is correct
Posted: Wed Dec 14, 2016 10:22 am
by snapon_admin
It has worked this way for 2 years...
Re: DNS lookup failing even though resolv.conf is correct
Posted: Wed Dec 14, 2016 10:31 am
by eloyd
Okay, but for fun, change:
to
And see what happens.
Re: DNS lookup failing even though resolv.conf is correct
Posted: Wed Dec 14, 2016 11:05 am
by snapon_admin
I have already done that, I think I stated that earlier but I might be mistaken. It didn't change anything. I just had my DBA retest by sending another trap, and this time the host resolved with the proper name. And, as I stated earlier, the .snapon.com suffix was not necessary in the host_name field. As shown here, it drops the suffix anyway. This is what happened when the host_name was set to lisgrid01p.snapon.com:
traps broken.png
The suffix is dropped so this trap was sent to unconfigured objects since the hostname includes the suffix. That was what I was trying to say earlier. So this is working now, but I still have a problem with the DNS resolution, though now I'm thinking it might be a CentOS issue and not a Nagios one, so I am not sure if you can fix this. I modified the resolv.conf file yesterday to put one Unix DNS server and one Windows DNS server into it, with the Unix server listed on top. It took until this morning for this to actually work as expected which is kind of an issue. Again, it may not be a Nagios issue though, I'm assuming /etc/resolv.conf is a CentOS thing and not a Nagios thing but feel free to correct me if I'm wrong there.
Re: DNS lookup failing even though resolv.conf is correct
Posted: Wed Dec 14, 2016 11:18 am
by eloyd
/etc/resolv.conf is very much a Unix thing, not a Nagios thing. Things to check if your DNS is not resolving properly are to make sure the zones are properly loaded with correct serial numbers, that the resolvers are running on the DNS servers, and that your TTL is set to a time frame that make sense for your organization.
And, as my pappy used to say, "If DNS ain't workin', ain't nobody workin'."
Re: DNS lookup failing even though resolv.conf is correct
Posted: Wed Dec 14, 2016 11:24 am
by snapon_admin
Well DNS was always working per se. The problem was that the etc/resolv.conf file doesn't seem to like going through the list of servers like it says it's supposed to. If the Unix DNS server is listed first, I'll get a proper result. If it's listed second or later, I won't. Thats' the problem I have with resolv.conf. It's not an issue on our DNS servers otherwise believe me, we'd have bigger issues here.