
# 查询数据库Agent列表 - ListAuditAgentNew
#### 功能介绍
查询数据库Agent列表
#### 调试
您可以在[API Explorer](https://console.huaweicloud.com/apiexplorer/#/openapi/DBSS/doc?api=ListAuditAgentNew)中调试该接口，支持自动认证鉴权。API Explorer可以自动生成SDK代码示例，并提供SDK代码示例调试功能。
#### 授权信息
账号具备所有API的调用权限，如果使用账号下的IAM用户调用当前API，该IAM用户需具备调用API所需的权限，具体权限要求请参见[权限和授权项](https://support.huaweicloud.com/api-dbss/dbss_01_0428.html)。
#### URI
GET /v3/{project_id}/audit/{instance_id}/agents
表1路径参数 
| 参数          | 是否必选 | 参数类型   | 描述                                                                                                                                                                                                                                                                                                                                                                               |
|:---|:---|:---|:---|
| project_id  | 是    | String | **参数解释**： 项目ID。可通过IAM服务\[查询指定IAM用户的项目列表\]接口获取。 **约束限制**： 不涉及 **取值范围**： 以IAM服务接口返回值为准，字符长度32-64。 **默认取值**： 不涉及 |
| instance_id | 是    | String | **参数解释**： 实例ID。可通过查询实例列表接口ID字段获取 **约束限制**： 不涉及 **取值范围**： 以查询实例列表接口值为准，字符长度32-64。 **默认取值**： 不涉及                |
   
表2Query参数 
| 参数    | 是否必选 | 参数类型   | 描述                                                                                                                                                                                                                                                                                                                                                                    |
|:---|:---|:---|:---|
| db_id | 是    | String | **参数解释**： 数据库ID, 可在查询数据库列表接口ID字段获取。 **约束限制**： 不涉及 **取值范围**： 以查询数据库列表接口值为准，字符长度16-64。 **默认取值**： 不涉及 |
   
#### 请求参数
表3请求Header参数 
| 参数           | 是否必选 | 参数类型   | 描述                                                                                                                                                                                                                                                                                                                                                                                             |
|:---|:---|:---|:---|
| X-Auth-Token | 是    | String | **参数解释**： 用户Token。通过调用IAM服务查询用户Token接口获取（响应消息头中X-Subject-Token的值）。 **约束限制**： 不涉及 **取值范围**： IAM服务查询用户Token接口为准 **默认取值**： 不涉及 |
   
#### 响应参数
**状态码：200**
表4响应Body参数 
| 参数     | 参数类型                                                           | 描述      |
|:---|:---|:---|
| agents | Array of [agents] objects | agent列表 |
   
 表5agents 
| 参数             | 参数类型    | 描述                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                             |
|:---|:---|:---|
| agent_id       | String  | agent ID                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       |
| agent_type     | String  | agent 类型 - DB：数据库端   - APP：应用端                                                                                                                                                                                                                                                                                     |
| agent_os       | String  | agent OS                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       |
| agent_ip       | String  | agent安装节点IP                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    |
| mem_threshold  | Integer | 内存阈值                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           |
| cpu_threshold  | Integer | cpu阈值                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          |
| status         | Integer | agent状态 - 1：开启   - 0：关闭                                                                                                                                                                                                                                                                                            |
| agent_nic      | String  | agent网卡                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        |
| db_name        | String  | 数据库名称                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          |
| datacap_status | Integer | 数据流量抓取状态 - 1：运行中   - 2：休眠中   - 3：已停止   - 4：异常    |
| agent_url      | String  | agent安装地址                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      |
| universal      | Boolean | 是否CCE场景                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        |
| sha256         | String  | sha256值                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        |
   
**状态码：400**
表6响应Body参数 
| 参数                            | 参数类型                                                                             | 描述         |
|:---|:---|:---|
| details                       | Array of [DbssErrorDetail] objects | PDP5鉴权异常信息 |
| encoded_authorization_message | String                                                                           | PDP5鉴权异常信息 |
| error_code                    | String                                                                           | 错误码        |
| error_msg                     | String                                                                           | 错误信息       |
   
 表7DbssErrorDetail 
| 参数         | 参数类型   | 描述       |
|:---|:---|:---|
| error_code | String | 错误码      |
| error_msg  | String | PDP5错误信息 |
   
**状态码：403**
表8响应Body参数 
| 参数                            | 参数类型                                                                               | 描述         |
|:---|:---|:---|
| details                       | Array of [DbssErrorDetail] objects | PDP5鉴权异常信息 |
| encoded_authorization_message | String                                                                             | PDP5鉴权异常信息 |
| error_code                    | String                                                                             | 错误码        |
| error_msg                     | String                                                                             | 错误信息       |
   
 表9DbssErrorDetail 
| 参数         | 参数类型   | 描述       |
|:---|:---|:---|
| error_code | String | 错误码      |
| error_msg  | String | PDP5错误信息 |
   
**状态码：500**
表10响应Body参数 
| 参数                            | 参数类型                                                                               | 描述         |
|:---|:---|:---|
| details                       | Array of [DbssErrorDetail] objects | PDP5鉴权异常信息 |
| encoded_authorization_message | String                                                                             | PDP5鉴权异常信息 |
| error_code                    | String                                                                             | 错误码        |
| error_msg                     | String                                                                             | 错误信息       |
   
 表11DbssErrorDetail 
| 参数         | 参数类型   | 描述       |
|:---|:---|:---|
| error_code | String | 错误码      |
| error_msg  | String | PDP5错误信息 |
   
#### 请求示例
```
/v3/{project_id}/audit/{instance_id}/agents
```
#### 响应示例
**状态码：200**
成功
```
{
  "agents" : [ {
    "agent_id" : "X1miCo8BDdIO3rwSbhug",
    "agent_type" : "DB",
    "agent_os" : "LINUX64_X86",
    "agent_ip" : "2407:c080:11f0:23b:59d5:7ddf:5650:447b",
    "agent_nic" : "",
    "cpu_threshold" : 80,
    "mem_threshold" : 80,
    "db_name" : "",
    "status" : 1,
    "datacap_status" : 1,
    "agent_url" : "/opt/dbss_audit/audit_server/agent/",
    "universal" : false,
    "sha256" : "2619a4fc8ff3b3dda48c4347630bc8d7ece2e1f046eab7ac044e7d0df49886e3"
  } ]
}
```
#### 状态码
| 状态码 | 描述      |
|:---|:---|
| 200 | 成功      |
| 400 | 请求参数错误  |
| 403 | 认证失败    |
| 500 | 服务器内部错误 |
   
#### 错误码
请参见[错误码](https://support.huaweicloud.com/api-dbss/ErrorCode.html)。
