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.
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.780Thanks 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.657The 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.000So 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.407Also, are you saying that
hostname1
andhostname2
are the same host? Normally in the host definition I would define the IP address in theaddress
directive and the DNS name in thealias
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.110Okay, also just noticed you have essentially duplicated your HTTP service check by setting your host's
check_command
usingcheck_http
- this means it will tell you when the website is down, not the actual host (the default command ischeck-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>
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.check-host-alive
command, that's not a problem.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 yourcheck_command
, if you just remove that directive from your host definition it will inherit it from thegeneric-host
template. – Roddie – 2019-08-28T15:07:24.780>
-Thanks for the advice on the
check_command
– JoaquinHF – 2019-08-28T15:19:59.317Okay, 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.003I 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, usedhtpasswd
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.373Exactly, every user is nagiosadmin – JoaquinHF – 2019-08-28T16:52:43.580