No Hosts/Services/Contacts error

This support forum board is for support questions relating to Nagios XI, our flagship commercial network monitoring solution.
hbouma
Posts: 483
Joined: Tue Feb 27, 2018 9:31 am

No Hosts/Services/Contacts error

Post 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.
hbouma
Posts: 483
Joined: Tue Feb 27, 2018 9:31 am

Re: No Hosts/Services/Contacts error

Post 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.
User avatar
cdienger
Support Tech
Posts: 5045
Joined: Tue Feb 07, 2017 11:26 am

Re: No Hosts/Services/Contacts error

Post by cdienger »

You can restore the CCM to a default config by running:

Code: Select all

/usr/local/nagiosxi/scripts/restore_defaults.sh
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.
hbouma
Posts: 483
Joined: Tue Feb 27, 2018 9:31 am

Re: No Hosts/Services/Contacts error

Post 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
--------------------------------------
benjaminsmith
Posts: 5324
Joined: Wed Aug 22, 2018 4:39 pm
Location: saint paul

Re: No Hosts/Services/Contacts error

Post 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
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.

Be sure to check out our Knowledgebase for helpful articles and solutions!
hbouma
Posts: 483
Joined: Tue Feb 27, 2018 9:31 am

Re: No Hosts/Services/Contacts error

Post by hbouma »

Info sent in PM
benjaminsmith
Posts: 5324
Joined: Wed Aug 22, 2018 4:39 pm
Location: saint paul

Re: No Hosts/Services/Contacts error

Post 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
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.

Be sure to check out our Knowledgebase for helpful articles and solutions!
hbouma
Posts: 483
Joined: Tue Feb 27, 2018 9:31 am

Re: No Hosts/Services/Contacts error

Post 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.
hbouma
Posts: 483
Joined: Tue Feb 27, 2018 9:31 am

Re: No Hosts/Services/Contacts error

Post by hbouma »

Unfortunately, a system restore to a backup also didn't fix the issue.
hbouma
Posts: 483
Joined: Tue Feb 27, 2018 9:31 am

Re: No Hosts/Services/Contacts error

Post 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
Locked