Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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


share|improve this question
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


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.