Web Interface error "Whoops Error: Could not read host ....

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
tmel173
Posts: 5
Joined: Wed Jul 02, 2014 10:23 am

Web Interface error "Whoops Error: Could not read host ....

Post by tmel173 »

Excuse me if this topic has been posted before but my search gave me some similar issues but not quite the same circumstances and distros. Please feel free to direct me to a link with a resolution.

I am new to the Nagios admin side and have the following set up in my environment : ubuntu 12.04;nagios Core 3.5.0. I had an issue of load average complaint and decided to reboot the server but after reboot the web interface did not come back. I get the error:
"Whoops!
Error: Could not read host and service status information!"

I have check the nagios service,apache2,ndo2db and all are running ...

When I try to restart the service (service nagios restart" I get the error message "Running configuration check... CONFIG ERROR! Restart aborted. Check your Nagios configuration."

stopping and starting the db (service ndo2db stop/start ) works

preflight checks (sudo /usr/local/nagios/bin/nagios -v /usr/local/nagios/etc/nagios.cfg ) comes up with some errors I dont believe are the cause of the problem just the complaint of a contact I removed from contacts.cfg

What is the next step I could check for this issue
tmcdonald
Posts: 9117
Joined: Mon Sep 23, 2013 8:40 am

Re: Web Interface error "Whoops Error: Could not read host .

Post by tmcdonald »

What is the output of sudo /usr/local/nagios/bin/nagios -v /usr/local/nagios/etc/nagios.cfg?

If you are seeing any errors in that output then Nagios will not start properly until the errors are resolved.
Former Nagios employee
tmel173
Posts: 5
Joined: Wed Jul 02, 2014 10:23 am

Re: Web Interface error "Whoops Error: Could not read host .

Post by tmel173 »

1 of the errors is 'hostname' has no services associated with it!" and the other is the one I referenced earlierwhich reads as follows : Contact 'contactname' specified in service 'Disk Usage' for host 'hostaname' is not defined anywhere!

Running pre-flight check on configuration data...

Checking services...
Error: Contact 'contact' specified in service 'Disk Usage' for host 'hostname' is not defined anywhere!
..............................................
..................
.......
...
Checked 763 services.
Checking hosts...
Warning: Host 'hostname' has no services associated with it!
Warning: Host 'hostname' has no services associated with it!
.........
......
...
Checked 111 hosts.
Checking host groups...
Checked 32 host groups.
Checking service groups...
Checked 0 service groups.
Checking contacts...
Checked 9 contacts.
Checking contact groups...
Checked 5 contact groups.
Checking service escalations...
Checked 0 service escalations.
Checking service dependencies...
Checked 0 service dependencies.
Checking host escalations...
Checked 0 host escalations.
Checking host dependencies...
Checked 0 host dependencies.
Checking commands...
Checked 224 commands.
Checking time periods...
Checked 6 time periods.
Checking for circular paths between hosts...
Checking for circular host and service dependencies...
Checking global event handlers...
Checking obsessive compulsive processor commands...
Checking misc settings...

Total Warnings: 10
Total Errors: 28

***> One or more problems was encountered while running the pre-flight check...

Check your configuration file(s) to ensure that they contain valid
directives and data defintions. If you are upgrading from a previous
version of Nagios, you should be aware that some variables/definitions
may have been removed or modified in this version. Make sure to read
the HTML documentation regarding the config files, as well as the
'Whats New' section to find out what has changed.
User avatar
Box293
Too Basu
Posts: 5126
Joined: Sun Feb 07, 2010 10:55 pm
Location: Deniliquin, Australia
Contact:

Re: Web Interface error "Whoops Error: Could not read host .

Post by Box293 »

tmel173 wrote:Contact 'contactname' specified in service 'Disk Usage' for host 'hostaname' is not defined anywhere!
This will be the cause of the problem.

Is hostname a legitimate host you are monitoring, or has it been accidently added to one of the configuration files?

Either remove the "Disk Usage" service directive or create a contact called contactname to resolve the issue.
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.
tmel173
Posts: 5
Joined: Wed Jul 02, 2014 10:23 am

Re: Web Interface error "Whoops Error: Could not read host .

Post by tmel173 »

I changed the real contacts and hosts to "contact" and "hostname" respectively to avoid using my real names for this post..lets call them contactX and hostX.... I apologize for the confusion.
The contact X and hostX are already in the contacts.cfg and hosts.cfg file.
Last edited by tmel173 on Wed Jul 02, 2014 4:31 pm, edited 1 time in total.
User avatar
Box293
Too Basu
Posts: 5126
Joined: Sun Feb 07, 2010 10:55 pm
Location: Deniliquin, Australia
Contact:

Re: Web Interface error "Whoops Error: Could not read host .

Post by Box293 »

LOL no problems.

Use a valid contact name in service "Disk Usage" to resolve the issue.

Once you've made the changes, performing the preflight checks will confirm if you have a valid config.
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.
tmel173
Posts: 5
Joined: Wed Jul 02, 2014 10:23 am

Re: Web Interface error "Whoops Error: Could not read host .

Post by tmel173 »

Which file is this change to be performed in ? I have checked services,contacts and contactgroups but that contact name referenced in the error is not in there ..
User avatar
Box293
Too Basu
Posts: 5126
Joined: Sun Feb 07, 2010 10:55 pm
Location: Deniliquin, Australia
Contact:

Re: Web Interface error "Whoops Error: Could not read host .

Post by Box293 »

You will need to check your /usr/local/nagios/etc/nagios.cfg file as it defines the config files Nagios uses.

This is for an individual server:

Code: Select all

cfg_file=/usr/local/nagios/etc/objects/localhost.cfg
This is for all config files in a directory:

Code: Select all

cfg_dir=/usr/local/nagios/etc/servers
Once you know what files to look in you'll be able to find the item you need changing.


Or you could just do a grep (I could have just told you this but I thought it was better to educate you on how Nagios uses config files)

Code: Select all

grep -r "Disk Usage" /usr/local/nagios/etc/
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.
tmel173
Posts: 5
Joined: Wed Jul 02, 2014 10:23 am

Re: Web Interface error "Whoops Error: Could not read host .

Post by tmel173 »

@Box293 you are a good teacher this is now resolved
Locked