Update SNMP Agent
Headers
Authorization: OAuth the-session-uuidBody
{
"updateSnmpAgent": {
"version": "v2c",
"readCommunity": "zstack",
"port": 1161
},
"systemTags": [],
"userTags": []
}The systemTags and userTags fields in the above example are optional. They are listed to indicate that the body can contain these two fields.
Curl Example
curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X PUT -d '{"updateSnmpAgent":{"version":"v2c","readCommunity":"zstack","port":1161}}' \
http://localhost:8080/zstack/v1/snmp/agent/actionsParameter List
Name | Type | Location | Description | Allowed Values | Starting Version |
|---|---|---|---|---|---|
uuid | String | body (contained in the updateSnmpAgent structure) | Resource UUID. Uniquely identifies the resource |
| 4.10.0 |
version | String | body (contained in the updateSnmpAgent structure) | SNMP agent protocol version |
| 4.10.0 |
readCommunity (optional) | String | body (contained in the updateSnmpAgent structure) | Read community string (used when version is v2c) |
| 4.10.0 |
userName (optional) | String | body (contained in the updateSnmpAgent structure) | Username (used when version is v3) |
| 4.10.0 |
authAlgorithm (optional) | String | body (contained in the updateSnmpAgent structure) | Authentication algorithm |
| 4.10.0 |
authPassword (optional) | String | body (contained in the updateSnmpAgent structure) | Authentication password |
| 4.10.0 |
privacyAlgorithm (optional) | String | body (contained in the updateSnmpAgent structure) | Privacy algorithm |
| 4.10.0 |
privacyPassword (optional) | String | body (contained in the updateSnmpAgent structure) | Privacy password |
| 4.10.0 |
port | int | body (contained in the updateSnmpAgent structure) | Port |
| 4.10.0 |
systemTags (optional) | List | body | System tags |
| 4.10.0 |
userTags (optional) | List | body | User tags |
| 4.10.0 |
API Response
Response Example
{
"inventory": {
"uuid": "cad9965ebedd495aa1f5718f31da1aa8",
"version": "v3",
"userName": "zstack",
"authAlgorithm": "SHA",
"authPassword": "authPassword",
"privacyAlgorithm": "AES128",
"privacyPassword": "privPassword",
"port": 162
}
}| Name | Type | Description | Starting Version |
|---|---|---|---|
| success | boolean | 4.10.0 | |
| error | ErrorCode | Error code. If not null, the operation failed. This field is null when the operation succeeds. See error | 4.10.0 |
| inventory | SnmpAgentInventory | See inventory | 4.10.0 |
error
| Name | Type | Description | Starting Version |
|---|---|---|---|
| code | String | Error code number. A globally unique identifier for the error, e.g., SYS.1000, HOST.1001 | 4.10.0 |
| description | String | Brief description of the error | 4.10.0 |
| details | String | Detailed error information | 4.10.0 |
| elaboration | String | Reserved field. Defaults to null | 4.10.0 |
| opaque | LinkedHashMap | Reserved field. Defaults to null | 4.10.0 |
| cause | ErrorCode | Root error. The source error that caused this error. Null if no root cause exists | 4.10.0 |
inventory
| Name | Type | Description | Starting Version |
|---|---|---|---|
| uuid | String | Resource UUID. Uniquely identifies the resource | 4.10.0 |
| version | String | SNMP agent protocol version | 4.10.0 |
| readCommunity | String | Read community string (used when version is v2c) | 4.10.0 |
| userName | String | Username (used when version is v3) | 4.10.0 |
| authAlgorithm | String | Authentication algorithm | 4.10.0 |
| authPassword | String | Authentication password | 4.10.0 |
| privacyAlgorithm | String | Privacy algorithm | 4.10.0 |
| privacyPassword | String | Privacy password | 4.10.0 |
| port | int | Port | 4.10.0 |
| status | String | Whether the SNMP agent is enabled | 4.10.0 |
| securityLevel | String | Security level | 4.10.0 |
| createDate | Timestamp | Creation time | 4.10.0 |
| lastOpDate | Timestamp | Last modification time | 4.10.0 |
SDK Examples
Java SDK
UpdateSnmpAgentAction action = new UpdateSnmpAgentAction();
action.version = "v2c";
action.readCommunity = "zstack";
action.port = 1161;
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
UpdateSnmpAgentAction.Result res = action.call();Python SDK
UpdateSnmpAgentAction action = UpdateSnmpAgentAction()
action.version = "v2c"
action.readCommunity = "zstack"
action.port = 1161
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
UpdateSnmpAgentAction.Result res = action.call()