Admin Groups
The admin/host group resource can be used to manage host groups.
Available methods:
GET |
/api/2/admin/groups/list | List all host groups |
POST |
/api/2/admin/groups/create | Create a new host group |
POST |
/api/2/admin/groups/update | Update an existing host group name |
POST |
/api/2/admin/groups/delete | Delete a host group |
POST |
/api/2/admin/groups/add | Add hosts to the host group |
POST |
/api/2/admin/groups/remove | Remove hosts from the host group |
list
Returns a list of all host groups.
Arguments
none |
curl -b ~/.mmonit/cookie \
https://127.0.0.1:8080/api/2/admin/groups/list
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.
Arguments
name | string | required | The host group name |
curl -b ~/.mmonit/cookie \
-d "name=testgroup" \
https://127.0.0.1:8080/api/2/admin/groups/create
update
Updates a host group name. Parameters with space in them must be URL encoded (space=%20) as curl won’t do this
Arguments
id | number | required | The id of the host group to update |
name | string | required | The new host group name |
curl -b ~/.mmonit/cookie \
-d id=97 \
-d name=new%20testgroup \
https://127.0.0.1:8080/api/2/admin/groups/update
delete
Delete the host group.
Arguments
id | number | required | The id of the host group to delete |
curl -b ~/.mmonit/cookie \
-d "id=97" \
https://127.0.0.1:8080/api/2/admin/groups/delete
add
Adds hosts to a host group.
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 |
curl -b ~/.mmonit/cookie \
-d id=97 \
-d hostid=4 \
-d hostid=5 \
https://127.0.0.1:8080/api/2/admin/groups/add
remove
Removes hosts from the host group.
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 |
curl -b ~/.mmonit/cookie \
-d id=97 \
-d hostid=4 \
-d hostid=5 \
https://127.0.0.1:8080/api/2/admin/groups/remove