Feature description
Queries the details of the OCP Agent on the specified host.
Call instructions
Interface constraints
The caller must have the permission to view the corresponding host.
Request path
GET /compute/hosts/{hostId}/agent
Request parameters
path:
Parameter |
Type |
Required |
Example value |
Description |
|---|---|---|---|---|
| hostId | Long | Yes | 100 | Host ID. |
Return result
Parameter |
Type |
Description |
|---|---|---|
| successful | Boolean | Indicates whether the request was successful. |
| timestamp | Datetime | The timestamp when the server finishes the request. |
| duration | Integer | The time taken by the server to process the request, in milliseconds. |
| status | Integer | The HTTP status code that conforms to the HTTP status specification. |
| traceId | String | The Trace ID of the request, which is used for troubleshooting. |
| server | String | The address of the application service that responds to the request. |
| data | Object | For more information, see HostAgent information data structure. |
HostAgent information data structure
Parameter |
Type |
Description |
|---|---|---|
| id | Long | The ID of the Agent. |
| version | String | The version of the Agent. |
| installHome | String | The installation directory of the Agent. |
| logHome | String | The log directory of the Agent. |
| lastAvailableTime | String | The last time when the Agent was available. |
| hostId | Long | The ID of the host. |
| hostInnerIpAddress | String | The IP address of the host. |
| status | String | The status of the Agent. Valid values: AVAILABLE, RESTARTING, STOPPING, REINSTALLING, OFFLINE, and DELETED. |
| processes | Array | For more information, see HostAgentProcess data structure. |
| createTime | String | The creation time. |
| updateTime | String | The modification time. |
HostAgentProcess data structure
Parameter |
Type |
Description |
|---|---|---|
| id | Long | The ID of the Agent process. |
| hostId | Long | The ID of the host. |
| alias | String | The alias of the process. |
| pid | Integer | The PID of the process. |
| user | String | The user of the process. |
| startCommand | String | The startup command. |
| ports | String | The open ports. |
| elapsedTime | Long | The time that the process has been running, in seconds. |
| lastActiveTime | String | The last time when the process was active. |
| status | String | The status of the process. Valid values: STOPPED and STARTED. |
| operable | Boolean | Indicates whether the process is user-operable. |
| logFilePattern | String | The log file name template. |
| createTime | String | The creation time. |
| updateTime | String | The modification time. |
Example
Request example
GET /api/v2/compute/hosts/20/agent
Response example
{
"data": {
"createTime": "2023-04-19T23:26:04+08:00",
"hostId": 1,
"hostInnerIpAddress": "xx.xx.xx.xx",
"id": 1,
"installHome": "/home/admin/ocp_agent",
"lastAvailableTime": "2023-04-20T11:17:31+08:00",
"logHome": "/home/admin/ocp_agent/log",
"managerPort": "62888",
"monitorPort": "62889",
"processes": [{
"alias": "ocp_mgragent",
"createTime": "2023-04-19T23:26:04+08:00",
"elapsedTime": 42690,
"hostId": 1,
"id": 1,
"lastActiveTime": "2023-04-20T11:17:31+08:00",
"logFilePattern": "/home/admin/ocp_agent/log/mgragent.log*",
"operable": false,
"pid": 170643,
"ports": "62888",
"startCommand": "/home/admin/ocp_agent/bin/ocp_mgragent",
"status": "STARTED",
"updateTime": "2023-04-19T23:26:04+08:00",
"user": "root"
},
{
"alias": "ocp_monagent",
"createTime": "2023-04-19T23:26:04+08:00",
"elapsedTime": 42690,
"hostId": 1,
"id": 2,
"lastActiveTime": "2023-04-20T11:17:31+08:00",
"logFilePattern": "/home/admin/ocp_agent/log/monagent.log*",
"operable": false,
"pid": 170644,
"ports": "62889",
"startCommand": "/home/admin/ocp_agent/bin/ocp_monagent",
"status": "STARTED",
"updateTime": "2023-04-19T23:26:04+08:00",
"user": "root"
},
{
"alias": "ocp_agentd",
"createTime": "2023-04-19T23:26:04+08:00",
"elapsedTime": 42690,
"hostId": 1,
"id": 3,
"lastActiveTime": "2023-04-20T11:17:32+08:00",
"logFilePattern": "/home/admin/ocp_agent/log/agentd.log*",
"operable": false,
"pid": 170637,
"ports": null,
"startCommand": "/home/admin/ocp_agent/bin/ocp_agentd -c /home/admin/ocp_agent/conf/agentd.yaml",
"status": "STARTED",
"updateTime": "2023-04-19T23:26:04+08:00",
"user": "root"
}],
"status": "AVAILABLE",
"updateTime": "2023-04-20T11:17:31+08:00",
"version": "4.1.0-20230419214837"
},
"duration": 15,
"server": "a322af9644",
"status": 200,
"successful": true,
"timestamp": "2023-04-20T11:17:35.298+08:00",
"traceId": "365eedcd17b84fd5"
}
