Error: Could not read host and service status information!

Error: Could not read host and service status information!

I have worked on this for two weeks, probably 40-50 hours total effort, and has caused alot of strain between myself and my boss over my inablility to fix it. So any help would be very much appreciated.

I had been running Nagios 1.2 for over a year with no problems, but the
system it was running on crashed and with only a backup of the configuration
files, I have been building a new Nagios system. This is on SUSE 9.1.

I went through the instructions step by step and everything seemed to go
smoothly, but none of the .cgi screens will come up. Instead I get the
"Error: Could not read host and service status information!" message.

Here"s what I"ve checked and what I know so far.

There are no errors in the nagios or apache2 logs.
Nagios itself is working. I am getting the correct notifications in my
e-mails

Here are the ps -ef lines for the running apache2 and nagios applications:
wwwrun 9371 9368 0 09:32 ? 00:00:00 /usr/sbin/httpd2-prefork -f
/etc/apache2/httpd.conf
nagios 9397 1 0 09:32 ? 00:00:00 /etc/nagios/bin/nagios -d
/etc/nagios/etc/nagios.cfg

(Nagios was installed in /etc/nagios to match the directory setup of the
previous installation)

I have also tried compiling the program and installing into /usr/local/nagios/ and I get the errors. I have done three installs (and removals) of Nagios so far, and two of Apache.

Here are the Alias lines from httpd.conf:
ScriptAlias /nagios/cgi-bin /etc/nagios/sbin
<Directory “/etc/nagios/sbin”>
AllowOverride AuthConfig
Options ExecCGI
Order allow,deny
Allow from all

Alias /nagios /etc/nagios/share
<Directory “/etc/nagios/share”>
Options None
AllowOverride AuthConfig
Order allow,deny
Allow from all

(I have also tried variations by adding/removing the trailing / with no
effect.)

Here are the important lines from cgi.cfg:
main_config_file=/etc/nagios/etc/nagios.cfg
physical_html_path=/etc/nagios/share
url_html_path=/nagios
use_authentication=1

I have also tried this with authentication turned off.

All of the paths in nagios.cfg are correct.

/etc/passwd
wwwrun:x:30:8:WWW daemon apache:/var/lib/wwwrun:/bin/false
nagios:x:1001:100::/home/nagios:/bin/bash

/etc/group
nagios:x:101:nagios1,wwwrun,nagios,nobody
nagiocmd:idea::1001:wwwrun,nagios,nobody

Here are the permissions on the appropriate directories:
/etc/nagios
drwxr-xr-x 8 nagios nagioscmd 192 Mar 24 12:19 .
drwxr-xr-x 60 root root 5776 Mar 24 09:29 …
drwxrwxrwx 2 nagios nagiocmd 104 Mar 23 15:10 bin
drwxrwxrwx 2 nagios nagiocmd 1112 Mar 24 12:20 etc
drwxrwxrwx 2 nagios nagiocmd 1744 Mar 23 16:56 libexec
drwxrwxrwx 2 nagios nagiocmd 544 Mar 24 08:57 sbin
drwxrwxrwx 9 nagios nagiocmd 416 Mar 24 09:04 share
drwxrwxrwx 4 nagios nagiocmd 160 Mar 23 16:20 var
(I have set everything to 777 just to try to get things working)

/etc/nagios/sbin
drwxrwxrwx 2 nagios nagiocmd 544 Mar 24 08:57 .
drwxr-xr-x 8 nagios nagioscmd 192 Mar 24 12:19 …
-rwxr-xr-x 1 root root 103 Mar 24 08:57 .htaccess
-rwxrwxrwx 1 nagios nagiocmd 147372 Mar 23 15:02 avail.cgi
-rwxrwxrwx 1 nagios nagiocmd 148360 Mar 23 15:02 cmd.cgi
-rwxrwxrwx 1 nagios nagiocmd 117452 Mar 23 15:02 config.cgi
-rwxrwxrwx 1 nagios nagiocmd 161476 Mar 23 15:02 extinfo.cgi
-rwxrwxrwx 1 nagios nagiocmd 109964 Mar 23 15:02 history.cgi
-rwxrwxrwx 1 nagios nagiocmd 103 Mar 23 18:35 htaccess
-rwxrwxrwx 1 nagios nagiocmd 9696 Mar 23 15:10 nagios-statd
-rwxrwxrwx 1 nagios nagiocmd 105900 Mar 23 15:02 notifications.cgi
-rwxrwxrwx 1 nagios nagiocmd 103784 Mar 23 15:02 outages.cgi
-rwxrwxrwx 1 nagios nagiocmd 106156 Mar 23 15:02 showlog.cgi
-rwxrwxrwx 1 nagios nagiocmd 150920 Mar 23 15:02 status.cgi
-rwxrwxrwx 1 nagios nagiocmd 119564 Mar 23 15:02 statuswml.cgi
-rwxrwxrwx 1 nagios nagiocmd 114632 Mar 23 15:02 statuswrl.cgi
-rwxrwxrwx 1 nagios nagiocmd 123244 Mar 23 15:02 summary.cgi
-rwxrwxrwx 1 nagios nagiocmd 128104 Mar 23 15:02 tac.cgi

/etc/nagios/var
drwxrwxrwx 4 nagios nagiocmd 160 Mar 23 16:20 .
drwxr-xr-x 8 nagios nagioscmd 192 Mar 24 12:19 …
drwxrwxr-x 2 nagios nagioscmd 48 Mar 23 15:02 archives
-rw-r–r-- 1 nagios nagioscmd 0 Mar 24 09:32 nagios.log
drwxrwsr-x 2 wwwrun nagiocmd 80 Mar 24 09:32 rw
-rw-r–r-- 1 nagios users 0 Mar 24 09:32 status.sav

/etc/nagios/var/rw
drwxrwsr-x 2 wwwrun nagiocmd 80 Mar 24 09:32 .
drwxrwxrwx 4 nagios nagiocmd 160 Mar 23 16:20 …
prw-rw---- 1 nagios nagiocmd 0 Mar 24 09:32 nagios.cmd


So far, nothing I have tried has made any difference. Does anything stand
out to anyone that could be causing the problem? I have checked all the
newsgroups I could find, and google, and nothing has budged the problem in
the slightest.

Any advice would be appreciated.

Allison Andrews
Unix Administrator
Epson Portland Inc

Are you telling nagios which files to read?
In nagios.cfg you need to reference the files which contain the hosts and service configuration informations… seems they are missing…

Luca

Start with page1 of the docs, and follow them. I"ve been installing nagios for a couple years now, and I still read them step by step.

Did you create the .htaccess files? There are so many steps to take.
What do you get when you run
/usr/local/nagios/bin/nagios -v /usr/local/nagios/etc/nagios.cfg
Edited Mon Apr 04 2005, 04:38PM ]

There are no errors when I run the -v option. Nagios itself is running. I am getting correct notifications via e-mail. Only the web interface is not working.

I went through the process of setting up nagios through the instructions three times, spending close to 14 hours in just one day working on it. I was very careful to follow each instruction exactly. Every time, everything is fine to the point that I try to bring up status information, then I get this error. I have also installed apache three times now, first from the rpm package, then compiled it myself, then back to the rpm package again. The SUSE load has also been done three times.

I tried also turning off authentication, just to try to get it working.

What exactly causes this error? It seems to be an authentication issue for apache but I’ve spent endless hours checking all rights to make sure everything looks good to no avail.

.htaccess file reads as follows for me, how about you? In the sbin directory?

AuthName "Nagios Access"
AuthType Basic
AuthUserFile /usr/local/nagios/etc/htpasswd.users
require valid-user

When you compiled nagios, did you state
./configure --with-cgiurl=/etc/nagios/sbin --with-htmurl=/etc/nagios/share --prefix=/etc/nagios

Actually, all you needed in the compile, was --prefix=/etc/nagios, and I have to assume you did that part.
But you say you are back on the RPM install now? If so, it’s difficult to troubleshoot an RPM, since it was compiled in some way not documented.
A source install is the same for everyone. We all read the same instructions. If it refuses to work and you can’t find the cfg file problem(a typo is my guess) then perhaps a source install will be a good idea.

The problem is I can’t just drop this machine again to do another rebuild. I’ve done that three times already, twice with RPM’s, once with manual compile, always with the same results.

I have the httpd.conf and all of the .cfg files from the old install that I KNOW worked.

Since Nagios is working, apparently flawlessly other than the interface to apache, my question is. What all is involved with apache authenticating the .cfg files? As I said, I have the httpd.conf from the previous install that I know worked, and the paths are the same.

How does the authentication work for the apache client? The apache user has to be a group member of the group owner for the .cfg files, correct? What other permissions does the apache user need?

I took four hours to very carefully go through the manual installation instructions for nagios and apache and the problem I have now is the same that I had then. Yes, I have gone back to the rpm installs because those are the only ones that have ever worked.

I just need to find a solution as to why everything works except the cfg’s. I have gone through everything line by line, character by character, now up over 50 hours of work over two weeks, and my boss has reached the point where he wants to get rid of Nagios altogether.

No errors in my logs, which doesn’t help, even when I turn apache’s logging level to debug. As far as I can tell, it’s not as simple as a path, plus that would probably produce an error in the nagios or apache logs, and it isn’t.

"Error: Could not read host and service status information!"
Is that the entire message? If not, paste the rest. Perhaps it also stated, “it appears you dont have …” I noticed you have 2 htaccess files, one with .htaccess and one with no period. Are both correct and what is apache looking for in it’s httpd.conf? My apache is looking for .htaccess files.

This may or may not help you, but it got me a step closer. I’ve been having the same problem as the original poster for several days now.

While reading the /etc/nagios/nagios.cfg file on a Debian .deb package install of nagios 1.4, I found this:

RESOURCE FILE

This is an optional resource file that contains $USERx$ macro

definitions. Multiple resource files can be specified by using

multiple resource_file definitions. The CGIs will not attempt to

read the contents of resource files, so information that is

considered to be sensitive (usernames, passwords, etc) can be

defined as macros in this file and restrictive permissions (600)

can be placed on this file.

resource_file=/etc/nagios/resource.cfg

However, all of my database credentials were in the file /etc/nagios/database.cfg. So I added this line to /etc/nagios/nagios.cfg:

resource_file=/etc/nagios/database.cfg

And suddenly nagios can connect to the database. I still have some cgi permissions to work out, but I’m feeling closer!

Check the security on all Nagios directories. After I changed this everything worked. Here is what I did:

I did an scp -pr from a server that already had a working copy o Nagios on it.
Then I had problems like the cgi directories weren’t getting data.
Then it ran sporatically.

After I checked back here and looked at my user and group ownership I changed that to reflect nagios:nagcmd and I am up and running without running any compilation or configure scripts.

Vince