Hey! These docs are for version 6.3, which is no longer officially supported. Click here for the latest version, 6.7!

Rest API Config endpoint for host groups

Object type: hostgroup

Request URL: /rest/config/hostgroup

Example GET:

{
   "object" : {
      "hosts" : [],
      "parent" : {
            "name" : "Opsview",
            "matpath" : "Opsview,",
            "ref" : "/rest/config/hostgroup/1"
         },
      "name" : "Production",
      "id" : "2",
      "children" : [
         {
            "name" : "London",
            "ref": "/rest/config/hostgroup/7"
         },
         {
            "name" : "Paris",
            "ref": "/rest/config/hostgroup/3"
         },
         {
            "name" : "New York",
            "ref": "/rest/config/hostgroup/6"
         }
      ],
      "uncommitted" : "0",
      "matpath" : "Opsview,Production,",
      "is_leaf" : 0
   }
}

The matpath is a comma separated list of host groups that define this hostgroup's location in the topology.

The parent contains a the “matpath” attribute to uniquely identify the parent for a host group as it is possible to have duplicated names in the host group hierarchy (from Opsview 3.11.2+).

If you GET with a parameter of order=dependency, the host groups will be listed based on a traversal of the hierarchy, so the top host group will be first and then it will go down a branch until it comes back up again (from Opsview 3.11.2+).

Note: When PUTing, you cannot change the children - you can only change the topology by amending the parent. Also, the is_leaf and matpath field is calculated, so cannot be changed.

Warning: The name column in NOT unique in host groups. Opsview has additional logic so that if you use a name and it cannot be found, then it will search based on the matpath (but the matpath has a 255 character limit). Use the id field where possible as that is unique.