Reset Nagios DNS Cache

This support forum board is for support questions relating to Nagios XI, our flagship commercial network monitoring solution.
Locked
vmesquita
Posts: 315
Joined: Fri Aug 10, 2012 12:52 pm

Reset Nagios DNS Cache

Post by vmesquita »

Hi,

We have a few hosts with the address field filled with it's cname and not IP. This is on purpose: this way, when we migrate to an alternative site, the current working server keeps being monitored. However, the only way we found so far to reset the IP nagios associates with a given name is to reboot the server. Is there a way to make nagios search for new DNS information? Restarting the service also doesn't work.
abrist
Red Shirt
Posts: 8334
Joined: Thu Nov 15, 2012 1:20 pm

Re: Reset Nagios DNS Cache

Post by abrist »

There are multiple ways to flush the DNS cache depending on what daemon you use. Also, you could have entries hardcoded into /etc/hosts. See the following document for info on flushing the cache:
http://www.cyberciti.biz/faq/rhel-debia ... dns-cache/
Former Nagios employee
"It is turtles. All. The. Way. Down. . . .and maybe an elephant or two."
VI VI VI - The editor of the Beast!
Come to the Dark Side.
jdalrymple
Skynet Drone
Posts: 2620
Joined: Wed Feb 11, 2015 1:56 pm

Re: Reset Nagios DNS Cache

Post by jdalrymple »

vmesquita wrote:Restarting the service also doesn't work.
Actually - restarting the Nagios service *should* be the way to handle this. Nagios does it's DNS resolution at the time that the configs are read. Perhaps you're getting bitten by retention data - I've never fiddled with this to understand how it works deep under the hood. I'll do that now.

** EDIT Update **

Verified. I setup a check that just runs ifconfig using check_by_ssh. See attachments...

Sooo... is it possible that you're pointing towards slow replicating DNS servers in your environment or some such? The default XI config seems to react properly to a monitoring engine restart.
You do not have the required permissions to view the files attached to this post.
vmesquita
Posts: 315
Joined: Fri Aug 10, 2012 12:52 pm

Re: Reset Nagios DNS Cache

Post by vmesquita »

Hi jdalrymple,

Nagios was poiting to the old IP address 2 days after the change, and DNS is configured with 1 hour time to live. What was odd is that if I ping the name, I get the correct IP address, however restarting and reloading Nagios didn't change anything, it kept pointing to the old address until I rebooted.the whole server.

Next time times happens, I'll try the strategies on the document you posted before and report back.
jdalrymple
Skynet Drone
Posts: 2620
Joined: Wed Feb 11, 2015 1:56 pm

Re: Reset Nagios DNS Cache

Post by jdalrymple »

I would verify that Nagios is restarting properly and that you don't have multiple Nagios monitoring engine processes running. As you can see from my demonstration, it works as advertised.
Locked