批量获取实例内bsm-agent状态
批量获取实例内bsm-agent状态
接口描述
批量获取最多100台虚机内bsm-agent的状态。
请求参数
参数名称 |
类型 |
是否必选 |
描述 |
instance_list |
List<Instance> |
是 |
虚机列表 |
响应参数
参数名称 |
类型 |
描述 |
requestId |
String |
请求id |
code |
String |
响应状态,成功为success |
result |
List<Agent> |
虚机bsm-agent状态 |
请求示例
from baidubce.auth.bce_credentials import BceCredentials
from baidubce.bce_client_configuration import BceClientConfiguration
from baidubce.services.ca import ca_client, ca_model
if __name__ == '__main__':
HOST = b'http://ca.bj.baidubce.com'
AK = b'ak'
SK = b'sk'
config = BceClientConfiguration(credentials=BceCredentials(AK, SK),endpoint=HOST)
client = ca_client.CaClient(config)
instance_list = [
ca_model.Instance("i-9y7wPdlG"),
ca_model.Instance("i-ZCHupg0z")
]
response = client.batch_get_agent(instance_list)
print(response)
响应示例
{
"requestId": "d8752367-38e8-45e4-b4c7-e53be3******",
"code": "success",
"result": [
{
"host": {
"instanceId": "i-LxvHe***"
},
"state": "ONLINE",
"version": "0.0.0.1"
},
{
"host": {
"instanceId": "i-gVGDt***"
},
"state": "OFFLINE",
"version": "0.0.0.1"
}
]
}
附录-数据结构
Agent
参数名称 |
类型 |
描述 |
host |
Host |
实例信息 |
state |
String |
bsm-agent状态。枚举值:ONLINE(在线),OFFLINE(离线) |
version |
String |
bsm-agent版本号,如4.2.0.1 |
Instance
参数名称 |
类型 |
描述 |
instanceId |
String |
实例id,如bcc实例id: i-gVGDt*** |