Nagios Service is working but Webinterface shows Error

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.
ardstr
Posts: 8
Joined: Mon Mar 26, 2018 3:15 pm

Nagios Service is working but Webinterface shows Error

Post by ardstr »

Hi together,

in our company we are using nagios to monitor the functions our the servers.

A few days ago we had the Problem, that nagios.cmd was not working so I tried to do some troubleshooting with the Information of other topics.
But now we are having an even more big problem :D

Verifying the nagios configuration brings me this:

Code: Select all

nagios@XXXX:/usr/local/nagios/etc$ /usr/local/nagios/bin/nagios -v /usr/local/nagios/etc/nagios.cfg

Nagios Core 4.0.6
Copyright (c) 2009-present Nagios Core Development Team and Community Contributors
Copyright (c) 1999-2009 Ethan Galstad
Last Modified: 04-29-2014
License: GPL

Website: http://www.nagios.org
Reading configuration data...

   Read main config file okay...
   Read object config files okay...

Running pre-flight check on configuration data...

Checking objects...
        Checked 588 services.
        Checked 132 hosts.
        Checked 8 host groups.
        Checked 0 service groups.
        Checked 4 contacts.
        Checked 1 contact groups.
        Checked 35 commands.
        Checked 5 time periods.
        Checked 0 host escalations.
        Checked 0 service escalations.
Checking for circular paths...
        Checked 132 hosts
        Checked 0 service dependencies
        Checked 0 host dependencies
        Checked 5 timeperiods
Checking global event handlers...
Checking obsessive compulsive processor commands...
Checking misc settings...

Total Warnings: 0
Total Errors:   0

Things look okay - No serious problems were detected during the pre-flight check
The log file of nagios don't shows any errors to me.

The Nagios service is running....

Code: Select all

nagios@XXXX:/usr/local/nagios/etc$ service nagios status
nagios (pid 12663) is running...
But the Webinterface shows me this:
Whoops!
Error: Could not read object configuration data!

Here are some things you should check in order to resolve this error:

Verify configuration options using the -v command-line option to check for errors.
Check the Nagios log file for messages relating to startup or status data errors.
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.
Apache2 service is running normally and the www-data user is member of both groups

Code: Select all

nagios@b13lxhr01:/usr/local/nagios/etc$ grep nag /etc/group
nagios:x:1001:nagios,www-data
nagcmd:x:1002:www-data,nagios
The premission on direcotorys look right to me, if needed i can upload configurations..

I don't have any idea what it could also be so i hope to find help in this support forum.

Thanks for your help.
scottwilkerson
DevOps Engineer
Posts: 19396
Joined: Tue Nov 15, 2011 3:11 pm
Location: Nagios Enterprises
Contact:

Re: Nagios Service is working but Webinterface shows Error

Post by scottwilkerson »

Is www-data for sure your httpd user and not apache?


Is selinux enabled?
try

Code: Select all

setenforce 0
then restart httpd
Former Nagios employee
Creator:
ahumandesign.com
enneagrams.com
ardstr
Posts: 8
Joined: Mon Mar 26, 2018 3:15 pm

Re: Nagios Service is working but Webinterface shows Error

Post by ardstr »

Hi Scott,

at first: Thanks for your fast answer!

Yes in Apache2 as user www-data is configured...

I tried the setenforce 0 but after this command nagios says, that selinux is not installed yet. So i guess this is not the problem... :cry:
scottwilkerson
DevOps Engineer
Posts: 19396
Joined: Tue Nov 15, 2011 3:11 pm
Location: Nagios Enterprises
Contact:

Re: Nagios Service is working but Webinterface shows Error

Post by scottwilkerson »

Can you show the permissions for the objects.cached file and the directory it resides in?
Former Nagios employee
Creator:
ahumandesign.com
enneagrams.com
ardstr
Posts: 8
Joined: Mon Mar 26, 2018 3:15 pm

Re: Nagios Service is working but Webinterface shows Error

Post by ardstr »

Code: Select all

nagios@XXXX:~$ ls -la /usr/local/nagios/var
insgesamt 3628
drwxrw-rw- 5 nagios nagios   4096 Mär 28 17:56 .
drwxr-xr-x 9 root   root     4096 Mai 21  2014 ..
drwxrwxr-x 2 nagios nagios  69632 Mär 27 23:59 archives
-rw-r--r-- 1 nagios nagios      6 Mär 26 22:43 nagios.lock
-rw-rw-r-- 1 nagios nagios 257041 Mär 28 17:55 nagios.log
-rw-rw-r-- 1 nagios nagios 800315 Dez 22  2013 nagios.tmpF9wsQZ
-rw-r--r-- 1 nagios nagios      5 Mär 26 21:52 ndo2db.lock
-rw-r--r-- 1 nagios nagios      0 Mär 26 22:42 ndomod.tmp
srwxr-xr-x 1 nagios nagios      0 Mär 26 21:52 ndo.sock
-rw-r--r-- 1 nagios nagios 593633 Mär 26 22:43 objects.cache
-rw------- 1 nagios nagios 979561 Mär 28 17:44 retention.dat
drwxrwsr-x 2 nagios nagcmd   4096 Mär 26 22:44 rw
drwxr-xr-x 3 root   root     4096 Dez 20  2013 spool
-rw-rw-r-- 1 nagios nagios 974973 Mär 28 17:56 status.dat

Code: Select all

nagios@XXX:~$ ls -la /usr/local/nagios/var/objects.cache
-rw-r--r-- 1 nagios nagios 593633 Mär 26 22:43 /usr/local/nagios/var/objects.cache
Is this what you are asking for?
scottwilkerson
DevOps Engineer
Posts: 19396
Joined: Tue Nov 15, 2011 3:11 pm
Location: Nagios Enterprises
Contact:

Re: Nagios Service is working but Webinterface shows Error

Post by scottwilkerson »

There is one permission change you should make

Code: Select all

chown nagios.nagios /usr/local/nagios
I don't believe that will fix it though, can you send the output of the following:

Code: Select all

ps -ef
Former Nagios employee
Creator:
ahumandesign.com
enneagrams.com
ardstr
Posts: 8
Joined: Mon Mar 26, 2018 3:15 pm

Re: Nagios Service is working but Webinterface shows Error

Post by ardstr »

I made the premssion change on /usr/local/nagios, but it is still not working..

Code: Select all

nagios@XXXX:~$ ls -la /usr/local/
insgesamt 56
drwxr-xr-x 14 root     root     4096 Aug 28  2014 .
drwxr-xr-x 11 root     root     4096 Mai 21  2014 ..
drwxr-xr-x  2 root     root     4096 Aug 28  2014 bin
drwxr-xr-x  2 root     root     4096 Dez 20  2013 etc
drwxr-xr-x  2 root     root     4096 Dez 20  2013 games
drwxr-xr-x  2 root     root     4096 Dez 20  2013 include
drwxr-xr-x  5 root     root     4096 Aug 26  2014 lib
lrwxrwxrwx  1 root     root        9 Dez 20  2013 man -> share/man
drwxr-xr-x  9 nagios   nagios   4096 Mai 21  2014 nagios
drwxr-xr-x  5 www-data www-data 4096 Aug 28  2014 nagvis
drwxrwxr-x  2 nagios   nagios   4096 Aug 28  2014 nagvis_broken
drwxr-xr-x  2 root     root     4096 Mai 21  2014 oracle
drwxr-xr-x  2 root     root     4096 Dez 20  2013 sbin
drwxr-xr-x  7 root     root     4096 Aug 26  2014 share
drwxr-xr-x  2 root     root     4096 Dez 20  2013 src

Code: Select all

nagios@XXXX:~$ ps -ef
UID        PID  PPID  C STIME TTY          TIME CMD
root         1     0  0 Mär26 ?       00:00:01 /sbin/init
root         2     0  0 Mär26 ?       00:00:00 [kthreadd]
root         3     2  0 Mär26 ?       00:00:00 [ksoftirqd/0]
root         4     2  0 Mär26 ?       00:00:00 [kworker/0:0]
root         5     2  0 Mär26 ?       00:00:00 [kworker/0:0H]
root         7     2  0 Mär26 ?       00:00:25 [rcu_sched]
root         8     2  0 Mär26 ?       00:00:14 [rcuos/0]
root         9     2  0 Mär26 ?       00:00:15 [rcuos/1]
root        10     2  0 Mär26 ?       00:00:00 [rcu_bh]
root        11     2  0 Mär26 ?       00:00:00 [rcuob/0]
root        12     2  0 Mär26 ?       00:00:00 [rcuob/1]
root        13     2  0 Mär26 ?       00:00:02 [migration/0]
root        14     2  0 Mär26 ?       00:00:00 [watchdog/0]
root        15     2  0 Mär26 ?       00:00:00 [watchdog/1]
root        16     2  0 Mär26 ?       00:00:03 [migration/1]
root        17     2  0 Mär26 ?       00:00:00 [ksoftirqd/1]
root        19     2  0 Mär26 ?       00:00:00 [kworker/1:0H]
root        20     2  0 Mär26 ?       00:00:00 [khelper]
root        21     2  0 Mär26 ?       00:00:00 [kdevtmpfs]
root        22     2  0 Mär26 ?       00:00:00 [netns]
root        23     2  0 Mär26 ?       00:00:00 [writeback]
root        24     2  0 Mär26 ?       00:00:00 [kintegrityd]
root        25     2  0 Mär26 ?       00:00:00 [bioset]
root        26     2  0 Mär26 ?       00:00:00 [kworker/u5:0]
root        27     2  0 Mär26 ?       00:00:00 [kblockd]
root        28     2  0 Mär26 ?       00:00:00 [ata_sff]
root        29     2  0 Mär26 ?       00:00:00 [khubd]
root        30     2  0 Mär26 ?       00:00:00 [md]
root        31     2  0 Mär26 ?       00:00:00 [devfreq_wq]
root        32     2  0 Mär26 ?       00:00:05 [kworker/0:1]
root        34     2  0 Mär26 ?       00:00:00 [khungtaskd]
root        35     2  0 Mär26 ?       00:00:00 [kswapd0]
root        36     2  0 Mär26 ?       00:00:00 [ksmd]
root        37     2  0 Mär26 ?       00:00:01 [khugepaged]
root        38     2  0 Mär26 ?       00:00:00 [fsnotify_mark]
root        39     2  0 Mär26 ?       00:00:00 [ecryptfs-kthrea]
root        40     2  0 Mär26 ?       00:00:00 [crypto]
root        52     2  0 Mär26 ?       00:00:00 [kthrotld]
root        54     2  0 Mär26 ?       00:00:08 [kworker/1:1]
root        55     2  0 Mär26 ?       00:00:00 [scsi_eh_0]
root        56     2  0 Mär26 ?       00:00:00 [scsi_eh_1]
root        77     2  0 Mär26 ?       00:00:00 [deferwq]
root        78     2  0 Mär26 ?       00:00:00 [charger_manager]
root       127     2  0 Mär26 ?       00:00:00 [mpt_poll_0]
root       129     2  0 Mär26 ?       00:00:00 [kpsmoused]
root       130     2  0 Mär26 ?       00:00:00 [scsi_eh_2]
root       131     2  0 Mär26 ?       00:00:00 [mpt/0]
root       132     2  0 Mär26 ?       00:00:00 [scsi_eh_3]
root       133     2  0 Mär26 ?       00:00:00 [scsi_eh_4]
root       134     2  0 Mär26 ?       00:00:00 [scsi_eh_5]
root       135     2  0 Mär26 ?       00:00:00 [scsi_eh_6]
root       136     2  0 Mär26 ?       00:00:00 [scsi_eh_7]
root       137     2  0 Mär26 ?       00:00:00 [scsi_eh_8]
root       138     2  0 Mär26 ?       00:00:00 [scsi_eh_9]
root       139     2  0 Mär26 ?       00:00:00 [scsi_eh_10]
root       140     2  0 Mär26 ?       00:00:00 [scsi_eh_11]
root       141     2  0 Mär26 ?       00:00:00 [scsi_eh_12]
root       142     2  0 Mär26 ?       00:00:00 [scsi_eh_13]
root       143     2  0 Mär26 ?       00:00:00 [scsi_eh_14]
root       144     2  0 Mär26 ?       00:00:00 [scsi_eh_15]
root       145     2  0 Mär26 ?       00:00:00 [scsi_eh_16]
root       146     2  0 Mär26 ?       00:00:00 [scsi_eh_17]
root       147     2  0 Mär26 ?       00:00:00 [scsi_eh_18]
root       148     2  0 Mär26 ?       00:00:00 [scsi_eh_19]
root       149     2  0 Mär26 ?       00:00:00 [scsi_eh_20]
root       150     2  0 Mär26 ?       00:00:00 [scsi_eh_21]
root       151     2  0 Mär26 ?       00:00:00 [scsi_eh_22]
root       152     2  0 Mär26 ?       00:00:00 [scsi_eh_23]
root       153     2  0 Mär26 ?       00:00:00 [scsi_eh_24]
root       154     2  0 Mär26 ?       00:00:00 [scsi_eh_25]
root       155     2  0 Mär26 ?       00:00:00 [scsi_eh_26]
root       156     2  0 Mär26 ?       00:00:00 [scsi_eh_27]
root       157     2  0 Mär26 ?       00:00:00 [scsi_eh_28]
root       158     2  0 Mär26 ?       00:00:00 [scsi_eh_29]
root       159     2  0 Mär26 ?       00:00:00 [scsi_eh_30]
root       160     2  0 Mär26 ?       00:00:00 [scsi_eh_31]
root       189     2  0 Mär26 ?       00:00:00 [scsi_eh_32]
root       198     2  0 Mär26 ?       00:00:00 [kdmflush]
root       199     2  0 Mär26 ?       00:00:00 [bioset]
root       201     2  0 Mär26 ?       00:00:00 [kdmflush]
root       202     2  0 Mär26 ?       00:00:00 [bioset]
root       217     2  0 Mär26 ?       00:00:05 [jbd2/dm-0-8]
root       218     2  0 Mär26 ?       00:00:00 [ext4-rsv-conver]
root       351     1  0 Mär26 ?       00:00:00 upstart-udev-bridge --daemon
root       371     1  0 Mär26 ?       00:00:00 /lib/systemd/systemd-udevd --daemon
root       393     2  0 Mär26 ?       00:00:00 [ext4-rsv-conver]
root       434     2  0 Mär26 ?       00:00:00 [rpciod]
root       450     2  0 Mär26 ?       00:00:00 [nfsiod]
root       459     2  0 Mär26 ?       00:00:00 [ttm_swap]
message+   460     1  0 Mär26 ?       00:00:00 dbus-daemon --system --fork
root       481     1  0 Mär26 ?       00:00:00 /lib/systemd/systemd-logind
root       483     1  0 Mär26 ?       00:00:00 rpc.idmapd
syslog     488     1  0 Mär26 ?       00:00:00 rsyslogd
root       496     1  0 Mär26 ?       00:00:00 upstart-file-bridge --daemon
root       702     1  0 Mär26 ?       00:00:00 rpcbind
statd      779     1  0 Mär26 ?       00:00:00 rpc.statd -L
root       888     1  0 Mär26 ?       00:00:00 upstart-socket-bridge --daemon
root       987     2  0 Mär26 ?       00:00:00 [kauditd]
root      1000     1  0 Mär26 tty4    00:00:00 /sbin/getty -8 38400 tty4
root      1004     1  0 Mär26 tty5    00:00:00 /sbin/getty -8 38400 tty5
root      1009     1  0 Mär26 tty2    00:00:00 /sbin/getty -8 38400 tty2
root      1010     1  0 Mär26 tty3    00:00:00 /sbin/getty -8 38400 tty3
root      1013     1  0 Mär26 tty6    00:00:00 /sbin/getty -8 38400 tty6
root      1029     1  0 Mär26 ?       00:00:00 cron
daemon    1034     1  0 Mär26 ?       00:00:00 atd
root      1043     1  0 Mär26 ?       00:00:00 /usr/sbin/sshd -D
root      1094     1  0 Mär26 ?       00:00:00 acpid -c /etc/acpi/events -s /var/run/acpid.socket
root      1114     1  0 Mär26 ?       00:00:12 /usr/sbin/irqbalance
mysql     1136     1  0 Mär26 ?       00:13:16 /usr/sbin/mysqld
Debian-+  1380     1  0 Mär26 ?       00:00:00 /usr/sbin/exim4 -bd -q30m
whoopsie  1477     1  0 Mär26 ?       00:00:00 whoopsie
root      1479     2  0 12:21 ?        00:00:00 [kworker/u5:1]
root      1492     1  0 Mär26 ?       00:00:05 /usr/sbin/apache2 -k start
ntp       1882     1  0 Mär26 ?       00:00:08 /usr/sbin/ntpd -p /var/run/ntpd.pid -g -u 111:121
root      3251     2  0 17:49 ?        00:00:00 [kworker/u4:0]
www-data  5446  1492  0 18:00 ?        00:00:02 /usr/sbin/apache2 -k start
root      6793  1043  0 20:53 ?        00:00:00 sshd: nagios [priv]
nagios    6909  6793  0 20:53 ?        00:00:00 sshd: nagios@pts/0
nagios    6910  6909  0 20:53 pts/0    00:00:00 -bash
nagios    7354     1  0 20:55 ?        00:00:00 /usr/local/nagios/bin/nagios -d /usr/local/nagios/etc/nagios.cfg
nagios    7355  7354  0 20:55 ?        00:00:00 /usr/local/nagios/bin/nagios --worker /usr/local/nagios/var/rw/nagios.qh
nagios    7356  7354  0 20:55 ?        00:00:00 /usr/local/nagios/bin/nagios --worker /usr/local/nagios/var/rw/nagios.qh
nagios    7357  7354  0 20:55 ?        00:00:00 /usr/local/nagios/bin/nagios --worker /usr/local/nagios/var/rw/nagios.qh
nagios    7358  7354  0 20:55 ?        00:00:00 /usr/local/nagios/bin/nagios --worker /usr/local/nagios/var/rw/nagios.qh
nagios    7384  7354  0 20:56 ?        00:00:00 /usr/local/nagios/bin/nagios -d /usr/local/nagios/etc/nagios.cfg
nagios    7387     1  0 20:56 ?        00:00:00 /usr/local/nagios/bin/ndo2db -c /usr/local/nagios/etc/ndo2db.cfg
nagios    7549  7387  0 20:56 ?        00:00:00 /usr/local/nagios/bin/ndo2db -c /usr/local/nagios/etc/ndo2db.cfg
nagios    7550  7549  0 20:56 ?        00:00:00 /usr/local/nagios/bin/ndo2db -c /usr/local/nagios/etc/ndo2db.cfg
nagios    7555  6910  0 20:57 pts/0    00:00:00 ps -ef
root      8497     2  0 Mär26 ?       00:00:00 [kworker/1:0]
www-data 10754  1492  0 Mär27 ?       00:00:19 /usr/sbin/apache2 -k start
root     12366     1  0 Mär27 tty1    00:00:00 /sbin/getty -8 38400 tty1
www-data 14709  1492  0 Mär27 ?       00:00:25 /usr/sbin/apache2 -k start
www-data 14710  1492  0 Mär27 ?       00:00:24 /usr/sbin/apache2 -k start
www-data 14711  1492  0 Mär27 ?       00:00:25 /usr/sbin/apache2 -k start
www-data 14712  1492  0 Mär27 ?       00:00:24 /usr/sbin/apache2 -k start
www-data 14713  1492  0 Mär27 ?       00:00:25 /usr/sbin/apache2 -k start
www-data 14715  1492  0 Mär27 ?       00:00:24 /usr/sbin/apache2 -k start
www-data 14716  1492  0 Mär27 ?       00:00:24 /usr/sbin/apache2 -k start
www-data 15317  1492  0 Mär27 ?       00:00:26 /usr/sbin/apache2 -k start
root     31830     2  0 17:30 ?        00:00:00 [kworker/u4:1]
scottwilkerson
DevOps Engineer
Posts: 19396
Joined: Tue Nov 15, 2011 3:11 pm
Location: Nagios Enterprises
Contact:

Re: Nagios Service is working but Webinterface shows Error

Post by scottwilkerson »

one more permissions check

Code: Select all

ls -la /usr/local/nagios/var/rw
Former Nagios employee
Creator:
ahumandesign.com
enneagrams.com
ardstr
Posts: 8
Joined: Mon Mar 26, 2018 3:15 pm

Re: Nagios Service is working but Webinterface shows Error

Post by ardstr »

Code: Select all

nagios@XXXX:~$ ls -la /usr/local/nagios/var/rw
insgesamt 8
drwxrwsr-x 2 nagios nagcmd 4096 Mär 28 21:02 .
drwxrw-rw- 5 nagios nagios 4096 Mär 28 22:06 ..
prw-rw---- 1 nagios nagcmd    0 Mär 28 21:02 nagios.cmd
srw-rw---- 1 nagios nagcmd    0 Mär 28 21:00 nagios.qh
Here it is :)
scottwilkerson
DevOps Engineer
Posts: 19396
Joined: Tue Nov 15, 2011 3:11 pm
Location: Nagios Enterprises
Contact:

Re: Nagios Service is working but Webinterface shows Error

Post by scottwilkerson »

Has apache been restarted after adding the user to the groups?

Also have you watched the apache error log to see if the error is showing up when you access the page?
Former Nagios employee
Creator:
ahumandesign.com
enneagrams.com
Locked