Page 1 of 1

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

Posted: Thu Oct 02, 2014 2:18 pm
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:

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

Posted: Thu Oct 02, 2014 2:37 pm
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.

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

Posted: Thu Oct 02, 2014 3:46 pm
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

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

Posted: Thu Oct 02, 2014 3:54 pm
by xpac
Thanks that worked :D