HostGroup related question

This forum was archived to /woltlab and is now in read-only mode.
  • How can I assign one host under multiple hostgroups?

    Suppose I have three host: A, B, C
    And two hostgroups: X, Y

    I want to assign A, B to X and B, C to Y..

    How can I do this?
    Is it possible to do with API?

  • Using Config Files:
    In the Host object, use:

    1. object Host B {
    2. ...
    3. groups += [ "X", "Y" ]
    4. ...
    5. }

    For the API, it will work, but i have no example at hands on how to properly set arrays.

    *May* be the below is working (Code Tag is not working):

    curl -k -s -u root:icinga -H 'Accept: application/json' \
    -X PUT 'https://localhost:5665/v1/objects/hosts/example.localdomain' \
    -d '{ "templates": [ "generic-host" ], "attrs": { "address": "", "check_command": "hostalive", "vars.os" : "Linux" , "vars.groups" : {"X","Y"} } }' \
    | python -m json.tool

    The post was edited 1 time, last by sru ().