Nagios inheritance issue

Support forum for Nagios Core, Nagios Plugins, NCPA, NRPE, NSCA, NDOUtils and more. Engage with the community of users including those using the open source solutions.
Locked
zazak
Posts: 4
Joined: Wed Mar 08, 2017 4:58 am

Nagios inheritance issue

Post by zazak »

Hi,

After long time of use Nagios core 4.1.1 today I noticed a wired behavior I'd say even a bug in inheritance. My configuration is as follows:
Host definition example (similar for all hosts in the group except host name and IP):

Code: Select all

define host{
        use                     linux-server            ; Name of host template to use
							; This host definition will inherit all variables that are defined
							; in (or inherited by) the linux-server host template definition.
        host_name               krplplb02a.example.com
        alias                   krplplb02a
        address                 10.20.102.5
        parents                 skraesx06.example.com,skraesx07.example.com,skraesx15.example.com
        }
Group definition:

Code: Select all

define hostgroup{
        hostgroup_name  lvs-servers ; The name of the hostgroup
        alias           LVS Servers ; Long name of the group
	members krplplb02b.example.com,krplplb02a.example.com,jctlb03a.example.com,jctlb03b.example.com,krplplb01a.example.com,krplplb01b.example.com,psplb01a.example.com,psplb01b.example.com ; Comma separated list of hosts that belong to this group
        }
and service checks:

Code: Select all

define service{
        use                                     prod-service-hosting,nagiosgraph         ; Name of service template to use
        hostgroup_name                  lvs-servers 
        service_description             PING
	first_notification_delay        5
        check_command                   check_ping!250.0,20%!500.0,60%
        }
What I expect is that all members of the group will have exactly the same thresholds for the ping service - W:250 c:500 ms but it seems that for some reason the last two hosts in the 'members' line are ignored. Nagios presents the command as if they were configured with thresholds 150 and 500. I have changed the order in the list and again last two hosts have different values than whole group. However nagios correctly presents them as members of one group. I have also tried to break the line or use two 'members' line definitions with the same result.
I'd be grateful for any hints why I observe such strange behavior.

Thanks,
PZ
User avatar
mcapra
Posts: 3739
Joined: Thu May 05, 2016 3:54 pm

Re: Nagios inheritance issue

Post by mcapra »

Just for the sake of argument, can you show us the host definitions of the two hosts (I assume psplb01a.example.com,psplb01b.example.com) that aren't getting the correct PING thresholds?
Former Nagios employee
https://www.mcapra.com/
zazak
Posts: 4
Joined: Wed Mar 08, 2017 4:58 am

Re: Nagios inheritance issue

Post by zazak »

Hi,

Below you can find the last two hosts definition:

Code: Select all

define host{
        use                     linux-server            ; Name of host template to use
							; This host definition will inherit all variables that are defined
							; in (or inherited by) the linux-server host template definition.
        host_name               psplb01a.example.com
        alias                   psplb01a.example.com
        address                 192.168.12.198
        parents                 abvavm501.example.com,abvavm502.example.com,abvavm503.example.com,abvavm505.example.com,abvavm506.example.com
        }

Code: Select all

define host{
        use                     linux-server            ; Name of host template to use
							; This host definition will inherit all variables that are defined
							; in (or inherited by) the linux-server host template definition.
        host_name               psplb01a.example.com
        alias                   psplb01a.example.com
        address                 192.168.12.198
        parents                 abvavm501.example.com,abvavm502.example.com,abvavm503.example.com,abvavm505.example.com,abvavm506.example.com
        }
Since I want utilize the inheritance to the limit I keep the hosts and gruops configuration as simple as it's possible - generally I copy the definition from file to file and just change the unique values.

Thank you for you interest.

PZ
User avatar
mcapra
Posts: 3739
Joined: Thu May 05, 2016 3:54 pm

Re: Nagios inheritance issue

Post by mcapra »

Something is definitely not adding up. Rather than copy+pasting the configurations, would it be possible for you to upload the files themselves? I'd like to rule out any possible tab/space or encoding issues that might be causing this.
Former Nagios employee
https://www.mcapra.com/
zazak
Posts: 4
Joined: Wed Mar 08, 2017 4:58 am

Re: Nagios inheritance issue

Post by zazak »

Please find the attached configuration files.

PZ
Attachments
lvs_group.cfg
Services definition
(2.67 KiB) Downloaded 241 times
lvs_group.cfg
Group definition
(415 Bytes) Downloaded 237 times
psplb01b.example.cfg
host B
(554 Bytes) Downloaded 239 times
zazak
Posts: 4
Joined: Wed Mar 08, 2017 4:58 am

Re: Nagios inheritance issue

Post by zazak »

Just for sake of make things clear - here is a screen for the service with current performance data.

PZ
Attachments
Peformance data
Peformance data
ssax
Dreams In Code
Posts: 7682
Joined: Wed Feb 11, 2015 12:54 pm

Re: Nagios inheritance issue

Post by ssax »

Please run this command and PM one of us the resulting /tmp/nagios_files.zip file so that we can validate your entire configuration:

Code: Select all

zip -r /tmp/nagios_files.zip /usr/local/nagios/etc
I'm leaning towards you having another PING service applied to it (maybe from attaching a hostgroup to a service that contained those other hosts), run this command and it may show you that it has duplicates:

Code: Select all

/usr/local/nagios/bin/nagios -v /usr/local/nagios/etc/nagios.cfg
Thank you
Locked