Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use the service "servicegroups" directive or the servicegroup "members" directive, but not both #645

Open
Entreiu opened this issue Mar 10, 2023 · 0 comments

Comments

@Entreiu
Copy link

Entreiu commented Mar 10, 2023

🗣️ Foreword

Thank for taking the time to fill this bug report fully. Without it we may not be able to fix the bug, and the issue may be closed without resolution.

👻 Brief Description

When the conf.d/services.cfg file is populated, each service with a servicegroup assignment is given a "servicegroups" directive. At the same time, when conf.d/servicegroups.cfg is populated, each service group is given a "members" directive. I imagine in most situations this works fine, but if I need to have a service defined with an host_name directive that includes a negated/excluded hostname (hostname prefixed with !), the servicegroups.cfg definition does not respect that exclusion. For example, my existing configuration creates something like this:

# conf.d/services.cfg
# <snip>
define service {
    use                  default-service
    service-description  my-service
    hostgroup_name       my-hostgroup
    host_name            !somehost
    servicegroups        my-servicegroup
    check_command        check_command!arg1!arg2
}
# <snip>
# conf.d/servicegroups.cfg
# <snip>
define servicegroup {
    servicegroup_name  my-servicegroup
    members            thishost,my-service,thathost,my-service,somehost,my-service
}
# <snip>

The result is that the nagios service will not start because it cannot locate my-service on somehost.

🥞 Cookbook version

Version of the cookbook where you are encountering the issue: 11.1.4

👩‍🍳 Chef-Infra Version

Version of chef-client in your environment: 17.10.3

🎩 Platform details

Operating system distribution and release version: Ubuntu 22.04

Steps To Reproduce

Steps to reproduce the behavior:

Create a data bag for a service which includes both a servicegroups directive and a host_name directive. The host_name directive needs to contain a negated/excluded host.
Then create a data bag for a servicegroup to be referenced by the previously defined service.

🚓 Expected behavior

As the documentation for Nagios 4 indicates that object definition for a service with a servicegroups directive is an alternative to the object definition for a servicegroup with a members directive, it would be ideal to do one or the other, not both. I'd prefer to have the servicegroups directive attached to a service than individual services enumerated in the servicegroups definitions so that Nagios can intelligently exclude hosts that are negated by the service definitions host_name directive.

➕ Additional context

No additional context

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant