首批通过分布式安全可靠测评,为关键业务系统打造
查询主机的 OCP Agent 的工作进程列表
更新时间:2023-08-10 11:45:58
功能说明
查询主机的 OCP Agent 的工作进程列表。
调用说明
接口约束
调用者需要具备 HOST_VIEWER 权限。
请求路径
GET /compute/hosts/{hostId}/agent/processes
请求参数
| 参数 | 类型 | 必选 | 示例值 | 描述 |
|---|---|---|---|---|
| hostId | Long | 是 | 100 | 主机 ID |
返回结果
| 参数 | 类型 | 说明 |
|---|---|---|
| data | Object | 请求的数据。 |
| ├─ contents | Array | HostAgentProcess 的数组,详细数据结构见下表。 |
| ├─ page | Object | 分页信息。 |
| ├─ totalElements | Integer | 总记录数。 |
| ├─ totalPage | Integer | 总页数。 |
| ├─ number | Integer | 当前页码。 |
| ├─ size | Integer | 当前页大小。 |
| successful | Boolean | 请求是否成功。 |
| timestamp | Datetime | 服务端完成请求的时间戳。 |
| duration | Integer | 服务端处理请求的时间(毫秒)。 |
| status | Integer | 符合 HTTP Status 规范的编码。 |
| traceId | String | 请求的 Trace ID,用于排查问题。 |
| server | String | 响应请求的应用服务的地址。 |
HostAgentProcess 的数据结构
| 参数 | 类型 | 说明 |
|---|---|---|
| id | Long | Agent 进程 ID |
| hostId | Long | 主机 ID |
| alias | String | 进程别名 |
| pid | Integer | 进程 PID |
| user | String | 进程用户 |
| startCommand | String | 启动命令 |
| ports | String | 开放端口 |
| elapsedTime | Long | 已存活时间(秒) |
| lastActiveTime | String | 最近存活时间 |
| status | String | 进程状态,可以为 STOPPED、STARTED |
| operable | Boolean | 是否用户可操作 |
| logFilePattern | String | 日志文件名模版 |
| createTime | String | 创建时间 |
| updateTime | String | 修改时间 |
示例
请求示例
GET /compute/hosts/10/agent/processes?page=1&size=10
返回示例
{
"data": {
"contents": [
{
"alias": "ocp_agentd",
"createTime": "2021-07-19T19:28:31+08:00",
"elapsedTime": 8801025,
"hostId": 2,
"id": 137,
"lastActiveTime": "2021-09-03T10:58:28+08:00",
"logFilePattern": "/home/admin/ocp_agent/log/ocp_agentd.log*",
"operable": false,
"pid": 8724,
"ports": "",
"startCommand": "ocp_agentd",
"status": "STARTED",
"updateTime": "2021-07-19T19:28:31+08:00",
"user": "root"
},
{
"alias": "pos_proxy",
"createTime": "2021-07-19T19:28:32+08:00",
"elapsedTime": 8801020,
"hostId": 2,
"id": 143,
"lastActiveTime": "2021-09-03T10:58:28+08:00",
"logFilePattern": "/home/admin/ocp_agent/log/pos_proxy.log*",
"operable": false,
"pid": 8851,
"ports": "62888",
"startCommand": "pos_proxy",
"status": "STARTED",
"updateTime": "2021-07-19T19:28:32+08:00",
"user": "root"
},
{
"alias": "node_exporter",
"createTime": "2021-07-19T19:28:33+08:00",
"elapsedTime": 8801020,
"hostId": 2,
"id": 151,
"lastActiveTime": "2021-09-03T10:58:28+08:00",
"logFilePattern": "/home/admin/ocp_agent/log/node_exporter.log*",
"operable": true,
"pid": 8865,
"ports": "63000",
"startCommand": "/home/admin/ocp_agent/agent/node_exporter --web.listen-address=:63000 --no-collector.arp --no-collector.bcache --no-collector.edac --no-collector.textfile --no-collector.time --no-collector.timex --no-collector.uname --no-collector.vmstat --no-collector.xfs --no-collector.zfs --no-collector.cpufreq --no-collector.conntrack --no-collector.entropy --no-collector.ipvs --no-collector.mdadm --no-collector.netclass --no-collector.netstat --no-collector.nfs --no-collector.nfsd --no-collector.pressure --no-collector.sockstat --no-collector.stat",
"status": "STARTED",
"updateTime": "2021-07-19T19:28:33+08:00",
"user": "root"
},
{
"alias": "ocp_exporter",
"createTime": "2021-07-19T19:28:34+08:00",
"elapsedTime": 8801020,
"hostId": 2,
"id": 158,
"lastActiveTime": "2021-09-03T10:58:28+08:00",
"logFilePattern": "/home/admin/ocp_agent/log/ocp_exporter.log*",
"operable": true,
"pid": 8817,
"ports": "62889",
"startCommand": "ocp_exporter",
"status": "STARTED",
"updateTime": "2021-07-19T19:28:34+08:00",
"user": "root"
},
{
"alias": "obstat2",
"createTime": "2021-07-19T19:28:35+08:00",
"elapsedTime": 659777,
"hostId": 2,
"id": 163,
"lastActiveTime": "2021-09-03T10:58:28+08:00",
"logFilePattern": "/home/admin/ocp_agent/log/obstat2.log*",
"operable": true,
"pid": 7297,
"ports": "",
"startCommand": "/home/admin/ocp_agent/obagent/obstat2 -o http://xxx.xxx.xxx.xxx:80 -c ob20daily.xiaojun.chengxj __obproxy__ -f 20",
"status": "STARTED",
"updateTime": "2021-07-19T19:28:35+08:00",
"user": "root"
},
{
"alias": "ob_logtailer",
"createTime": "2021-07-19T19:28:36+08:00",
"elapsedTime": 8801020,
"hostId": 2,
"id": 169,
"lastActiveTime": "2021-09-03T10:58:29+08:00",
"logFilePattern": "/home/admin/ocp_agent/log/ob_logtailer.log*",
"operable": true,
"pid": 9062,
"ports": "",
"startCommand": "ob_logtailer",
"status": "STARTED",
"updateTime": "2021-07-19T19:28:36+08:00",
"user": "root"
}
],
"page": {
"number": 1,
"size": 10,
"totalElements": 6,
"totalPages": 1
}
},
"duration": 63,
"server": "a83ad33525",
"status": 200,
"successful": true,
"timestamp": "2021-09-03T10:58:59.011+08:00",
"traceId": "b27e46f749284205"
}