New host does not show up on Nagios Core Web Interface

0

I've been having a few problems with my Nagios Core server, every time I add a host to it won't show up on the web interface although it is being monitored and the system notifies when the host goes up or down.

I've checked the permissions, the config files, and the syntax of the host file but everything seems to be fine, any idea on what could I be missing.

JoaquinHF

Posted 2019-08-09T21:43:55.017

Reputation: 1

Can you post the config for this host and the user you are logged into the web application with? – Roddie – 2019-08-16T09:16:34.773

Sure, this is the nagios.cfg file anf this is the cgi.cfg, the user I'm using is adminnagios

– JoaquinHF – 2019-08-19T16:07:53.780

Thanks but where is your config that defines this host? Have you got a config file in /usr/local/nagios/etc/Hosts? – Roddie – 2019-08-22T11:37:21.657

The config files are arranged in a series of folders within /usr/local/nagios/etc/Hosts, and if I run nagios -v /usr/local/nagios/etc/nagios.cfg the systems sees them all. As far as how the hosts are declared, it's either one of the host definitions in this config file depending on the address that is used to access them.

– JoaquinHF – 2019-08-23T19:52:18.000

So what do you see when you click Hosts in the sidebar in the web interface and what happens when you go to eg https://yournagiosserver.com/nagios/cgi-bin/extinfo.cgi?type=1&host=hostname1 ? – Roddie – 2019-08-28T11:45:49.407

Also, are you saying that hostname1 and hostname2 are the same host? Normally in the host definition I would define the IP address in the address directive and the DNS name in the alias directive then in your services etc you can use $HOSTADDRESS$ and $HOSTALIAS$ depending on whether you need the IP or the name. – Roddie – 2019-08-28T12:06:29.110

Okay, also just noticed you have essentially duplicated your HTTP service check by setting your host's check_command using check_http - this means it will tell you when the website is down, not the actual host (the default command is check-host-alive which is ping-based). So maybe the alerts you are seeing are for the service not the host - have you restarted Nagios since amending the config files? – Roddie – 2019-08-28T14:33:52.173

>

  • When I log into https://nagiosserver.com/nagios/cgi-bin/extinfo.cgi?type=1&hostname1 I get a message saying that I do not have permission to view information for that host, I've tried to edit the CGI file but I am not sure where should make a change to view that info.
  • Regarding your question about hostname1 and hostname2 both are different hosts I just wanted to let you know that I have hosts that resolve with a FQDN and some with IP addresses.
  • When I deployed my server I was asked to check the http/https service but I can add the check-host-alive command, that's not a problem.
  • < – JoaquinHF – 2019-08-28T14:56:58.610

    It looks like from your cgi.cfg that the adminnagios account has access to see all the hosts, you will get that permissions message even if the host doesn't exist so I think that maybe the Nagios service just needs restarted?

    You don't need to specify check-host-alive as your check_command, if you just remove that directive from your host definition it will inherit it from the generic-host template. – Roddie – 2019-08-28T15:07:24.780

    >

  • I tried restarting the service as well as the server completely but I still get the same error.
  • -Thanks for the advice on the check_command – JoaquinHF – 2019-08-28T15:19:59.317

    Okay, I'm pretty confused then - can you post your contacts and templates config files to see if there's anything that might be causing it? – Roddie – 2019-08-28T15:44:04.307

    Sure, templates.cfg and contacts.cfg I also have some contacts defined in different files like this one

    – JoaquinHF – 2019-08-28T16:15:31.003

    I can see nagiosadmin user defined in contacts.cfg but not adminnagios which is the account you said you were logging into the web interface with (and is listed in cgi.cfg as having access to all the hosts). – Roddie – 2019-08-28T16:30:07.560

    I already fixed that, I did a full check of the users and contacts to be sure that there are no mistakes with the users – JoaquinHF – 2019-08-28T16:34:50.447

    So where did you fix it and what account are you using? – Roddie – 2019-08-28T16:37:51.190

    I changed the cgi file restoring the original so every thing goes back to default values which are the ones in the contacts file, the account is nagios admin – JoaquinHF – 2019-08-28T16:41:37.257

    So have you got authorized_for_all_hosts=nagiosadmin set in cgi.cfg, used htpasswd to set a password for nagiosadmin, verified the config, restarted Nagios and tried to check the host in the web interface? – Roddie – 2019-08-28T16:50:47.373

    Exactly, every user is nagiosadmin – JoaquinHF – 2019-08-28T16:52:43.580

    No answers