Page 1 of 3

Errors adding and removing hosts

Posted: Wed Jan 30, 2019 3:16 pm
by JohnF
To start here is the Nagios configuration we have:

1. Linux Distribution and version? CentOS 6.10

2. 32 or 64bit? 64bit

3. VMware Image or Manual Install of XI? The server is running on a VM but as far as we know it was a manual installation.

4. Are there special configurations on your system, ie; is Gnome installed? No. Are you using a proxy? Are you using SSL?
As far as we see there is no special configuration. No proxy, we could not find ssl-certificate on OS side.

5. Nagios Version? Nagios XI 2011R3.1


For the past couple of months, we've been experiencing some issues when adding and removing hosts from Nagios, no we have removed some host and on the Core Config Manager they were removed with are still showing under monitoring and can still be found in Nagios.

Could you please assist?

Re: Errors adding and removing hosts

Posted: Wed Jan 30, 2019 3:33 pm
by lmiltchev
You may have multiple nagios processes running or "ghost" hosts/services. Please review our KB article on the topic here:

https://support.nagios.com/kb/article/n ... ts-27.html

Note: You are running a VERY old version of Nagios XI. I would recommend upgrading to the latest XI version as soon as you fix your issues. There have been many bug fixes, and added features in the new versions of XI. Here's the changelog:

https://www.nagios.com/downloads/nagios-xi/change-log/

Re: Errors adding and removing hosts

Posted: Wed Jan 30, 2019 4:52 pm
by JohnF
I tried running the fix for CentOS 6 on the KB and got the following message:

Code: Select all

[jfonseca@ussecis021 ~]$ service nagios stop
chown: changing ownership of `/var/nagiosramdisk/checkresults': Operation not permitted
chown: changing ownership of `/var/nagiosramdisk/spool': Operation not permitted
chown: changing ownership of `/var/nagiosramdisk/tmp': Operation not permitted
chown: changing ownership of `/var/nagiosramdisk': Operation not permitted
Stopping nagios: /etc/init.d/nagios: line 75: kill: (52589) - Operation not permitted
..........
Warning - nagios did not exit in a timely manner
rm: cannot remove `/usr/local/nagios/var/status.dat': Permission denied
rm: cannot remove `/usr/local/nagios/var/nagios.lock': Permission denied
rm: cannot remove `/usr/local/nagiosxi/var/subsys/nagios': Permission denied
rm: cannot remove `/usr/local/nagios/var/rw/nagios.cmd': Permission denied
[jfonseca@ussecis021 ~]$ killall nagios
nagios(37944): Operation not permitted
nagios(37945): Operation not permitted
nagios(37946): Operation not permitted
nagios(37947): Operation not permitted
nagios(37948): Operation not permitted
nagios(37949): Operation not permitted
nagios(37950): Operation not permitted
nagios(37951): Operation not permitted
nagios(37955): Operation not permitted
nagios(52589): Operation not permitted
nagios: no process killed
[jfonseca@ussecis021 ~]$ service nagios start
chown: changing ownership of `/var/nagiosramdisk/checkresults': Operation not permitted
chown: changing ownership of `/var/nagiosramdisk/spool': Operation not permitted
chown: changing ownership of `/var/nagiosramdisk/tmp': Operation not permitted
chown: changing ownership of `/var/nagiosramdisk': Operation not permitted
Starting nagios:CONFIG ERROR!  Start aborted.  Check your Nagios configuration.
[jfonseca@ussecis021 ~]$

Then U tried running the second option of removing the ghost configs and got: 

[jfonseca@ussecis021 hosts]$ rm -f <ghost config>
-bash: syntax error near unexpected token `newline' 

Re: Errors adding and removing hosts

Posted: Wed Jan 30, 2019 5:24 pm
by ssax
Please attach your /etc/init.d/nagios so that we can take a look at it.

Re: Errors adding and removing hosts

Posted: Wed Jan 30, 2019 5:30 pm
by JohnF
I got the following:


[jfonseca@ussecis021 ~]$ /etc/init.d/nagios
chown: changing ownership of `/var/nagiosramdisk/checkresults': Operation not permitted
chown: changing ownership of `/var/nagiosramdisk/spool': Operation not permitted
chown: changing ownership of `/var/nagiosramdisk/tmp': Operation not permitted
chown: changing ownership of `/var/nagiosramdisk': Operation not permitted
Usage: nagios {start|stop|restart|reload|force-reload|status|checkconfig}
[jfonseca@ussecis021 ~]$

Re: Errors adding and removing hosts

Posted: Wed Jan 30, 2019 5:45 pm
by lmiltchev
Actually, @ssax wanted you to upload the /etc/init.d/nagios file on the forum, so that we could take a look at it. Please post the /etc/init.d/nagios, and also show the output of the following commands:

Code: Select all

sestatus
umask
/usr/local/nagios/bin/nagios -v /usr/local/nagios/etc/nagios.cfg
ls -lad /var/nagiosramdisk
ls -la /var/nagiosramdisk
ls -la /var/nagiosramdisk/spool
ps -ef | grep nagios.cfg | grep -v grep

Re: Errors adding and removing hosts

Posted: Wed Jan 30, 2019 6:18 pm
by JohnF
Attached is the file and below you can see the output of the request commands:

[jfonseca@ussecis021 ~]$ sestatus
SELinux status: disabled
[jfonseca@ussecis021 ~]$ umask
0002
[jfonseca@ussecis021 ~]$ /usr/local/nagios/bin/nagios -v /usr/local/nagios/etc/nagios.cfg
-bash: /usr/local/nagios/bin/nagios: Permission denied
[jfonseca@ussecis021 ~]$ ls -lad /var/nagiosramdisk
drwxrwxrwt 5 nagios nagios 100 Dec 19 04:12 /var/nagiosramdisk
[jfonseca@ussecis021 ~]$ ls -la /var/nagiosramdisk
total 4
drwxrwxrwt 5 nagios nagios 100 Dec 19 04:12 .
drwxr-xr-x. 21 root root 4096 Aug 9 2012 ..
drwxrwxr-x 2 nagios nagios 40 Dec 19 04:12 checkresults
drwxrwxr-x 2 nagios nagios 40 Dec 19 04:12 spool
drwxrwxr-x 2 nagios nagios 40 Dec 19 04:12 tmp
[jfonseca@ussecis021 ~]$ ls -la /var/nagiosramdisk/spool
total 0
drwxrwxr-x 2 nagios nagios 40 Dec 19 04:12 .
drwxrwxrwt 5 nagios nagios 100 Dec 19 04:12 ..
[jfonseca@ussecis021 ~]$ ps -ef | grep nagios.cfg | grep -v grep
nagios 38382 1 1 17:16 ? 00:00:54 /usr/local/nagios/bin/nagios -d /usr/local/nagios/etc/nagios .cfg
nagios 49208 38382 0 18:16 ? 00:00:00 /usr/local/nagios/bin/nagios -d /usr/local/nagios/etc/nagios .cfg
nagios 49981 38382 0 18:16 ? 00:00:00 /usr/local/nagios/bin/nagios -d /usr/local/nagios/etc/nagios .cfg
nagios 49982 38382 0 18:16 ? 00:00:00 /usr/local/nagios/bin/nagios -d /usr/local/nagios/etc/nagios .cfg
nagios 49983 38382 0 18:16 ? 00:00:00 /usr/local/nagios/bin/nagios -d /usr/local/nagios/etc/nagios .cfg
nagios 50501 38382 0 18:17 ? 00:00:00 /usr/local/nagios/bin/nagios -d /usr/local/nagios/etc/nagios .cfg
nagios 50517 38382 0 18:17 ? 00:00:00 /usr/local/nagios/bin/nagios -d /usr/local/nagios/etc/nagios .cfg
[jfonseca@ussecis021 ~]$

Re: Errors adding and removing hosts

Posted: Thu Jan 31, 2019 9:48 am
by lmiltchev
Did you forget to to upload the /etc/init.d/nagios file on the forum?

Run the following commands as root and show the output:

Code: Select all

/usr/local/nagios/bin/nagios -v /usr/local/nagios/etc/nagios.cfg
ls -la /usr/local/nagios /usr/local/nagios/bin /usr/local/nagios/bin/nagios  /usr/local/nagios/etc/
grep nag /etc/group

Re: Errors adding and removing hosts

Posted: Thu Jan 31, 2019 1:40 pm
by JohnF
Attached is the file and below the command requested.

Code: Select all

[jfonseca@ussecis021 ~]$ ls -la /usr/local/nagios /usr/local/nagios/bin /usr/local/nagios/bin/nagios  /usr/local/nagios/etc/
-rwxrwxr--. 1 nagios nagios 627440 Jun  6  2012 /usr/local/nagios/bin/nagios

/usr/local/nagios:
total 32
drwxr-xr-x.  8 root   root   4096 Jul  9  2013 .
drwxr-xr-x. 15 root   root   4096 Jun 26  2013 ..
drwxrwxr-x.  2 nagios nagios 4096 Jan 29  2015 bin
drwsrwsr-x.  9 apache nagios 4096 Jan 28 14:57 etc
drwxrwxr-x.  2 nagios nagios 4096 Oct  5  2015 libexec
drwxrwxr-x.  2 nagios nagios 4096 Jun  6  2012 sbin
drwxrwxr-x. 13 nagios nagios 4096 Jun  6  2012 share
drwxrwxr-x.  6 nagios nagios 4096 Jan 31 13:38 var

/usr/local/nagios/bin:
total 1500
drwxrwxr-x. 2 nagios nagios   4096 Jan 29  2015 .
drwxr-xr-x. 8 root   root     4096 Jul  9  2013 ..
-rwxr-xr-x. 1 root   root    40049 Jun  6  2012 file2sock
-rwxr-xr-x. 1 root   root    41775 Jun  6  2012 log2ndo
-rwxrwxr--. 1 nagios nagios 627440 Jun  6  2012 nagios
-rwxrwxr--. 1 nagios nagios  44064 Jun  6  2012 nagiostats
-rwxr-xr-x. 1 root   root   278961 Jun  6  2012 ndo2db
-rwxr-xr-x. 1 root   root   153984 Jun  6  2012 ndomod.o
-rwxr-xr--. 1 nagios nagios  26400 Jun  6  2012 npcd
-rwxr-xr--. 1 nagios nagios  13024 Jun  6  2012 npcdmod.o
-rwxrwxr-x. 1 nagios nagios 119852 Jun  6  2012 nrpe
-rwxr-xr-x. 1 root   root   119325 Jun  6  2012 nsca
-rwxr-xr-x. 1 root   root    36165 Jun  6  2012 sockdebug

/usr/local/nagios/etc/:
total 536
drwsrwsr-x. 9 apache nagios   4096 Jan 28 14:57 .
drwxr-xr-x. 8 root   root     4096 Jul  9  2013 ..
drwxrwsr-x  3 apache nagios   4096 Jun  3  2012 cfgprep
-rw-rw-r--  1 apache nagios   3665 Sep 19 14:25 cgi.cfg
-rw-rw-r--  1 apache nagios  39858 Jan 30 17:16 commands.cfg
-rw-rw-r--  1 apache nagios   4145 Jan 30 17:16 contactgroups.cfg
-rw-rw-r--  1 apache nagios  25822 Jan 30 17:16 contacts.cfg
-rw-rw-r--  1 apache nagios   1536 Jan 30 17:16 contacttemplates.cfg
-rw-rw-r--  1 apache nagios    642 Jan 30 17:16 hostdependencies.cfg
-rw-rw-r--  1 apache nagios    644 Jan 30 17:16 hostescalations.cfg
-rw-rw-r--  1 apache nagios    662 Jan 30 17:16 hostextinfo.cfg
-rw-rw-r--  1 apache nagios   6073 Jan 30 17:16 hostgroups.cfg
drwsrwsr-x. 2 apache nagios 122880 Jan 29 01:30 hosts
-rw-rw-r--  1 apache nagios  22639 Jan 30 17:16 hosttemplates.cfg
drwsrwsr-x. 2 apache nagios   4096 Nov  7 13:54 import
-rw-rw-r--  1 apache nagios   5978 Jul  9  2013 nagios.cfg
-rw-rw-r--  1 apache nagios   2229 Jun  6  2012 ndo2db.cfg
-rw-rw-r--  1 apache nagios   4723 Jun  6  2012 ndomod.cfg
-rw-rw-r--  1 apache nagios   7207 Jun  6  2012 nrpe.cfg
-rw-rw-r--  1 apache nagios   5345 Jun  6  2012 nsca.cfg
drwxrwxr-x  3 apache nagios   4096 Jan 28 14:57 objects
-rw-rw-r--  1 apache nagios 131163 Aug  9  2012 object.tar.gz
drwxrwsr-x. 4 apache nagios   4096 Jan 28 14:57 pnp
-rw-rw-r--  1 apache nagios      0 Nov  7  2012 recurringdowntime.cfg
-rwxrwxr-x  1 apache nagios    224 Aug  9  2012 resource.cfg
-rw-rw-r--  1 apache nagios     64 Aug 25  2012 send_nsca-192.168.0.1.cfg
-rw-rw-r--  1 apache nagios   1627 Jun  6  2012 send_nsca.cfg
-rw-rw-r--  1 apache nagios    648 Jan 30 17:16 servicedependencies.cfg
-rw-rw-r--  1 apache nagios    650 Jan 30 17:16 serviceescalations.cfg
-rw-rw-r--  1 apache nagios    668 Jan 30 17:16 serviceextinfo.cfg
-rw-rw-r--  1 apache nagios    638 Jan 30 17:16 servicegroups.cfg
drwsrwsr-x. 2 apache nagios   4096 Jan 28 14:57 services
-rw-rw-r--  1 apache nagios  22365 Jan 30 17:16 servicetemplates.cfg
drwsrwsr-x. 2 apache nagios   4096 Jan 28 14:57 static
-rw-rw-r--  1 apache nagios  30282 Jan 30 17:16 timeperiods.cfg
[jfonseca@ussecis021 ~]$
[jfonseca@ussecis021 ~]$ grep nag /etc/group
nagios:x:500:nagios,apache
nagcmd:x:501:nagios,apache
[jfonseca@ussecis021 ~]$

Re: Errors adding and removing hosts

Posted: Thu Jan 31, 2019 3:31 pm
by lmiltchev
One more thing - let's see the nagios init file. Show the output of the following command:

Code: Select all

cat /etc/init.d/nagios
Go to the Nagios XI web UI, log into the CCM, click on the "Write Config Files" link under the "Tools" menu on the left, and click on all "Go" buttons.
example01.PNG
Show us screenshots of the page after each click.

Is opening a support ticket is an option for you? It may be easier/faster to do a remote and fix your issue that way. You can open a new support ticket via our support center here:

https://support.nagios.com/tickets/