首批通过分布式安全可靠测评,为关键业务系统打造
查询主机的 OCP Agent 详情
更新时间:2023-08-10 11:45:58
功能说明
获取指定主机上 OCP Agent 详细信息。
调用说明
接口约束
调用者需要具备 HOST_VIEWER 权限。
请求路径
GET /compute/hosts/{hostId}/agent
请求参数
| 参数 | 类型 | 必选 | 示例值 | 描述 |
|---|---|---|---|---|
| hostId | Long | 是 | 100 | 主机 ID |
返回结果
| 参数 | 类型 | 说明 |
|---|---|---|
| successful | Boolean | 请求是否成功。 |
| timestamp | Datetime | 服务端完成请求的时间戳。 |
| duration | Integer | 服务端处理请求的时间(毫秒)。 |
| status | Integer | 符合 HTTP Status 规范的编码。 |
| traceId | String | 请求的 Trace ID,用于排查问题。 |
| server | String | 响应请求的应用服务的地址。 |
| data | Object | 详情参见下文 HostAgent 信息的数据结构。 |
HostAgent 信息的数据结构
| 参数 | 类型 | 说明 |
|---|---|---|
| id | Long | Agent ID |
| version | String | Agent 版本 |
| installHome | String | Agent 安装目录 |
| logHome | String | Agent 日志目录 |
| lastAvailableTime | String | 最近存活时间 |
| hostId | Long | 主机 ID |
| hostInnerIpAddress | String | 主机 IP |
| status | String | Agent 状态,可以为 STOPPED、STARTED |
| processes | Array | 详情参见下文 HostAgentProcess 的数据结构 |
| createTime | String | 创建时间 |
| updateTime | 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 /api/v2/compute/hosts/20/agent
返回示例
{
"data": {
"createTime": "2021-08-03T14:45:50+08:00",
"hostId": 20,
"hostInnerIpAddress": "xxx.xxx.xxx.xxx",
"id": 2000021,
"installHome": "/home/admin/ocp_agent",
"lastAvailableTime": "2021-09-02T17:29:26+08:00",
"logHome": "/home/admin/ocp_agent/log",
"processes": [
{
"alias": "ocp_agentd",
"createTime": "2021-08-03T14:45:50+08:00",
"elapsedTime": 2601817,
"hostId": 20,
"id": 181,
"lastActiveTime": "2021-09-02T17:29:27+08:00",
"logFilePattern": "/home/admin/ocp_agent/log/ocp_agentd.log*",
"operable": false,
"pid": 6337,
"ports": "",
"startCommand": "ocp_agentd",
"status": "STARTED",
"updateTime": "2021-08-03T14:45:50+08:00",
"user": "root"
},
{
"alias": "pos_proxy",
"createTime": "2021-08-03T14:45:50+08:00",
"elapsedTime": 2601816,
"hostId": 20,
"id": 182,
"lastActiveTime": "2021-09-02T17:29:27+08:00",
"logFilePattern": "/home/admin/ocp_agent/log/pos_proxy.log*",
"operable": false,
"pid": 6434,
"ports": "62888",
"startCommand": "pos_proxy",
"status": "STARTED",
"updateTime": "2021-08-03T14:45:50+08:00",
"user": "root"
},
{
"alias": "node_exporter",
"createTime": "2021-08-03T14:45:50+08:00",
"elapsedTime": 2601816,
"hostId": 20,
"id": 183,
"lastActiveTime": "2021-09-02T17:29:27+08:00",
"logFilePattern": "/home/admin/ocp_agent/log/node_exporter.log*",
"operable": true,
"pid": 6445,
"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-08-03T14:45:50+08:00",
"user": "root"
},
{
"alias": "ocp_exporter",
"createTime": "2021-08-03T14:45:50+08:00",
"elapsedTime": 693340,
"hostId": 20,
"id": 184,
"lastActiveTime": "2021-09-02T17:29:27+08:00",
"logFilePattern": "/home/admin/ocp_agent/log/ocp_exporter.log*",
"operable": true,
"pid": 116363,
"ports": "62889",
"startCommand": "ocp_exporter",
"status": "STARTED",
"updateTime": "2021-08-25T16:53:49+08:00",
"user": "root"
},
{
"alias": "obstat2",
"createTime": "2021-08-03T15:02:44+08:00",
"elapsedTime": 2600802,
"hostId": 20,
"id": 185,
"lastActiveTime": "2021-09-02T17:29:27+08:00",
"logFilePattern": "/home/admin/ocp_agent/log/obstat2.log*",
"operable": true,
"pid": 38429,
"ports": "",
"startCommand": "/home/admin/ocp_agent/obagent/obstat2 -o http://xxx.xxx.xxx.xxx:80 -c stress __obproxy__ -f 20",
"status": "STARTED",
"updateTime": "2021-08-03T15:03:27+08:00",
"user": "root"
},
{
"alias": "ob_logtailer",
"createTime": "2021-08-03T15:02:44+08:00",
"elapsedTime": 2600802,
"hostId": 20,
"id": 186,
"lastActiveTime": "2021-09-02T17:29:27+08:00",
"logFilePattern": "/home/admin/ocp_agent/log/ob_logtailer.log*",
"operable": true,
"pid": 38468,
"ports": "",
"startCommand": "ob_logtailer",
"status": "STARTED",
"updateTime": "2021-08-03T15:03:27+08:00",
"user": "root"
},
{
"alias": "ob_cleaner",
"createTime": "2021-08-03T15:02:44+08:00",
"elapsedTime": 0,
"hostId": 20,
"id": 187,
"lastActiveTime": "2021-08-25T17:48:28+08:00",
"logFilePattern": "/home/admin/ocp_agent/log/ob_cleaner.log*",
"operable": true,
"pid": 0,
"ports": null,
"startCommand": null,
"status": "STOPPED",
"updateTime": "2021-08-25T17:49:28+08:00",
"user": null
}
],
"status": "AVAILABLE",
"updateTime": "2021-09-02T17:29:25+08:00",
"version": "3.1.0-1928505"
},
"duration": 69,
"server": "a83ad33525",
"status": 200,
"successful": true,
"timestamp": "2021-09-02T17:30:16.752+08:00",
"traceId": "770210ec54924426"
}