Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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!

share|improve this question

1 Answer 1

up vote 8 down vote accepted

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.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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