Using the Resource Group Management Service API
Use the Resource Group Management Service API to manage the lifecycle of groups of managed systems from the command line.
About this task
Complete resource group tasks such as creating, viewing, updating, and deleting groups of managed systems. Add and remove individual systems from custom groups. View a list of systems that you added to a specific custom resource group, and view a list of systems that are automatically added to the built-in groups such as the system resource group.
You can create scripts for automating such tasks as defining resource groups and assigning agents to these resource groups. The resource groups can be targets of threshold distributions and or access control policies.
- Return all resource groups, agents, or a specific resource group or agent.
- Create a custom resource group or update the definition of an existing group
- Delete a specified custom resource group
- Add agents to a custom resource group
- Remove agents from a custom resource group
Procedure
Complete these steps to define and change custom resource groups with the Resource Group Management Service API. System resource groups and agents cannot be modified.
Results
Example
GET /1.0/topology/mgmt_artifacts?_filter=entityTypes=Agent&_field=keyIndexName&_field=online&_field=hostname&_field=version&_field=productCode&_field=descriptionThis
command returns a list of all Linux OS
agents:GET /1.0/topology/mgmt_artifacts?_filter=entityTypes=Agent&_filter=description="Linux OS"&_field=keyIndexNameThis
command returns a list of system and custom groups:
GET /1.0/topology/mgmt_artifacts?_filter=entityTypes:AgentGroup,AgentSystemGroup&_field=keyIndexName&_field=displayLabelThis
command returns the list of agents that are assigned to a group that has the unique identifier {id}:
GET /1.0/topology/mgmt_artifacts/{id}/references/to/containsThe following
example uses the curl command to create a custom group.
POST /1.0/topology/mgmt_artifactscurl -X POST \
https://api.ibm.com/perfmgmt/run/1.0/topology/mgmt_artifacts \
-H 'Referer: https://api.ibm.com' \
-H 'authorization: Basic REPLACE_BASE64_ENCODED_STRING' \
-H 'content-type: application/json' \
-H 'x-ibm-client-id: REPLACE_KEY_VALUE' \
-H 'x-ibm-client-secret: REPLACE_KEY_VALUE' \
-d '{
"keyIndexName": "customGroup",
"description": "Custom group description",
"displayLabel": "customGroupLabel",
"entityTypes": [
"AgentGroup"
],
"arbitraryStringProperty": "Your custom property value"
}'
POST /1.0/topology/mgmt_artifacts/{id}/references/to/contains/{otherid}This
command removes an agent with unique identifier {otherid} from a custom group that has unique
identifier {id}:
DELETE /1.0/topology/mgmt_artifacts/{id}/references/to/contains/{otherid}