Page 1 of 2
Error: Could not read host and service status information!
Posted: Thu Oct 24, 2019 10:08 am
by tr53
Hi,
I have a below error in nagios and I wonder if someone could help.
Code: Select all
Whoops!
Error: Could not read host and service status information!
The most common cause of this error message (especially for new users), is the fact that Nagios is not actually running. If Nagios is indeed not running, this is a normal error message. It simply indicates that the CGIs could not obtain the current status of hosts and services that are being monitored. If you've just installed things, make sure you read the documentation on starting Nagios.
Some other things you should check in order to resolve this error include:
Check the Nagios log file for messages relating to startup or status data errors.
Always verify configuration options using the -v command-line option before starting or restarting Nagios!
Make sure you read the documentation on installing, configuring and running Nagios thoroughly before continuing. If all else fails, try sending a message to one of the mailing lists. More information can be found at http://www.nagios.org.
I ran
Code: Select all
sudo /usr/local/nagios/bin/nagios -v /usr/local/nagios/etc/nagios.cfg
which gave me one error, and then I stupidly (too quickly and not checking it) ran
Code: Select all
sudo /etc/rc.d/init.d/nagios reload
The error was:
Code: Select all
Error: The description string for service 'Free Memory, less than 1.5 eq Critical' on host 'pfsense' contains one or more illegal characters.
Basically a dot or a comma which I now removed.
Code: Select all
sudo /usr/local/nagios/bin/nagios -v /usr/local/nagios/etc/nagios.cfg
doesn't give me any errors now, but nagios still can't read host and service status information.
Nagios is running
Code: Select all
ps -ef | grep nagios
nagios 15391 1 0 15:33 ? 00:00:00 /usr/sbin/nagios -d /etc/nagios/nagios.cfg
root 15540 15526 0 15:40 pts/0 00:00:00 grep --color=auto nagios
I can access the main page, and MRTG graphs, but any other page is giving me
error.
Debug is set to zero but I can change it and maybe get some info?
Re: Error: Could not read host and service status informatio
Posted: Thu Oct 24, 2019 2:29 pm
by scottwilkerson
Did you restart nagios after making the correction?
Did you check the nagios.log for startup errors?
Re: Error: Could not read host and service status informatio
Posted: Fri Oct 25, 2019 3:33 am
by tr53
Hi Scott,
Yes I did restart nagios using
Code: Select all
sudo /etc/rc.d/init.d/nagios reload
and also by restarting the server.
Code: Select all
cat /var/log/nagios/nagios.log
[1571987038] Caught SIGTERM, shutting down...
[1571987038] Successfully shutdown... (PID=15391)
[1571987089] Nagios 3.5.1 starting... (PID=2749)
[1571987089] Local time is Fri Oct 25 07:04:49 UTC 2019
[1571987089] LOG VERSION: 2.0
[1571987089] Finished daemonizing... (New PID=2782)
[1571987479] SERVICE NOTIFICATION: nagiosadmin;localhost;Swap Usage;CRITICAL;notify-service-by-email;SWAP CRITICAL - 100% free (0 MB out of 0 MB)
[1571990689] Auto-save of retention data completed successfully.
[1571990769] SERVICE NOTIFICATION: nagiosadmin;localhost;HTTP;WARNING;notify-service-by-email;HTTP WARNING: HTTP/1.1 403 Forbidden - 5173 bytes in 0.001 second response time
[1571991079] SERVICE NOTIFICATION: nagiosadmin;localhost;Swap Usage;CRITICAL;notify-service-by-email;SWAP CRITICAL - 100% free (0 MB out of 0 MB)
Re: Error: Could not read host and service status informatio
Posted: Fri Oct 25, 2019 8:07 am
by scottwilkerson
Can you show the output of the following
Code: Select all
grep nag /etc/group
getenforce
ls -al /usr/local/nagios/var
Re: Error: Could not read host and service status informatio
Posted: Fri Oct 25, 2019 8:13 am
by tr53
Hi,
Code: Select all
$ grep nag /etc/group
nagios:x:497:apache
$ getenforce
Disabled
$ ls -al /usr/local/nagios/var
total 848
drwxrwxr-x 5 nagios nagios 4096 Oct 24 14:48 .
drwxr-xr-x 9 root root 4096 Jul 21 2016 ..
drwxrwxr-x 2 nagios nagios 61440 Oct 23 23:59 archives
-rw-r--r-- 1 nagios nagios 34 Aug 21 2017 nagios.configtest
-rw-r--r-- 1 nagios nagios 122382 Oct 24 2016 nagios.debug
-rw-r--r-- 1 nagios nagios 6 Feb 25 2019 nagios.lock
-rw-r--r-- 1 nagios nagios 65710 Oct 24 14:48 nagios.log
-rw-rw-r-- 1 nagios nagios 143365 Dec 19 2016 nagios.tmpo0D4xY
-rw-r--r-- 1 nagios nagios 129701 Oct 24 14:47 objects.cache
-rw-r--r-- 1 nagios nagios 100248 Aug 21 2017 objects.precache
-rw------- 1 nagios nagios 194538 Oct 24 14:48 retention.dat
drwxrwsr-x 2 nagios nagios 4096 Oct 24 14:48 rw
drwxr-xr-x 3 root root 4096 Jul 21 2016 spool
Re: Error: Could not read host and service status informatio
Posted: Fri Oct 25, 2019 8:29 am
by scottwilkerson
Somehow the nagios user isn't part of the nagios group
As root run the following:
also a few permissions don't seem correct
Code: Select all
chown nagios:nagios /usr/local/nagios /usr/local/nagios/var/spool
then restart nagios and remove that really old lock file if it still exists
Code: Select all
service nagios stop
rm -f /usr/local/nagios/var/nagios.lock
service nagios start
Also, I don't see a status.dat file, could be caused by permissions but if the above doesn't work show the output of the following
Code: Select all
grep status_file /usr/local/nagios/etc/nagios.cfg
Re: Error: Could not read host and service status informatio
Posted: Fri Oct 25, 2019 9:15 am
by tr53
Hi,
Thank you for this. I applied commands you mentioned but the issue still persist.
Code: Select all
$ sudo usermod -a -G nagios nagios
$ sudo chown nagios:nagios /usr/local/nagios /usr/local/nagios/var/spool
$ sudo service nagios stop
Stopping nagios: done.
$ sudo rm -f /usr/local/nagios/var/nagios.lock
$ sudo service nagios start
Starting nagios: done.
$ ls -al /usr/local/nagios/var
total 844
drwxrwxr-x 5 nagios nagios 4096 Oct 25 14:04 .
drwxr-xr-x 9 nagios nagios 4096 Jul 21 2016 ..
drwxrwxr-x 2 nagios nagios 61440 Oct 23 23:59 archives
-rw-r--r-- 1 nagios nagios 34 Aug 21 2017 nagios.configtest
-rw-r--r-- 1 nagios nagios 122382 Oct 24 2016 nagios.debug
-rw-r--r-- 1 nagios nagios 65710 Oct 24 14:48 nagios.log
-rw-rw-r-- 1 nagios nagios 143365 Dec 19 2016 nagios.tmpo0D4xY
-rw-r--r-- 1 nagios nagios 129701 Oct 24 14:47 objects.cache
-rw-r--r-- 1 nagios nagios 100248 Aug 21 2017 objects.precache
-rw------- 1 nagios nagios 194538 Oct 24 14:48 retention.dat
drwxrwsr-x 2 nagios nagios 4096 Oct 24 14:48 rw
drwxr-xr-x 3 nagios nagios 4096 Jul 21 2016 spool
$ grep nag /etc/group
nagios:x:497:apache,nagios
nagios.cfg point to status.dat
Code: Select all
$ grep status_file /usr/local/nagios/etc/nagios.cfg
status_file=/usr/local/nagios/var/status.dat
but I found it here
Code: Select all
# find . -name status.dat
./var/log/nagios/status.dat
Re: Error: Could not read host and service status informatio
Posted: Fri Oct 25, 2019 9:49 am
by scottwilkerson
tr53 wrote:but I found it here
Code: Select all
# find . -name status.dat
./var/log/nagios/status.dat
That is bizarre
Can you show the output of
Re: Error: Could not read host and service status informatio
Posted: Fri Oct 25, 2019 10:15 am
by tr53
Code: Select all
$ ps -ef|grep nagios.cfg
nagios 8796 1 0 14:04 ? 00:00:01 /usr/sbin/nagios -d /etc/nagios/nagios.cfg
ec2-user 9894 7894 0 15:14 pts/0 00:00:00 grep --color=auto nagios.cfg
Re: Error: Could not read host and service status informatio
Posted: Fri Oct 25, 2019 10:22 am
by scottwilkerson
tr53 wrote:Code: Select all
$ ps -ef|grep nagios.cfg
nagios 8796 1 0 14:04 ? 00:00:01 /usr/sbin/nagios -d /etc/nagios/nagios.cfg
ec2-user 9894 7894 0 15:14 pts/0 00:00:00 grep --color=auto nagios.cfg
Ok, there is a problem here, you somehow have installed both a source install and a packaged (maybe yum/apt) install
So you have one config going off of
and another going off of
You need to determine which set of configs are correct... and I would highly recommend moving them to a new clean install if at all possible as this is going to be really confusing for anyone administering this machine (not to mention the cleanup is going to already get messy)
https://support.nagios.com/kb/article/n ... ce-96.html