[dev.icinga.com #9554] Don't allow "ignore where" for groups when there's no "assign where" #3120

Closed
icinga-migration opened this Issue Jul 3, 2015 · 8 comments

Comments

Projects
None yet
1 participant
@icinga-migration
Member

icinga-migration commented Jul 3, 2015

This issue has been migrated from Redmine: https://dev.icinga.com/issues/9554

Created by penyilas on 2015-07-03 11:14:21 +00:00

Assignee: mfriedrich
Status: Resolved (closed on 2015-07-16 11:56:18 +00:00)
Target Version: 2.3.8
Last Update: 2015-07-20 06:52:47 +00:00 (in Redmine)

Icinga Version: 2.3.5
Backport?: Already backported
Include in Changelog: 1

Hi,

Here's my simple setup:

object Host "host1" {
  import "generic-host"

  vars.environment = "prod"
}

object Host "host2" {
  import "generic-host"

  vars.environment = "test"
}

apply Service "service1" {

  groups += [ SG1 ]
  assign where match("host*", host.name)
}

object ServiceGroup "SG1" {
  ignore where host.vars.environment == "prod"
}

I'd like to exclude non production hosts' services from servicegroup, but it's not working...

I'm using icinga2-2.3.5-1.el7.centos.x86_64 (CentOS7)

Thanks

Changesets

2015-07-16 11:56:12 +00:00 by (unknown) 51d0e71

Don't allow "ignore where" for groups when there's no "assign where"

fixes #9554

2015-07-20 06:52:35 +00:00 by (unknown) 92aa963

Don't allow "ignore where" for groups when there's no "assign where"

fixes #9554

Relations:

@icinga-migration

This comment has been minimized.

Show comment
Hide comment
@icinga-migration

icinga-migration Jul 9, 2015

Member

Updated by mfriedrich on 2015-07-09 08:40:05 +00:00

  • Description updated
Member

icinga-migration commented Jul 9, 2015

Updated by mfriedrich on 2015-07-09 08:40:05 +00:00

  • Description updated
@icinga-migration

This comment has been minimized.

Show comment
Hide comment
@icinga-migration

icinga-migration Jul 9, 2015

Member

Updated by mfriedrich on 2015-07-09 08:44:51 +00:00

You are explicitely assigning the service group membership in your service apply rule with

groups += [ SG1 ]

The service group ignore where rule does not have any effect for explicitly assigned group memberships.

We should probably add a warning when an 'ignore where' expression misses an 'assign where' expression before.

Member

icinga-migration commented Jul 9, 2015

Updated by mfriedrich on 2015-07-09 08:44:51 +00:00

You are explicitely assigning the service group membership in your service apply rule with

groups += [ SG1 ]

The service group ignore where rule does not have any effect for explicitly assigned group memberships.

We should probably add a warning when an 'ignore where' expression misses an 'assign where' expression before.

@icinga-migration

This comment has been minimized.

Show comment
Hide comment
@icinga-migration

icinga-migration Jul 13, 2015

Member

Updated by penyilas on 2015-07-13 17:22:49 +00:00

dnsmichi wrote:

You are explicitely assigning the service group membership in your service apply rule with

[...]

The service group ignore where rule does not have any effect for explicitly assigned group memberships.

We should probably add a warning when an 'ignore where' expression misses an 'assign where' expression before.
Ok, I can understand... thanks

Member

icinga-migration commented Jul 13, 2015

Updated by penyilas on 2015-07-13 17:22:49 +00:00

dnsmichi wrote:

You are explicitely assigning the service group membership in your service apply rule with

[...]

The service group ignore where rule does not have any effect for explicitly assigned group memberships.

We should probably add a warning when an 'ignore where' expression misses an 'assign where' expression before.
Ok, I can understand... thanks

@icinga-migration

This comment has been minimized.

Show comment
Hide comment
@icinga-migration

icinga-migration Jul 16, 2015

Member

Updated by gbeutner on 2015-07-16 08:40:07 +00:00

  • Subject changed from Servicegroup ignore not working to Don't allow "ignore where" for groups when there's no "assign where"
  • Category set to Configuration
Member

icinga-migration commented Jul 16, 2015

Updated by gbeutner on 2015-07-16 08:40:07 +00:00

  • Subject changed from Servicegroup ignore not working to Don't allow "ignore where" for groups when there's no "assign where"
  • Category set to Configuration
@icinga-migration

This comment has been minimized.

Show comment
Hide comment
@icinga-migration

icinga-migration Jul 16, 2015

Member

Updated by mfriedrich on 2015-07-16 11:52:30 +00:00

  • Relates set to 9535
Member

icinga-migration commented Jul 16, 2015

Updated by mfriedrich on 2015-07-16 11:52:30 +00:00

  • Relates set to 9535
@icinga-migration

This comment has been minimized.

Show comment
Hide comment
@icinga-migration

icinga-migration Jul 16, 2015

Member

Updated by mfriedrich on 2015-07-16 11:55:45 +00:00

  • Status changed from New to Assigned
  • Assigned to set to mfriedrich
  • Target Version set to 2.4.0
  • Estimated Hours set to 0.5

Take that as a test config from #9535, slightly modified.

Works

template Service "ignore-svc-tmpl" {
  //ignore where match("*", host.name)
  //assign where true
}

object Host "test-12345" {
  check_command = "ping4"
  vars.test = [ 1, 2, 3, 4 ]
}

apply Service "test-1234" for (i in host.vars.test) {
  import "ignore-svc-tmpl"
  check_command = "ping4"

  log(i)
  //assign where true
  ignore where i > 2
}

object HostGroup "test-ignore" {
  assign where true
  ignore where false
}

Broken

With an applied fix.

object HostGroup "test-ignore" {
  //assign where true
  ignore where false
}

critical/config: Error: object rule 'ignore' is missing 'assign' for type 'HostGroup'
Location:
/etc/icinga2/tests/ignore.conf(18): }
/etc/icinga2/tests/ignore.conf(19): 
/etc/icinga2/tests/ignore.conf(20): object HostGroup "test-ignore" {
                                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
/etc/icinga2/tests/ignore.conf(21):   //assign where true
/etc/icinga2/tests/ignore.conf(22):   ignore where false
Member

icinga-migration commented Jul 16, 2015

Updated by mfriedrich on 2015-07-16 11:55:45 +00:00

  • Status changed from New to Assigned
  • Assigned to set to mfriedrich
  • Target Version set to 2.4.0
  • Estimated Hours set to 0.5

Take that as a test config from #9535, slightly modified.

Works

template Service "ignore-svc-tmpl" {
  //ignore where match("*", host.name)
  //assign where true
}

object Host "test-12345" {
  check_command = "ping4"
  vars.test = [ 1, 2, 3, 4 ]
}

apply Service "test-1234" for (i in host.vars.test) {
  import "ignore-svc-tmpl"
  check_command = "ping4"

  log(i)
  //assign where true
  ignore where i > 2
}

object HostGroup "test-ignore" {
  assign where true
  ignore where false
}

Broken

With an applied fix.

object HostGroup "test-ignore" {
  //assign where true
  ignore where false
}

critical/config: Error: object rule 'ignore' is missing 'assign' for type 'HostGroup'
Location:
/etc/icinga2/tests/ignore.conf(18): }
/etc/icinga2/tests/ignore.conf(19): 
/etc/icinga2/tests/ignore.conf(20): object HostGroup "test-ignore" {
                                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
/etc/icinga2/tests/ignore.conf(21):   //assign where true
/etc/icinga2/tests/ignore.conf(22):   ignore where false
@icinga-migration

This comment has been minimized.

Show comment
Hide comment
@icinga-migration

icinga-migration Jul 16, 2015

Member

Updated by Anonymous on 2015-07-16 11:56:18 +00:00

  • Status changed from Assigned to Resolved
  • Done % changed from 0 to 100

Applied in changeset 51d0e71.

Member

icinga-migration commented Jul 16, 2015

Updated by Anonymous on 2015-07-16 11:56:18 +00:00

  • Status changed from Assigned to Resolved
  • Done % changed from 0 to 100

Applied in changeset 51d0e71.

@icinga-migration

This comment has been minimized.

Show comment
Hide comment
@icinga-migration

icinga-migration Jul 20, 2015

Member

Updated by gbeutner on 2015-07-20 06:52:47 +00:00

  • Target Version changed from 2.4.0 to 2.3.8
  • Backport? changed from TBD to Yes
Member

icinga-migration commented Jul 20, 2015

Updated by gbeutner on 2015-07-20 06:52:47 +00:00

  • Target Version changed from 2.4.0 to 2.3.8
  • Backport? changed from TBD to Yes
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment