The admin/host group resource can be used to manage host groups.

Available methods:

GET /admin/groups/list List all host groups
POST /admin/groups/create Create a new host group
POST /admin/groups/update Update an existing host group name
POST /admin/groups/delete Delete a host group
POST /admin/groups/add Add hosts to the host group
POST /admin/groups/remove Remove hosts from the host group

list

Returns a list of all host groups.

curl -b ~/.mmonit/cookie \
 http://127.0.0.1:8080/admin/groups/list

Arguments

none

Output

hosts
id Host id
name Host name
groups
id The host group id
name The host group name
hosts An array of host ids (host group members). Id refers to a host in the hosts array
{
    "hosts": [
        {
            "id": 4,
            "name": "myhost-ingroup"
        },
        {
            "id": 5,
            "name": "myhost-notingroup"
        }
    ],
    "groups": [
        {
            "id": 94,
            "name": "test group",
            "hosts": [4]
        }
    ]
}

create

Creates a new host group.

curl -b ~/.mmonit/cookie \
 -d "name=testgroup" \
 http://127.0.0.1:8080/admin/groups/create

Arguments

name string required The host group name

update

Updates a host group name. Parameters with space in them must be URL encoded (space=%20) as curl won't do this

curl -b ~/.mmonit/cookie \
 -d id=97 \
 -d name=new%20testgroup \
 http://127.0.0.1:8080/admin/groups/update

Arguments

id number required The id of the host group to update
name string required The new host group name

delete

Delete the host group.

curl -b ~/.mmonit/cookie \
 -d "id=97" \
 http://127.0.0.1:8080/admin/groups/delete

Arguments

id number required The id of the host group to delete

add

Adds hosts to a host group.

curl -b ~/.mmonit/cookie \
 -d id=97 \
 -d hostid=4 \
 -d hostid=5 \
 http://127.0.0.1:8080/admin/groups/add

Arguments

id number required The id of the host group to modify
hostid number required A list of host ids to add to the group. This attribute can be used multiple times to add more than one host at once

remove

Removes hosts from the host group.

curl -b ~/.mmonit/cookie \
 -d id=97 \
 -d hostid=4 \
 -d hostid=5 \
 http://127.0.0.1:8080/admin/groups/remove

Arguments

id number required The id of the host group to modify
hostid number required A list of the host ids to remove from the group. This attribute can be used multiple times to remove more than on host at once