Create SNMP Agent

POST/zstack/v1/snmp/agent

Headers

Authorization: OAuth the-session-uuid

Body

{
  "params": {
    "version": "v3",
    "userName": "zstack",
    "authAlgorithm": "SHA512",
    "authPassword": "auth_password",
    "privacyAlgorithm": "DES",
    "privacyPassword": "priv_password",
    "port": 161
  },
  "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 POST -d '{"params":{"version":"v3","userName":"zstack","authAlgorithm":"SHA512","authPassword":"auth_password","privacyAlgorithm":"DES","privacyPassword":"priv_password","port":161}}' \
http://localhost:8080/zstack/v1/snmp/agent

Parameter List

Name

Type

Location

Description

Allowed Values

Starting Version

version

String

body (contained in the params structure)

SNMP agent protocol version

  • v2c
  • v3

4.10.0

readCommunity (optional)

String

body (contained in the params structure)

Read community string (used when version is v2c)

 

4.10.0

userName (optional)

String

body (contained in the params structure)

Username (used when version is v3)

 

4.10.0

authAlgorithm (optional)

String

body (contained in the params structure)

Authentication algorithm

  • MD5
  • SHA
  • SHA224
  • SHA256
  • SHA384
  • SHA512

4.10.0

authPassword (optional)

String

body (contained in the params structure)

Authentication password

 

4.10.0

privacyAlgorithm (optional)

String

body (contained in the params structure)

Privacy algorithm

  • DES
  • AES128
  • AES192
  • AES256
  • 3DES

4.10.0

privacyPassword (optional)

String

body (contained in the params structure)

Privacy password

 

4.10.0

port

int

body (contained in the params structure)

Port

 

4.10.0

resourceUuid (optional)

String

body (contained in the params structure)

Resource UUID

 

4.10.0

tagUuids (optional)

List

body (contained in the params structure)

Tag UUID list

 

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": "6dac2a94d44c3216acc13286a50416aa",
    "version": "v3",
    "userName": "zstack",
    "authAlgorithm": "SHA512",
    "authPassword": "auth_password",
    "privacyAlgorithm": "DES",
    "privacyPassword": "priv_password",
    "port": 161,
    "status": "Enable",
    "securityLevel": "authPriv"
  }
}
NameTypeDescriptionStarting Version
successboolean 4.10.0
errorErrorCodeError code. If not null, the operation failed. This field is null when the operation succeeds. See error4.10.0
inventorySnmpAgentInventorySee inventory4.10.0

error

NameTypeDescriptionStarting Version
codeStringError code number. A globally unique identifier for the error, e.g., SYS.1000, HOST.10014.10.0
descriptionStringBrief description of the error4.10.0
detailsStringDetailed error information4.10.0
elaborationStringReserved field. Defaults to null4.10.0
opaqueLinkedHashMapReserved field. Defaults to null4.10.0
causeErrorCodeRoot error. The source error that caused this error. Null if no root cause exists4.10.0

inventory

NameTypeDescriptionStarting Version
uuidStringResource UUID. Uniquely identifies the resource4.10.0
versionStringSNMP agent protocol version4.10.0
readCommunityStringRead community string (used when version is v2c)4.10.0
userNameStringUsername (used when version is v3)4.10.0
authAlgorithmStringAuthentication algorithm4.10.0
authPasswordStringAuthentication password4.10.0
privacyAlgorithmStringPrivacy algorithm4.10.0
privacyPasswordStringPrivacy password4.10.0
portintPort4.10.0
statusStringWhether the SNMP agent is enabled4.10.0
securityLevelStringSecurity level4.10.0
createDateTimestampCreation time4.10.0
lastOpDateTimestampLast modification time4.10.0

SDK Examples

Java SDK

CreateSnmpAgentAction action = new CreateSnmpAgentAction();
action.version = "v3";
action.userName = "zstack";
action.authAlgorithm = "SHA512";
action.authPassword = "auth_password";
action.privacyAlgorithm = "DES";
action.privacyPassword = "priv_password";
action.port = 161;
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
CreateSnmpAgentAction.Result res = action.call();

Python SDK

CreateSnmpAgentAction action = CreateSnmpAgentAction()
action.version = "v3"
action.userName = "zstack"
action.authAlgorithm = "SHA512"
action.authPassword = "auth_password"
action.privacyAlgorithm = "DES"
action.privacyPassword = "priv_password"
action.port = 161
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
CreateSnmpAgentAction.Result res = action.call()