Document navigation

SNMP Operations

CreateSnmpAgent

API Request

URLs
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": []
}
Note: In the preceding sample, both systemTags and userTags are optional. These two fields can be included in the body structure.
Curl Sample
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
Parameters
Name Type Location Description Valid Values Starting Version
version String body (contained in the params structure) The protocol version.
  • v2c
  • v3
4.7.21
readCommunity String body (contained in the params structure) Optional. The read community (used when for v2c version). 4.7.21
userName String body (contained in the params structure) Optional. The user name (used for v3 version). 4.7.21
authAlgorithm String body (contained in the params structure) Optional. The authentication algorithm.
  • MD5
  • SHA
  • SHA224
  • SHA256
  • SHA384
  • SHA512
4.7.21
authPassword String body (contained in the params structure) Optional. The authentication password. 4.7.21
privacyAlgorithm String body (contained in the params structure) Optional. The privacy algorithm.
  • DES
  • AES128
  • AES192
  • AES256
  • 3DES
4.7.21
privacyPassword String body (contained in the params structure) Optional. The privacy password. 4.7.21
port int body (contained in the params structure) The port. 4.7.21
resourceUuid String body (contained in the params structure) Optional. The resource UUID. 4.7.21
tagUuids List body (contained in the params structure) Optional. The tag UUID. 4.7.21
systemTags List body Optional. the system tags. 4.7.21
userTags List body Optional. The user tags. 4.7.21

API Response

Response Sample
{
  "inventory": {
    "uuid": "6dac2a94d44c3216acc13286a50416aa",
    "version": "v3",
    "userName": "zstack",
    "authAlgorithm": "SHA512",
    "authPassword": "auth_password",
    "privacyAlgorithm": "DES",
    "privacyPassword": "priv_password",
    "port": 161,
    "status": "Enable",
    "securityLevel": "authPriv"
  }
}
Name Type Description Starting Version
success boolean 4.7.21
error ErrorCode The error code. If not null, the operation fails, or vice versa. For more information, see error. 4.7.21
inventory SnmpAgentInventory See inventory. 4.7.21
#error
Name Type Description Starting Version
code String The error code, which is a numbered or alphanumeric code that specifies an error. For example, SYS.1000, HOST.1001. 4.7.21
description String The brief description of the error. 4.7.21
details String The details about the error. 4.7.21
elaboration String The reserved field. Default value: null. 4.7.21
opaque LinkedHashMap The reserved field. Default value: null. 4.7.21
cause ErrorCode The root error, which is the associated root cause of the current error. If no root error exists, this parameter is null. 4.7.21
#inventory
Name Type Description Starting Version
uuid String The resource UUID. 4.7.21
version String The protocol version. 4.7.21
readCommunity String The read community (used for the v2c version). 4.7.21
userName String The user name (used for the v3 version). 4.7.21
authAlgorithm String The authentication algorithm. 4.7.21
authPassword String The authentication password. 4.7.21
privacyAlgorithm String The privacy algorithm. 4.7.21
privacyPassword String The privacy password. 4.7.21
port int The port. 4.7.21
status String The SNMP agent status. 4.7.21
securityLevel String The security level. 4.7.21
createDate Timestamp The creation date. 4.7.21
lastOpDate Timestamp The last operation date. 4.7.21

SDK Sample

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()

QuerySnmpAgent

API Request

URLs
GET zstack/v1/snmp/agent
GET zstack/v1/snmp/agent/{uuid}
Headers
Authorization: OAuth the-session-uuid
Curl Sample
curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X GET http://localhost:8080/zstack/v1/snmp/agent
curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X GET http://localhost:8080/zstack/v1/snmp/agent/18c89b48e653385f83db6ecffb48763f

Queryable Fields

You can check all queryable fields and resource names that can be queried across tables by using zstack-cli, entering QuerySnmpAgent, and pressing the Tab key.

API Response

Response Sample
{
  "inventories": [
    {
      "uuid": "f0ef8d847b573c6b86565e1d9111723b",
      "version": "v3",
      "userName": "zstack",
      "authAlgorithm": "SHA512",
      "authPassword": "auth_password",
      "privacyAlgorithm": "DES",
      "privacyPassword": "priv_password",
      "port": 161,
      "status": "Enable",
      "securityLevel": "authPriv"
    }
  ]
}
Name Type Description Starting Version
success boolean 4.7.21
error ErrorCode The error code. If not null, the operation fails, or vice versa. For more information, see error. 4.7.21
inventories List See inventories. 4.7.21
#error
Name Type Description Sarting Version
code String The error code, which is a numbered or alphanumeric code that specifies an error. For example, SYS.1000, HOST.1001. 4.7.21
description String The brief description of the error. 4.7.21
details String The details about the error. 4.7.21
elaboration String The reserved field. Default value: null. 4.7.21
opaque LinkedHashMap The reserved field. Default value: null. 4.7.21
cause ErrorCode The root error, which is the associated root cause of the current error. If no root error exists, this parameter is null. 4.7.21
#inventories
Name Type Description Starting Version
uuid String The resource UUID. 4.7.21
version String The protocol version. 4.7.21
readCommunity String The read community (used for the v2c version). 4.7.21
userName String The user name (used for the v3 version). 4.7.21
authAlgorithm String The authentication algorithm. 4.7.21
authPassword String The authentication password. 4.7.21
privacyAlgorithm String The privacy algorithm. 4.7.21
privacyPassword String The privacy password. 4.7.21
port int The port. 4.7.21
status String The SNMP agent status. 4.7.21
securityLevel String The security level. 4.7.21
createDate Timestamp The creation date. 4.7.21
lastOpDate Timestamp The last operation date. 4.7.21

SDK Sample

Java SDK
QuerySnmpAgentAction action = new QuerySnmpAgentAction();
action.conditions = asList();
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
QuerySnmpAgentAction.Result res = action.call();
Python SDK
QuerySnmpAgentAction action = QuerySnmpAgentAction()
action.conditions = []
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
QuerySnmpAgentAction.Result res = action.call()

StartSnmpAgent

API Request

URLs
PUT zstack/v1/snmp/agent/actions
Headers
Authrization: OAuth the-session-uuid
Body
{
  "startSnmpAgent": {
    "uuid": "2e5ce17390a843da991411d27b67d775"
  },
  "systemTags": [],
  "userTags": []
}
Note: In the preceding sample, both systemTags and userTags are optional. These two fields can be included in the body structure.
Curl Sample
curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X PUT -d '{"startSnmpAgent":{"uuid":"955799e296a94e4aa2ce063a5b1ea4b8"}}' http://localhost:8080/zstack/v1/snmp/agent/actions
Parameters
Name Type Location Description Valid Values Starting Version
uuid String body (contained in the startSnmpAgent structure). The resource UUID. 4.7.21
systemTags List body Optional. The system tags. 4.7.21
userTags List body Optional. The user tags. 4.7.21

API Response

Sample Response
{
  "inventory": {
    "uuid": "eef797ff89d84305b51cc3edcb597909",
    "version": "v3",
    "userName": "zstack",
    "authAlgorithm": "SHA",
    "authPassword": "authPassword",
    "privacyAlgorithm": "AES128",
    "privacyPassword": "privPassword",
    "port": 162
  }
}
Name Type Description Starting Version
success boolean 4.7.21
error ErrorCode The error code. If not null, the operation fails, or vice versa. For more information, see error. 4.7.21
inventory SnmpAgentInventory See inventory. 4.7.21
#error
Name Type Description Starting Version
code String The error code, which is a numbered or alphanumeric code that specifies an error. For example, SYS.1000, HOST.1001. 4.7.21
description String The brief description of the error. 4.7.21
details String The details about the error. 4.7.21
elaboration String The reserved field. Default value: null. 4.7.21
opaque LinkedHashMap The reserved field. Default value: null. 4.7.21
cause ErrorCode The root error, which is the associated root cause of the current error. If no root error exists, this parameter is null. 4.7.21
#inventory
Name Type Description Starting Version
uuid String The resource UUID. 4.7.21
version String The protocol version. 4.7.21
readCommunity String The read community (used for the v2c version) 4.7.21
userName String The user name (used for the v3 version) 4.7.21
authAlgorithm String The authentication algorithm. 4.7.21
authPassword String The authentication password. 4.7.21
privacyAlgorithm String The privacy algorithm. 4.7.21
privacyPassword String The privacy password. 4.7.21
port int The port. 4.7.21
status String The SNMP agent status. 4.7.21
securityLevel String The security level. 4.7.21
createDate Timestamp The creation date. 4.7.21
lastOpDate Timestamp The last operation date. 4.7.21

SDK Sample

Java SDK
StartSnmpAgentAction action = new StartSnmpAgentAction();
action.uuid = "a74555a81a4244bb9ce0f8f2b5691ac5";
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
StartSnmpAgentAction.Result res = action.call();
Python SDK
StartSnmpAgentAction action = StartSnmpAgentAction()
action.uuid = "56f7b7cc6f764c55bf4016cc2257f456"
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
StartSnmpAgentAction.Result res = action.call()

StopSnmpAgent

API Request

URLs
PUT zstack/v1/snmp/agent/actions
Headers
Authorization: OAuth the-session-uuid
Body
{
  "stopSnmpAgent": {
    "uuid": "253c4449901c49f9928d2d7fd2119715"
  },
  "systemTags": [],
  "userTags": []
}
Note: In the preceding sample, both systemTags and userTags are optional. These two fields can be included in the body structure.
Curl Sample
curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X PUT -d '{"stopSnmpAgent":{"uuid":"d3dcbba6129e497480af319ee4e42749"}}' http://localhost:8080/zstack/v1/snmp/agent/actions
Parameters
Name Type Location Description Valid Values Starting Version
uuid String body (contained in the stopSnmpAgent structure). The resource UUID. 4.7.21
systemTags List body Optional. The system tags. 4.7.21
userTags List body Optional. The user tags. 4.7.21

API Response

Sample Response
{
  "inventory": {
    "uuid": "b32ac27ffdd03e7ea7857d318d5cfdd8",
    "version": "v3",
    "userName": "zstack",
    "authAlgorithm": "SHA512",
    "authPassword": "auth_password",
    "privacyAlgorithm": "DES",
    "privacyPassword": "priv_password",
    "port": 161,
    "status": "Enable",
    "securityLevel": "authPriv"
  }
}
Name Type Description Starting Version
success boolean 4.7.21
error ErrorCode The error code. If not null, the operation fails, or vice versa. For more information, see error. 4.7.21
inventory SnmpAgentInventory See inventory. 4.7.21
#error
Name Type Description Starting Version
code String The error code, which is a numbered or alphanumeric code that specifies an error. For example, SYS.1000, HOST.1001. 4.7.21
description String The brief description of the error. 4.7.21
details String The details about the error. 4.7.21
elaboration String The reserved field. Default value: null. 4.7.21
opaque LinkedHashMap The reserved field. Default value: null. 4.7.21
cause ErrorCode The root error, which is the associated root cause of the current error. If no root error exists, this parameter is null. 4.7.21
#inventory
Name Type Description Starting Version
uuid String The resource UUID. 4.7.21
version String The protocol version. 4.7.21
readCommunity String The read community ( used for the v2c version). 4.7.21
userName String The user name (used for the v3 version). 4.7.21
authAlgorithm String The authentication algorithm. 4.7.21
authPassword String The authentication password. 4.7.21
privacyAlgorithm String The privacy algorithm. 4.7.21
privacyPassword String The privacy password. 4.7.21
port int The port. 4.7.21
status String The SNMP agent status. 4.7.21
securityLevel String The security level. 4.7.21
createDate Timestamp The creation data. 4.7.21
lastOpDate Timestamp The last operation date. 4.7.21

SDK Sample

Java SDK
StopSnmpAgentAction action = new StopSnmpAgentAction();
action.uuid = "5b470e397e794dff84efa29375d9cef8";
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
StopSnmpAgentAction.Result res = action.call();
Python SDK
StopSnmpAgentAction action = StopSnmpAgentAction()
action.uuid = "e48db055707445d3b70e8e52f7ee0ca3"
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
StopSnmpAgentAction.Result res = action.call()

UpdateSnmpAgent

API Request

URLs
PUT zstack/v1/snmp/agent/actions
Headers
Authorization: OAuth the-session-uuid
Body
{
  "updateSnmpAgent": {
    "version": "v2c",
    "readCommunity": "zstack",
    "port": 1161
  },
  "systemTags": [],
  "userTags": []
}
Note: In the preceding sample, both systemTags and userTags are optional. These two fields can be included in the body structure.
Curl Sample
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/actions
参数列表
Name Type Location Description Valid Values Starting Version
uuid String body (contained in the updateSnmpAgent structure). The resource UUID. 4.7.21
version String body (contained in the updateSnmpAgent structure). The protocol version.
  • v2c
  • v3
4.7.21
readCommunity String body (contained in theupdateSnmpAgent structure). Optional. The read community (used for the v2c version). 4.7.21
userName String body (contained in theupdateSnmpAgent structure). Optional. The user name (used for the v3 version). 4.7.21
authAlgorithm String body (contained in theupdateSnmpAgent structure). Optional. The authentication algorithm.
  • MD5
  • SHA
  • SHA224
  • SHA256
  • SHA384
  • SHA512
4.7.21
authPassword (可选) String body (contained in theupdateSnmpAgent structure). Optional. The authentication password. 4.7.21
privacyAlgorithm String body (contained in theupdateSnmpAgent structure). Optional. The privacy algorithm.
  • DES
  • AES128
  • AES192
  • AES256
  • 3DES
4.7.21
privacyPassword String body (contained in theupdateSnmpAgent structure). Optional. The privacy password. 4.7.21
port int body (contained in theupdateSnmpAgent structure). The port. 4.7.21
systemTags List body Optional. The system tags. 4.7.21
userTags List body Optional. The user tags. 4.7.21

API Response

Response Sample
{
  "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.7.21
error ErrorCode The error code. If not null, the operation fails, or vice versa. For more information, see error. 4.7.21
inventory SnmpAgentInventory See inventory. 4.7.21
#error
Name Type Description Starting Version
code String The error code, which is a numbered or alphanumeric code that specifies an error. For example, SYS.1000, HOST.1001. 4.7.21
description String The brief description of the error. 4.7.21
details String The details about the error. 4.7.21
elaboration String The reserved field. Default value: null. 4.7.21
opaque LinkedHashMap The reserved field. Default value: null. 4.7.21
cause ErrorCode The root error, which is the associated root cause of the current error. If no root error exists, this parameter is null. 4.7.21
#inventory
Name Type Description Starting Version
uuid String The resource UUID. 4.7.21
version String The protocol version. 4.7.21
readCommunity String The read community (used for the v2c version). 4.7.21
userName String The user name (used for the v3 version). 4.7.21
authAlgorithm String The authentication algorithm. 4.7.21
authPassword String The authentication password. 4.7.21
privacyAlgorithm String The privacy algorithm. 4.7.21
privacyPassword String The privacy password. 4.7.21
port int The port. 4.7.21
status String The SNMP agent status. 4.7.21
securityLevel String The security level. 4.7.21
createDate Timestamp The creation date. 4.7.21
lastOpDate Timestamp The last operation date. 4.7.21

SDK Sample

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()

CreateSNSSnmpEndpoint

API Request

URLs
POST zstack/v1/sns/application-endpoints/snmp
Headers
Authorization: OAuth the-session-uuid
Body
{
  "params": {
    "name": "snmp endpoint",
    "platformUuid": "c453382b049c3280b69157501914870d"
  },
  "systemTags": [],
  "userTags": []
}
Note: In the preceding sample, both systemTags and userTags are optional. These two fields can be included in the body structure.
Curl Sample
curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X POST -d '{"params":{"name":"snmp endpoint","platformUuid":"c453382b049c3280b69157501914870d"}}' http://localhost:8080/zstack/v1/sns/application-endpoints/snmp
Paramerers
Name Type Location Description Valid Values Starting Version
name String body (contained in the params structure). The resource name. 4.7.21
description String body (contained in the params structure). Optional. The resource description. 4.7.21
platformUuid String body (contained in the params structure). Optional. The application platform UUID. 4.7.21
resourceUuid String body (contained in the params structure). Optional. The resource UUID. 4.7.21
tagUuids List body (contained in the params structure). Optional. The tag UUID list. 4.7.21
systemTags List body Optional. The system tags. 4.7.21
userTags List body Optional. The user tags. 4.7.21

API Response

Sample Response
{
  "inventory": {
    "name": "example",
    "uuid": "917fe66f76b241f0843dfbd6be685fc1",
    "description": "description example",
    "type": "Email",
    "state": "Enabled",
    "platformUuid": "4eb0ceebf95b452585ebeacd647d9f35",
    "createDate": "Sep 28, 2023 4:35:44 PM",
    "lastOpDate": "Sep 28, 2023 4:35:44 PM"
  }
}
Name Type Description Starting Version
success boolean 4.7.21
error ErrorCode The error code. If not null, the operation fails, or vice versa. For more information, see error. 4.7.21
inventory SNSApplicationSnmpEndpointInventory See inventory. 4.7.21
#error
Name Type Description Starting Version
code String The error code, which is a numbered or alphanumeric code that specifies an error. For example, SYS.1000, HOST.1001. 4.7.21
description String The brief description of the error. 4.7.21
details String The details about the error. 4.7.21
elaboration String The reserved field. Default value: null. 4.7.21
opaque LinkedHashMap The reserved field. Default value: null. 4.7.21
cause ErrorCode The root error, which is the associated root cause of the current error. If no root error exists, this parameter is null. 4.7.21
#inventory
Name Type Description Starting Version
name String The resource name. 4.7.21
uuid String The resource UUID. 4.7.21
description String The resource description. 4.7.21
type String The type. 4.7.21
platformUuid String The application platform UUID. 4.7.21
createDate Timestamp The creation date. 4.7.21
lastOpDate Timestamp The last operation date. 4.7.21

SDK Sample

Java SDK
CreateSNSSnmpEndpointAction action = new CreateSNSSnmpEndpointAction();
action.name = "snmp endpoint";
action.platformUuid = "c453382b049c3280b69157501914870d";
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
CreateSNSSnmpEndpointAction.Result res = action.call();
Python SDK
CreateSNSSnmpEndpointAction action = CreateSNSSnmpEndpointAction()
action.name = "snmp endpoint"
action.platformUuid = "c453382b049c3280b69157501914870d"
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
CreateSNSSnmpEndpointAction.Result res = action.call()

CreateSNSSnmpPlatform

API Request

URLs
POST zstack/v1/sns/application-platforms/snmp
Headers
Authorization: OAuth the-session-uuid
Body
{
  "params": {
    "snmpAddress": "127.0.0.1",
    "snmpPort": 161,
    "name": "snmp platform"
  },
  "systemTags": [],
  "userTags": []
}
Note: In the preceding sample, both systemTags and userTags are optional. These two fields can be included in the body structure.
Curl Sample
curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X POST -d '{"params":{"snmpAddress":"127.0.0.1","snmpPort":161,"name":"snmp platform"}}' http://localhost:8080/zstack/v1/sns/application-platforms/snmp
Parameters
Name Type Location Description Valid Values Starting Version
snmpAddress String body (contained in the params structure). The SNMP server address. 4.7.21
snmpPort Integer body (contained in the params structure). The SNMP server port. 4.7.21
name String body (contained in the params structure). The resource name. 4.7.21
description String body (contained in the params structure). Optional. The resource description. 4.7.21
resourceUuid String body (contained in the params structure). Optional. The resource UUID. 4.7.21
tagUuids List body (contained in the params structure). Optional. The tag UUID list. 4.7.21
systemTags List body Optional. The system tags. 4.7.21
userTags List body Optional. The user tags. 4.7.21

API Response

Sample Response
{
  "inventory": {
    "uuid": "e13b9854866747738df3026dabae9689",
    "name": "email platform",
    "description": "example description",
    "state": "Enabled",
    "type": "Email",
    "createDate": "Sep 28, 2023 4:34:04 PM",
    "lastOpDate": "Sep 28, 2023 4:34:04 PM"
  }
}
Name Type Description Starting Version
success boolean 4.7.21
error ErrorCode The error code. If not null, the operation fails, or vice versa. For more information, see error. 4.7.21
inventory SNSApplicationSnmpPlatformInventory See inventory. 4.7.21
#error
Name Type Description Starting Version
code String The error code, which is a numbered or alphanumeric code that specifies an error. For example, SYS.1000, HOST.1001. 4.7.21
description String The brief description of the error. 4.7.21
details String The details about the error. 4.7.21
elaboration String The reserved field. Default value: null. 4.7.21
opaque LinkedHashMap The reserved field. Default value: null. 4.7.21
cause ErrorCode The root error, which is the associated root cause of the current error. If no root error exists, this parameter is null. 4.7.21
#inventory
Name Type Description Starting Version
name String The resource name. 4.7.21
uuid String The resource UUID. 4.7.21
description String The resource description. 4.7.21
type String The type. 4.7.21
createDate Timestamp The creation date. 4.7.21
lastOpDate Timestamp The last operation date. 4.7.21

SDK Sample

Java SDK
CreateSNSSnmpPlatformAction action = new CreateSNSSnmpPlatformAction();
action.snmpAddress = "127.0.0.1";
action.snmpPort = 161;
action.name = "snmp platform";
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
CreateSNSSnmpPlatformAction.Result res = action.call();
Python SDK
CreateSNSSnmpPlatformAction action = CreateSNSSnmpPlatformAction()
action.snmpAddress = "127.0.0.1"
action.snmpPort = 161
action.name = "snmp platform"
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
CreateSNSSnmpPlatformAction.Result res = action.call()

QuerySNSSnmpPlatform

API Request

URLs
GET zstack/v1/sns/application-platforms/snmp
GET zstack/v1/sns/application-platforms/snmp/{uuid}
Headers
Authorization: OAuth the-session-uuid
Curl Sample
curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X GET http://localhost:8080/zstack/v1/sns/application-platforms/snmp?q=name=snmp
curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X GET http://localhost:8080/zstack/v1/sns/application-platforms/snmp/282706a5c66231019bf6c250304903bf

Queryable Fields

You can check all queryable fields and resource names that can be queried across tables by using zstack-cli, entering QuerySnmpAgent, and pressing the Tab key.

API Response

When the API succeeded, an empty JSON structure {} is returned. When the API failed, the returned JSON structure includes an error field. For example,
{
	"error": {
		"code": "SYS.1001",
		"description": "A message or a operation timeout",
		"details": "Create VM on KVM timeout after 300s"
	}
}

SDK Sample

Java SDK
QuerySNSSnmpPlatformAction action = new QuerySNSSnmpPlatformAction();
action.conditions = asList("name=snmp");
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
QuerySNSSnmpPlatformAction.Result res = action.call();
Python SDK
QuerySNSSnmpPlatformAction action = QuerySNSSnmpPlatformAction()
action.conditions = ["name=snmp"]
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
QuerySNSSnmpPlatformAction.Result res = action.call()

UpdateSNSSnmpPlatform

API Request

URLs
PUT zstack/v1/sns/application-platforms/snmp/{uuid}
Headers
Authorization: OAuth the-session-uuid
Body
{
  "updateSNSSnmpPlatform": {
    "snmpAddress": "127.0.0.1",
    "snmpPort": 161,
    "name": "snmp platform name"
  },
  "systemTags": [],
  "userTags": []
}
Note: In the preceding sample, both systemTags and userTags are optional. These two fields can be included in the body structure.
Curl Sample
curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X PUT -d '{"updateSNSSnmpPlatform":{"snmpAddress":"127.0.0.1","snmpPort":161,"name":"snmp platform name"}}' http://localhost:8080/zstack/v1/sns/application-platforms/snmp/cbd548888e9d37b594bc99c1892589ed
Parameters
Name Type Location Description Valid Values Starting Version
snmpAddress String body (contained in the updateSNSSnmpPlatform structure). The SNMP server address. 4.7.21
snmpPort Integer body (contained in the updateSNSSnmpPlatform structure). The SNMP server port. 4.7.21
uuid String url The resource UUID. 4.7.21
name String body (contained in the updateSNSSnmpPlatform structure). Optional. The resource name. 4.7.21
description String body (contained in the updateSNSSnmpPlatform structure). Optional. The resource description. 4.7.21
systemTags List body Optional. The system tags. 4.7.21
userTags List body Optional. The user tags. 4.7.21

API Response

Sample Response
{
  "inventory": {
    "uuid": "38c619bf4e7a4cdaa04fcb44d85d5fc9",
    "name": "email platform",
    "description": "example description",
    "state": "Enabled",
    "type": "Email",
    "createDate": "Sep 28, 2023 4:32:51 PM",
    "lastOpDate": "Sep 28, 2023 4:32:51 PM"
  }
}
Name Type Description Starting Version
success boolean 4.7.21
error ErrorCode The error code. If not null, the operation fails, or vice versa. For more information, see error. 4.7.21
inventory authentication See inventory. 4.7.21
#error
Name Type Description Starting Version
code String The error code, which is a numbered or alphanumeric code that specifies an error. For example, SYS.1000, HOST.1001. 4.7.21
description String The brief description of the error. 4.7.21
details String The details about the error. 4.7.21
elaboration String The reserved field. Default value: null. 4.7.21
opaque LinkedHashMap The reserved field. Default value: null. 4.7.21
cause ErrorCode The root error, which is the associated root cause of the current error. If no root error exists, this parameter is null. 4.7.21
#inventory
Name Type Description Starting Version
name String The resource name. 4.7.21
uuid String The resource UUID. 4.7.21
description String The resource description. 4.7.21
type String The type. 4.7.21
createDate Timestamp The creation date. 4.7.21
lastOpDate Timestamp The last operation date. 4.7.21

SDK Sample

Java SDK
UpdateSNSSnmpPlatformAction action = new UpdateSNSSnmpPlatformAction();
action.snmpAddress = "127.0.0.1";
action.snmpPort = 161;
action.uuid = "cbd548888e9d37b594bc99c1892589ed";
action.name = "snmp platform name";
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
UpdateSNSSnmpPlatformAction.Result res = action.call();
Python SDK
UpdateSNSSnmpPlatformAction action = UpdateSNSSnmpPlatformAction()
action.snmpAddress = "127.0.0.1"
action.snmpPort = 161
action.uuid = "cbd548888e9d37b594bc99c1892589ed"
action.name = "snmp platform name"
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
UpdateSNSSnmpPlatformAction.Result res = action.call()
API Reference | 4.8.38 | ZStack Cloud · ZCF | ZStack Resource Center