Batch Retrieval of bsm-agent State within Instances
Updated at:2025-10-20
Batch Retrieval of bsm-agent State within Instances
API description
Retrieve the bsm-agent state for up to 100 virtual machines in batches.
Request parameters
| Parameter name | Types | Required or not | Description |
|---|---|---|---|
| instance_list | List<Instance> | Yes | Virtual machine list |
Response parameters
| Parameter name | Types | Description |
|---|---|---|
| requestId | String | Request ID |
| code | String | Response state, where successful execution is indicated by success. |
| result | List<Agent> | bsm-agent state in virtual machine |
Request example
Python
1from baidubce.auth.bce_credentials import BceCredentials
2from baidubce.bce_client_configuration import BceClientConfiguration
3from baidubce.services.ca import ca_client, ca_model
4if __name__ == '__main__':
5 HOST = b'http://ca.bj.baidubce.com'
6 AK = b'ak'
7 SK = b'sk'
8
9 config = BceClientConfiguration(credentials=BceCredentials(AK, SK),endpoint=HOST)
10 client = ca_client.CaClient(config)
11 instance_list = [
12 ca_model.Instance("i-9y7wPdlG"),
13 ca_model.Instance("i-ZCHupg0z")
14 ]
15 response = client.batch_get_agent(instance_list)
16 print(response)
Response example
JSON
1{
2 "requestId": "d8752367-38e8-45e4-b4c7-e53be3******",
3 "code": "success",
4 "result": [
5 {
6 "host": {
7 "instanceId": "i-LxvHe***"
8 },
9 "state": "ONLINE",
10 "version": "0.0.0.1"
11 },
12 {
13 "host": {
14 "instanceId": "i-gVGDt***"
15 },
16 "state": "OFFLINE",
17 "version": "0.0.0.1"
18 }
19 ]
20}
Appendix - data structures
Agent
| Parameter name | Types | Description |
|---|---|---|
| host | Host | Instance information |
| state | String | bsm-agent states. Possible values: ONLINE (online), OFFLINE (offline). |
| version | String | bsm-agent version No., e.g., 4.2.0.1 |
Instance
| Parameter name | Types | Description |
|---|---|---|
| instanceId | String | Instance ID, e.g., BCC instance ID: i-gVGDt*** |
