Page 1 of 2

No Hosts/Services/Contacts error

Posted: Wed Sep 02, 2020 11:52 am
by hbouma
We have Nagios XI 5.6.10 running on RHEL 7 VMs.

When I attempt to apply a new configuration, I get the following error:

Error: There are no services defined!
Error: There are no hosts defined!
Error: There are no contacts defined!

I can view the hosts/services in the DB, and the configuration files for them are on the server.
I can also see the services in the DB.

However, a bunch of the configuration files are blank on the server

Code: Select all

[/usr/local/nagios/etc]
$ ll
total 48K
drwxrwxr-x.  8 apache nagios 4.0K Sep  2 12:00 .
drwxr-xr-x  10 root   root   4.0K Oct 15  2018 ..
-rw-rw-r--   1 apache nagios    0 Sep  2 04:30 cgi.cfg
-rw-rw-r--   1 apache nagios    0 Sep  2 11:02 commands.cfg
-rw-rw-r--   1 apache nagios    0 Sep  2 11:02 contactgroups.cfg
-rw-rw-r--   1 apache nagios    0 Sep  2 11:02 contacts.cfg
-rw-rw-r--   1 apache nagios    0 Sep  2 11:02 contacttemplates.cfg
-rw-rw-r--   1 apache nagios    0 Sep  2 11:02 hostdependencies.cfg
-rw-rw-r--   1 apache nagios    0 Sep  2 11:02 hostescalations.cfg
-rw-rw-r--   1 apache nagios    0 Sep  2 11:02 hostextinfo.cfg
-rw-rw-r--   1 apache nagios    0 Sep  2 11:02 hostgroups.cfg
drwxrwxr-x.  2 apache nagios 4.0K Sep  2 11:57 hosts
-rw-rw-r--   1 apache nagios    0 Sep  2 11:02 hosttemplates.cfg
drwxrwxr-x.  2 apache nagios 4.0K Sep  2 11:59 import
-rw-rw-r--   1 apache nagios    0 Sep  2 11:57 nagios.cfg
-rw-rw-r--   1 apache nagios 5.6K Sep  2 11:29 nagios.log
-rw-rw-r--   1 apache nagios    0 Jun  1  2018 ndo2db.bak
-rw-rw-r--   1 apache nagios    0 Nov 28  2018 ndo2db.cfg
-rw-rw-r--   1 apache nagios    0 Nov 28  2018 ndomod.cfg
-rw-rw-r--   1 apache nagios    0 Jul 23  2018 nrpe.cfg
-rw-rw-r--   1 apache nagios    0 Jun 26  2018 nrpe.cfg.old
-rw-rw-r--   1 apache nagios 5.3K Jun 20  2018 nsca.cfg
drwxrwxr-x.  4 apache nagios 4.0K Sep  2 11:57 pnp
-rw-rw-r--   1 apache nagios    0 Nov 29  2018 recurringdowntime.cfg
-rw-rw-r--   1 apache nagios    0 Apr  9  2018 resource.cfg
-rw-rw-r--   1 apache nagios    0 Aug 27 04:33 sedkWKH3S
-rw-rw-r--   1 apache nagios    0 Sep  2 10:53 sedPoBMRf
-rw-rw-r--   1 apache nagios    0 Apr  9  2018 send_nsca.cfg
-rw-rw-r--   1 apache nagios    0 Sep  2 11:02 servicedependencies.cfg
-rw-rw-r--   1 apache nagios    0 Sep  2 11:02 serviceescalations.cfg
-rw-rw-r--   1 apache nagios    0 Sep  2 11:02 serviceextinfo.cfg
-rw-rw-r--   1 apache nagios    0 Sep  2 11:02 servicegroups.cfg
drwxrwxr-x.  2 apache nagios 4.0K Sep  2 11:57 services
-rw-rw-r--   1 apache nagios    0 Sep  2 11:02 servicetemplates.cfg
drwxrwxr-x.  5 apache nagios 4.0K Sep  2 11:57 ssl
drwxrwxr-x.  2 apache nagios 4.0K Sep  2 11:57 static
-rw-rw-r--   1 apache nagios    0 Sep  2 11:02 timeperiods.cfg
When I look at the snapshot, these same files are blank.

Every time I try deleting the files from the GUI and writing them, they come back blank.
If I try importing them into the DB from a good snapshot through the GUI, it says it completes, then comes back blank when I delete/write or when I try to apply a new configuration.

I have also attempted to restore from a snapshot, but I still can't write any changes.

Any suggestions would be appreciated.


I have run repair_database and it comes back and says no problems found.
I have tried reconfigure_nagios and it comes back warning that no Contacts/Services/Hosts are found, even though I see them in the GUI and in the Database.

Re: No Hosts/Services/Contacts error

Posted: Wed Sep 02, 2020 12:35 pm
by hbouma
To be honest, this is a DEV server, only used to test adding new servers in and make sure all the monitoring works prior to moving them to PRD. If someone could even tell me how to clear everything out and let me start with a blank slate, that would work also.

Re: No Hosts/Services/Contacts error

Posted: Thu Sep 03, 2020 10:15 am
by cdienger
You can restore the CCM to a default config by running:

Code: Select all

/usr/local/nagiosxi/scripts/restore_defaults.sh

Re: No Hosts/Services/Contacts error

Posted: Thu Sep 03, 2020 2:15 pm
by hbouma
Unfortunately, that didn't work. Everything still shows present.


========================
Nagios XI Reset Defaults
========================
WARNING: This script will reset all of your configurations to
the defaults set after a clean install of Nagios XI.
Are you sure you want to continue? [y/N] y
Proceeding with reset...

--- reset_config_perms.sh ------------
> Setting script permissions
> Setting CCM script permissions
> Setting special script permissions
> Setting special component script permissions
> Setting configuration file/directory permissions
> Setting perfdata directory and RRD permissions
> Setting libexec directory permissions
> Setting Nagios XI config permissions
> Setting NOM checkpoint user:group permissions
> + Setting Nagios Core corelog.newobjects user:group permissions
> + Setting CCM configuration file user:group permissions
> + Setting Recurring Downtime file user:group permissions
> + Setting BPI configuration file user:group permissions
--------------------------------------

--- ccm_import.php -------------------
> Setting import directory: /usr/local/nagios/etc/import/
> Importing config files into the CCM
No files to import
--------------------------------------

--- ccm_export.php -------------------
> Writing CCM configuration to Nagios files
Finished writing out configuraton
--------------------------------------

--------------------------------------
> Verifying configuration with Nagios Core
> Output:
Nagios Core 4.4.5
Copyright (c) 2009-present Nagios Core Development Team and Community Contributors
Copyright (c) 1999-2009 Ethan Galstad
Last Modified: 2019-08-20
License: GPL

Website: https://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...
Error: There are no services defined!
Checked 0 services.
Error: There are no hosts defined!
Checked 0 hosts.
Checked 0 host groups.
Checked 0 service groups.
Error: There are no contacts defined!
Checked 0 contacts.
Checked 0 contact groups.
Checked 0 commands.
Checked 0 time periods.
Checked 0 host escalations.
Checked 0 service escalations.
Checking for circular paths...
Checked 0 hosts
Checked 0 service dependencies
Checked 0 host dependencies
Checked 0 timeperiods
Checking global event handlers...
Checking obsessive compulsive processor commands...
Checking misc settings...
Warning: Nothing specified for illegal_macro_output_chars variable!

Total Warnings: 1
Total Errors: 3

***> 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 definitions. 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.
> Return Code: 1
--------------------------------------
/usr/local/nagiosxi/nom/checkpoints/nagioscore/errors /usr/local/nagiosxi/scripts
tar: Removing leading `/' from member names
/usr/local/nagiosxi/scripts
LATEST NOM SNAPSHOT: /usr/local/nagiosxi/nom/checkpoints/nagioscore/1599059114.tar.gz
/ /usr/local/nagiosxi/scripts
RESTORING NOM SNAPSHOT : /usr/local/nagiosxi/nom/checkpoints/nagioscore/1599059114.tar.gz
/usr/local/nagiosxi/scripts

--- reset_config_perms.sh ------------
> Setting script permissions
> Setting CCM script permissions
> Setting special script permissions
> Setting special component script permissions
> Setting configuration file/directory permissions
> Setting perfdata directory and RRD permissions
> Setting libexec directory permissions
> Setting Nagios XI config permissions
> Setting NOM checkpoint user:group permissions
> + Setting Nagios Core corelog.newobjects user:group permissions
> + Setting CCM configuration file user:group permissions
> + Setting Recurring Downtime file user:group permissions
> + Setting BPI configuration file user:group permissions
--------------------------------------

Re: No Hosts/Services/Contacts error

Posted: Fri Sep 04, 2020 2:31 pm
by benjaminsmith
Hi Henry,

There should be one host when you revert back to the default CCM settings, so something is off here. Are you able to run any configuration wizards?

Can you send the profile over from this server?

Additionally, please run the following command to dump the configuration database and attach this file as well.

Code: Select all

mysqldump -uroot -pnagiosxi nagiosxi > nagiosxi.sql

Re: No Hosts/Services/Contacts error

Posted: Fri Sep 04, 2020 2:53 pm
by hbouma
Info sent in PM

Re: No Hosts/Services/Contacts error

Posted: Tue Sep 08, 2020 4:12 pm
by benjaminsmith
Hi Henry,

One thing I noticed looking through the profile is that there are a number of logical volumes set up and the nagios volume is showing full. This is where the configurations are stored, and that's likely why it cannot write the changes.

Code: Select all

/dev/mapper/vgdata-lvnagios                   9.8G  9.3G   60K 100% /usr/local/nagios

Re: No Hosts/Services/Contacts error

Posted: Wed Sep 09, 2020 7:19 am
by hbouma
Thank you! I have cleaned up the drive of the 6GB of perfdata.

However, I still cannot write any changes. It still gives the same error. Even when I revert to a previous working snapshot, it tells me that there are no contacts/hosts/services. I can see them in the GUI, but I am still not able to apply any changes.

I am able to get into the database and run a repair_database and I am told everything works.


I also attempted to import the configuration files from a working snapshot to see if that helped, and it isn't letting me.


At this point, I am going to restore the server to a previous state to try and fix the issue.

Re: No Hosts/Services/Contacts error

Posted: Wed Sep 09, 2020 10:30 am
by hbouma
Unfortunately, a system restore to a backup also didn't fix the issue.

Re: No Hosts/Services/Contacts error

Posted: Thu Sep 10, 2020 9:22 am
by hbouma
Ok, I was able to fix the issue doing the following:

Backup another NagiosXI instance
edit the restore_xi.sh script on this box to force it to use the correct offloaded DB instead of the DB from the server I backed up.
Restore the backup onto the corrupted server
Fix the certificate name as listed in the SSL Nagios documentation https://assets.nagios.com/downloads/nag ... s%20XI.pdf
Edit the configuration files as listed in the instructions for offloading the database https://assets.nagios.com/downloads/nag ... Server.pdf
Edit the configuration files as listed in the change default passwords document https://library.nagios.com/library/prod ... passwords/

That seemed to fix everything.

Please go ahead and lock this topic