Page 1 of 1

Two host_name directives in one service definition

Posted: Tue Jul 28, 2020 8:38 am
by keiferb
I'm trying to remove a single host (host4.school.edu in the snippet below) from a service that's applied to a host group that host is a member of. In CCM, I navigated to the Service Management page for the service, clicked on "Manage Hosts", and added host4.school.edu with the "!" box checked.

When the config is generated, the host is in the service definition as a negation but there's a second host_name line further down that is overriding it. The three excluded hosts in the second host_name line shown below are not listed in the "Manage Hosts" window where I added host4, but clearly they're defined as exclusions somewhere. Where else in CCM should I be looking?

Code: Select all

define service {
    host_name                !host4.school.edu
    service_description      Drive Space - /boot
    use                      service-server-standard
    hostgroup_name           linux-server-critical,linux-server-standard,nac-appliance-standard
    servicegroups            linux-server-standard
    check_command            check_snmp_disk!/boot!-C $USER23$!!!!!!
    host_name                !host1.school.edu,!host2.school.edu,!host3.school.edu
    register                 1
}
The server is running RHEL 6.9 64 bit with a manual install of NXI 5.7.1 and no special configurations to speak of.

Re: Two host_name directives in one service definition

Posted: Tue Jul 28, 2020 4:01 pm
by jbrunkow
You may want to start by upgrading to 5.7.2.

Code: Select all

cd /tmp
rm -rf nagiosxi xi*.tar.gz
wget http://assets.nagios.com/downloads/nagiosxi/xi-latest.tar.gz
tar xzf xi-latest.tar.gz
cd nagiosxi
./upgrade
UPGRADE NAGIOS XI

There was a recent issue in 5.7.1 with hosts being duplicated instead of renamed.
Fixed NDO issue where renaming hosts and services with uppercase/lowercase letters caused inconsistencies
NAGIOS XI CHANGE LOG

If, for some reason, you can't see what's causing this in the GUI, you may want to look at the configuration files directly in the following directory location.

Code: Select all

/usr/local/nagios/etc/

Re: Two host_name directives in one service definition

Posted: Thu Aug 06, 2020 1:34 pm
by keiferb
I have upgraded to 5.7.2 and still have the same problem. The config snippet from my original post is from one of the files in /usr/local/nagios/etc/. It is still being generated with two separate host_name lines, causing the first to be ignored and overridden by the second.

Re: Two host_name directives in one service definition

Posted: Thu Aug 06, 2020 5:06 pm
by jbrunkow
You may want to try repairing the database. Please run these two scripts. Best to have a backup just in case!

Code: Select all

/usr/local/nagiosxi/scripts/backup_xi.sh
/usr/local/nagiosxi/scripts/repair_databases.sh
Have you already tried rewriting the configuration files with the Config File Management tool in the Core Config Manager?

Re: Two host_name directives in one service definition

Posted: Tue Aug 11, 2020 10:11 am
by keiferb
I have run the database repair and regenerated the config file. It still generates the same way, with two host_name declarations:

Code: Select all

    define service {
        host_name                !host4.school.edu
        service_description      Drive Space - /boot
        use                      service-server-standard
        hostgroup_name           linux-server-critical,linux-server-standard,nac-appliance-standard
        servicegroups            linux-server-standard
        check_command            check_snmp_disk!/boot!-C $USER23$!!!!!!
        host_name                !host1.school.edu,!host2.school.edu,!host3.school.edu
        register                 1
    }

Re: Two host_name directives in one service definition

Posted: Tue Aug 11, 2020 3:22 pm
by jbrunkow
Do you have a free variable that holds the following values by any chance?

Code: Select all

!host1.school.edu,!host2.school.edu,!host3.school.edu
Navigate to the Configure section of XI using the top bar > click Core Config Manager under Advanced Configuration on the left pane > click on the name of the problematic service > select the Misc Settings tab > click on the Manage Free Variables button > and make sure there isn't a host_name free variable. That could be where that is coming from.

Re: Two host_name directives in one service definition

Posted: Wed Aug 12, 2020 8:37 am
by keiferb
jbrunkow wrote:Do you have a free variable that holds the following values by any chance?

Code: Select all

!host1.school.edu,!host2.school.edu,!host3.school.edu
Yes. Yes we did. Removing that free variable and adding those hosts via the host selection window took care of the problem.

Thank you!

Re: Two host_name directives in one service definition

Posted: Wed Aug 12, 2020 8:55 am
by scottwilkerson
keiferb wrote:
jbrunkow wrote:Do you have a free variable that holds the following values by any chance?

Code: Select all

!host1.school.edu,!host2.school.edu,!host3.school.edu
Yes. Yes we did. Removing that free variable and adding those hosts via the host selection window took care of the problem.

Thank you!
Great!

Locking thread