Enabling or disabling Agents with a REST API
Endpoint overview
Use the PUT method to enable or disable one or more Agents. By enabling an Agent, you enable the Agent to collect data. Conversely, by disabling an Agent, you stop the Agent from collecting data.
Request URL
PUT <protocol>://<host>:<port>/olaengine/itdaws/hostservices/agents/<action>?agent=<agentNames>&version=<apiVersion>
Parameter definitions
The following parameters can be used in the request URL.
Examples
The following examples illustrate the inputs for enabling or disabling Agents by using the PUT method.
- Example 1: Enable a single Agent
- Example 2: Enable multiple Agents
- Example 3: Disable a single Agent
Example 1: Enable a single Agent
The following example illustrates the input and response for enabling an Agent by specifying the Agent name, "Agent1.bmc.com".
Request URL
PUT http://localhost:9797/olaengine/itdaws/hostservices/agents/enable?agent=Agent1.bmc.com
"statusCode": "200",
"statusMessage": "OK",
"agents": [{
"agent": {
"agentName": "Agent1.bmc.com"
}
}]
}
Example 2: Enable multiple Agents
The following example illustrates the input and response for enabling multiple Agents by specifying the following Agent names:
- Collection-station_hou1
- Collection-agent_hou2
Request URL
PUT http://localhost:9797/olaengine/itdaws/hostservices/agents/enable?agent=Collection-station_hou1,Collection-agent_hou2
"statusCode": "200",
"statusMessage": "OK",
"agents": [{
"agent": {
"agentName": "Collection-station_hou1"
"agentName": "Collection-agent_hou2"
}
}]
}
Example 3: Disable a single Agent
The following example illustrates the input and response for disabling an Agent by specifying the Agent name, "collection-station_hou.bmc.com".
Request URL
PUT http://localhost:9797/olaengine/itdaws/hostservices/agents/disable?agent=collection-station_hou.bmc.com
"statusCode": "200",
"statusMessage": "OK",
"agents": [{
"agent": {
"agentId": "collection-station_hou.bmc.com"
}
}]
}
Response elements
The following sections help you understand the response elements:
Element definitions
The endpoint response contains the following main elements:
Successful response sample
See examples.
Unsuccessful response sample
"statusCode": "400",
"statusMessage": "Bad Request",
"agents": [{
"messages": [{
"severity": "Error",
"code": "update.agent.invalid.id",
"text": "Agent with id provided=clm-hou-agent, doesnt exist."
}]
}]
}
HTTP status codes
The following table describes the status codes that are likely to appear while working with this endpoint.