Page 1 of 1

Cannot delete hosts/host groups

Posted: Tue Mar 24, 2020 11:17 am
by wernerreiche
I'm trying to import an older Nagios configuration into Nagios XI (core 4.4.3).

I've done the import once, but now I'm trying to overwrite it but I cannot get rid of the old definitions.

From the web interface, I've deleted the hosts, services, host groups and service groups.
But when I try to "apply configuration", I get the error below.

Error: Could not complete object definition in file '/usr/local/nagios/etc/hostgroups.cfg' on line 19. Have you named all your objects?

I would expect host groups to be empty at this point, but it still complains.

If I use config file management / delete files, then write config, I get my old and broken configuration back.
How do I get rid of it?

Also - related to this when I run the import, the "overwrite database" checkbox doesn't seem to have any effect. Old configurations remain behind.

When I run the import, I am deleting all existing configs from
/usr/local/nagios/etc
/usr/local/nagios/etc/hosts
/usr/local/nagios/etc/services

Alternatively, is there some way to re-initialize the Nagios XI database back to an initial state?

Re: Cannot delete hosts/host groups

Posted: Tue Mar 24, 2020 11:38 am
by scottwilkerson
Go to the CCM -> Host Groups
Click the View Config to the right of one of the groups

on the display is there a group with a blank name next tohostgroup_members just below line 19?

If so go to
Go to the CCM -> Host Groups -> Edit that hostgroup
Click manage hosts
empty anything that is in there (if any)
Click Close
Click Save
Apply Configuration

Re: Cannot delete hosts/host groups

Posted: Tue Mar 24, 2020 12:43 pm
by wernerreiche
From the web interface, there are no hosts, not services, no host groups, no service groups.

When I look at the file CCM keeps creating in ../etc/hostgroups.cfg, line 19 is the members line.
These members no longer exist.

define hostgroup {
hostgroup_name AMHS_IT_NETWORK
alias AMHS_IT_NETWORK
members AMHS_IT_NETWORK_ROUTER,CADAS_UA15,CADAS_UA25,CADAS_UA26,HQCAA-ITCore-Router,UPS-AIMS
}

Why does the apply config work with a different database than is shown in the web interface?
The basic problem is that the web interface is not showing correctly what is in the database, and I have no way of correcting it.
Is there some way I can go directly to the MySQL database and correct the problem?

Re: Cannot delete hosts/host groups

Posted: Tue Mar 24, 2020 3:15 pm
by scottwilkerson
Can you send me a profile.zip via PM from
Admin -> System Profile

Re: Cannot delete hosts/host groups

Posted: Tue Mar 24, 2020 3:56 pm
by scottwilkerson
I looked at the profile you sent and nothing stood out, but I have a feeling it isn't actually able to apply configuration and is rolling back to the last know configuration because you have 0 hosts and 0 services, the nagios config cannot apply with none.

We can verify this by running the following

Code: Select all

cd /usr/local/nagiosxi/scripts/
./reconfigure_nagios.sh

Re: Cannot delete hosts/host groups

Posted: Tue Mar 24, 2020 4:53 pm
by wernerreiche
The last suggestion worked.
Thanks.

Werner

Re: Cannot delete hosts/host groups

Posted: Tue Mar 24, 2020 4:59 pm
by jbrunkow
Excellent! I'm glad you were able to get this resolved.

Do you mind if we close this topic now?

Re: Cannot delete hosts/host groups

Posted: Wed Mar 25, 2020 11:38 am
by wernerreiche
Okay to close this.