2 hosts with almost identical names share servicechecks

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
User avatar
rhassing
Posts: 416
Joined: Sat Oct 05, 2013 10:29 pm
Location: Netherlands

2 hosts with almost identical names share servicechecks

Post by rhassing »

I have defined two hosts:

Code: Select all

define host {
        host_name                       A-ALMEX02
        alias                           Exchange 2010 HUB/CAS ADS
        display_name                    A-ALMEX02
        address                         172.20.0.65
        check_command                   check-host-alive
        initial_state                   o
        max_check_attempts              3
        check_interval                  5
        retry_interval                  1
        active_checks_enabled           1
        passive_checks_enabled          0
        check_period                    24x7
        check_freshness                 1
        event_handler                   host-notify-by-email
        process_perf_data               1
        contact_groups                  Standby_pool2
        notification_interval           15
        notification_period             24x7
        notification_options            d,u,r
        notifications_enabled           1
        register                        1
}

define host {
        host_name                       ALMEX02
        alias                           Exchange 2010 HUB/CAS ADS
        display_name                    ALMEX02
        address                         172.20.4.151
        check_command                   check-host-alive
        initial_state                   o
        max_check_attempts              3
        check_interval                  5
        retry_interval                  1
        active_checks_enabled           1
        passive_checks_enabled          0
        check_period                    24x7
        check_freshness                 1
        event_handler                   host-notify-by-email
        process_perf_data               1
        contact_groups                  Standby_pool2
        notification_interval           15
        notification_period             24x7
        notification_options            d,u,r
        notifications_enabled           1
        register                        1
}
One service check:

Code: Select all

define service {
        #NAGIOSQL_CONFIG_NAME           Disk_usage_D
        host_name                       ALMEX02
        service_description             Disk usage D: - 24x7 Pool 2
        display_name                    Disk usage D: - 24x7 Pool 2
        check_command                   check_snmp_storage!public!^D!90!95
        initial_state                   o
        max_check_attempts              3
        check_interval                  5
        retry_interval                  1
        active_checks_enabled           1
        check_period                    24x7
        check_freshness                 1
        event_handler_enabled           0
        process_perf_data               1
        notification_interval           5
        notification_period             24x7
        notification_options            w,u,c,r,f
        notifications_enabled           1
        contact_groups                  Mail_Standby_Pool_2
        notes_url                       /nagiosgraph/cgi-bin/show.cgi?host=$HOSTNAME$&service=$SERVICEDESC$&db=diskgd%2Cbytesfree&db=diskgd%2Cbytesmax&period=day,week,month,year&expand_period=day,week,month,year
        register                        1
}
But still I have the servicecheck on both hosts:
Image

How can this be avoided?
Rob Hassing
Image
User avatar
rhassing
Posts: 416
Joined: Sat Oct 05, 2013 10:29 pm
Location: Netherlands

Re: 2 hosts with almost identical names share servicechecks

Post by rhassing »

And this is why we don't want it on one host :D
Image
Rob Hassing
Image
jdalrymple
Skynet Drone
Posts: 2620
Joined: Wed Feb 11, 2015 1:56 pm

Re: 2 hosts with almost identical names share servicechecks

Post by jdalrymple »

I copied and pasted your config into a 4.0.8 (XI 2.7) box and couldn't reproduce the behavior.

I suspect you have some hostgroup foul play going on
Attachments
Clipboard01.jpg
Clipboard01.jpg (9.76 KiB) Viewed 2950 times
User avatar
rhassing
Posts: 416
Joined: Sat Oct 05, 2013 10:29 pm
Location: Netherlands

Re: 2 hosts with almost identical names share servicechecks

Post by rhassing »

I'm using Nagios 4.1.1 in this configuration. I will try to reproduce this as well in a smaller setup.
There are hostgroups defined, but not used for this service.
Both hosts have multiple services defined and also overlapping servicechecks, but this check should exist on just the one host.
Rob Hassing
Image
jolson
Attack Rabbit
Posts: 2560
Joined: Thu Feb 12, 2015 12:40 pm

Re: 2 hosts with almost identical names share servicechecks

Post by jolson »

I tested this on a 4.1.1 box as well:
2015-09-03 10_23_17-Nagios Core - Firefox Developer Edition.png
2015-09-03 10_23_17-Nagios Core - Firefox Developer Edition.png (4.66 KiB) Viewed 2943 times
Twits Blog
Show me a man who lives alone and has a perpetually clean kitchen, and 8 times out of 9 I'll show you a man with detestable spiritual qualities.
User avatar
rhassing
Posts: 416
Joined: Sat Oct 05, 2013 10:29 pm
Location: Netherlands

Re: 2 hosts with almost identical names share servicechecks

Post by rhassing »

We found the problem. It seems to be possible to use regular expressions in nagios.cfg. If we turn them off, our problem is solved:

Code: Select all

# REGULAR EXPRESSION MATCHING
# This option controls whether or not regular expression matching
# takes place in the object config files.  Regular expression
# matching is used to match host, hostgroup, service, and service
# group names/descriptions in some fields of various object types.
# Values: 1 = enable regexp matching, 0 = disable regexp matching

use_regexp_matching=0



# "TRUE" REGULAR EXPRESSION MATCHING
# This option controls whether or not "true" regular expression
# matching takes place in the object config files.  This option
# only has an effect if regular expression matching is enabled
# (see above).  If this option is DISABLED, regular expression
# matching only occurs if a string contains wildcard characters
# (* and ?).  If the option is ENABLED, regexp matching occurs
# all the time (which can be annoying).
# Values: 1 = enable true matching, 0 = disable true matching

use_true_regexp_matching=0
Rob Hassing
Image
User avatar
hsmith
Agent Smith
Posts: 3539
Joined: Thu Jul 30, 2015 11:09 am
Location: 127.0.0.1
Contact:

Re: 2 hosts with almost identical names share servicechecks

Post by hsmith »

rhassing wrote:We found the problem. It seems to be possible to use regular expressions in nagios.cfg. If we turn them off, our problem is solved:

Code: Select all

# REGULAR EXPRESSION MATCHING
# This option controls whether or not regular expression matching
# takes place in the object config files.  Regular expression
# matching is used to match host, hostgroup, service, and service
# group names/descriptions in some fields of various object types.
# Values: 1 = enable regexp matching, 0 = disable regexp matching

use_regexp_matching=0



# "TRUE" REGULAR EXPRESSION MATCHING
# This option controls whether or not "true" regular expression
# matching takes place in the object config files.  This option
# only has an effect if regular expression matching is enabled
# (see above).  If this option is DISABLED, regular expression
# matching only occurs if a string contains wildcard characters
# (* and ?).  If the option is ENABLED, regexp matching occurs
# all the time (which can be annoying).
# Values: 1 = enable true matching, 0 = disable true matching

use_true_regexp_matching=0
Is there anything else we can do to help you out with this issue?
Former Nagios Employee.
me.
User avatar
rhassing
Posts: 416
Joined: Sat Oct 05, 2013 10:29 pm
Location: Netherlands

Re: 2 hosts with almost identical names share servicechecks

Post by rhassing »

No, this is solved, thread may be closed :-)
Rob Hassing
Image
Locked