I want the Nagios server to stop calling itself localhost...

Support forum for Nagios Core, Nagios Plugins, NCPA, NRPE, NSCA, NDOUtils and more. Engage with the community of users including those using the open source solutions.
Locked
xpac
Posts: 54
Joined: Mon Aug 25, 2014 3:43 pm

I want the Nagios server to stop calling itself localhost...

Post by xpac »

I assumed this was a fairly straight forward thing to do but I can't figure it out. After googling I've found a ton of different opinions, none of which worked. Isn't there a simple way to do this?? So far I've only been able to add the server as a host but then it just shows the hostname and localhost as two separate hosts :lol:
xpac
Posts: 54
Joined: Mon Aug 25, 2014 3:43 pm

Re: I want the Nagios server to stop calling itself localhos

Post by xpac »

What I should say, is that if I add the proper hostname for the server and IP address in the hosts.cfg file it shows up as a host but localhost still stays as well which makes sense because I assume its reading that from the localhosts.cfg.

But if I try to change localhost to the proper name/IP address in the localhost.cfg file nagios gets broken so obviously I'm doing something wrong there.
User avatar
lmiltchev
Bugs find me
Posts: 13589
Joined: Mon May 23, 2011 12:15 pm

Re: I want the Nagios server to stop calling itself localhos

Post by lmiltchev »

I don't see any reason why one would remove or rename localhost host in nagios, but if you really want to do this, you could comment out the localhost entry in the nagios.cfg, so it would look like this:

Code: Select all

#cfg_file=/usr/local/nagios/etc/objects/localhost.cfg
Save and exit.

Set up your "new" localhost, with the correct name, IP, etc. Verify your configuration:

Code: Select all

/usr/local/nagios/bin/nagios -v /usr/local/nagios/etc/nagios.cfg
and if there are no config errors, restart nagios:

Code: Select all

service nagios restart
Be sure to check out our Knowledgebase for helpful articles and solutions!
xpac
Posts: 54
Joined: Mon Aug 25, 2014 3:43 pm

Re: I want the Nagios server to stop calling itself localhos

Post by xpac »

Thanks that worked :D
Locked