3

In my nagios configuration, hosts that use a specific template are automatically added to a hostgroup, so my configuration looks something like this:

define host {
    name          foo
    ...
    hostgroups    bar
    register 0
}

define host {
    name          baz
    use           foo
}

But now I want to add host baz also to another hostgroup. I know, I can do this in the hostgroup, but is there a way to do it in the host? I think of something like this:

define host {
    name          baz
    use           foo
    hostgroups    <hostgroupsYouAreAlreadyIn>,another-hostgroup
}

Thanks!

1 Answer 1

8

From memory,

hostgroups +another-hostgroup

Should do the trick. I believe that anywhere Nagios allows a list of values, you can use a + prefix to append to the inherited list, instead of resetting it.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.