SNMP Trap Listener APIs


This API allows the user to create SNMP Trap Listener.

Syntax

SNMP v1 Trap:

http://[HOST]:[PORT]/AppManager/xml/AddTrapListener?apikey=[API KEY]&trapName=[TRAP NAME]&trapStatus=[TRAP STATUS]&trapVersion=v1&trapType=[GENERIC TYPE]&specificType=[SPECIFIC TYPE]&enterpriseOID=[ENTERPRISE OID]&severity=[SEVERITY]&filterCondition=[FILTER VARBINDS]&trapCustomVarbinds=[CUSTOMIZE MESSAGE]&associateTrapSeverity=[ASSOCIATE TRAP SEVERITY]&trapHost=[RECEIVE TRAP]&monitorGroups=[MONITOR GROUPS]

SNMP v2 Trap:

http://[HOST]:[PORT]/AppManager/xml/AddTrapListener?apikey=[API KEY]&trapName=[TRAP NAME]&trapStatus=[TRAP STATUS]&trapVersion=v2&trapOID=[TRAP OID]&severity=[SEVERITY]&filterCondition=[FILTER VARBINDS]&trapCustomVarbinds=[CUSTOMIZE MESSAGE]&associateTrapSeverity=[ASSOCIATE TRAP SEVERITY]&trapHost=[RECEIVE TRAP]&monitorGroups=[MONITOR GROUPS]

SNMP v3 Trap:

http://[HOST]:[PORT]/AppManager/xml/AddTrapListener?apikey=[API KEY]&trapName=[TRAP NAME]&trapStatus=[TRAP STATUS]&trapVersion=v3&trapOID=[TRAP OID]&v3UserName=[V3 USERNAME]&severity=[SEVERITY]&filterCondition=[FILTER VARBINDS]&trapCustomVarbinds=[CUSTOMIZE MESSAGE]&associateTrapSeverity=[ASSOCIATE TRAP SEVERITY]&trapHost=[RECEIVE TRAP]&monitorGroups=[MONITOR GROUPS]

Request Parameters

The parameters involved in the API request are described below. Also, refer to the list of common request parameters. To know more about the HTTP error codes, refer here.

Field Description Comments
API Key The key generated from "Generate API Key" option in the Admin tab.  
trapName Name of the SNMP trap listener.  
trapStatus Status of the trap listener. (enable or disable)  
trapVersion Version of the SNMP trap listener. (v1, v2, or v3)  
trapType The generic type of the trap. Possible values are:
  • 0 - coldStart
  • 1 - warmStart
  • 2 - linkDown
  • 3 - linkUp
  • 4 - authenticationFailure
  • 5 - egpNeighbourLoss
  • 6 - enterpriseSpecific
Optional (Mandatory for version v1)
specificType The specific type of the trap (for enterpriseSpecific traps (i.e.) for trapType=6).
  • Optional (Mandatory if trapType is 6)
  • '*' denotes match any specific type.
enterpriseOID Enterprise Object ID (OID) of the v1 trap. Optional (Mandatory for version v1)
trapOID Object ID (OID) of the v2/v3 trap. Optional (Mandatory for versions v2 and v3)
v3UserName The username of the v3 trap. Optional (Mandatory for version v3)
filterCondition The condition to filter traps based on variable bindings. (AND / OR) Optional
filterText The variable binding condition to filter the traps. Condition should be specified in JSON array format as:

{"varId":"[VAR ID]","varCondition":"[VAR CONDITION]","varValue":"[VAR VALUE]"}


Parameter Description
VAR ID The variable binding index number. If WHOLE condition is chosen, VAR ID should be 0.
VAR CONDITION The filter condition. Possible values are:
  • QL - Equals
  • NQ - Not Equals
  • CT - Contains
  • DC - Not contains
  • SW - Starts with
  • EW - Ends with
VAR VALUE The string value to be matched.
Optional
trapCustomVarbinds Message to customise the trap message (Varbinds). Possible values are:
  • $*
  • $1, $2, $3,...,$N
  • Any user-defined message with selected variables. {eg. $4 configuration changed in $2. Changed By: $5 }
Optional
associateTrapSeverity Associates trap severity on server health. (true or false) By default, value is false. Optional
trapHost The host of the trap, if you want to receive traps from only this host. Optional
monitorGroups The IDs of the monitor groups you want to map the trap listener to. Optional
severity The severity of the trap listener when the trap is received. Possible values are either critical, warning, clear, or varbindbased. If the severity has to be configured based on variable bindings, then provide "varbindbased" as the value.
criticalCondition, warningCondition, clearCondition The condition by which the thresholds should be evaluated for Critical/Warning/Clear severity. Possible values are either AND, OR, or WHOLE.
  • Optional ('criticalCondition' field is mandatory if severity is varbindbased)
  • Choose WHOLE if you want to match the threshold with whole trap message instead of individual varbind.
criticalThreshold, warningThreshold, clearThreshold The variable binding threshold conditions to determine Critical/Warning/Clear severity. Threshold condition should be specified in JSON array format as:

{"varId":"[VAR ID]","varCondition":"[VAR CONDITION]","varValue":"[VAR VALUE]"}


Parameter Description
VAR ID The variable binding index number. If WHOLE condition is chosen, VAR ID should be 0.
VAR CONDITION The threshold condition. Possible values are:
  • QL - Equals
  • NQ - Not Equals
  • CT - Contains
  • DC - Not contains
  • SW - Starts with
  • EW - Ends with
VAR VALUE The string value to be matched.
Optional ('criticalThreshold' field is mandatory if severity is varbindbased)
criticalActions, warningActions, clearActions The action ID(s) of the actions you want to configure if the severity is Critical/Warning/Clear. Optional

Note: Only upto 20 conditions are accepted. If the number of conditions are more than 20, it is treated as invalid.

Sample Request

SNMP v1 Trap:

http://localhost:9091/AppManager/xml/AddTrapListener?apikey=1e391cc0520ece06cbb85766fafebf78&trapStatus=enable&trapVersion=v1&severity=critical&trapType=6&specificType=2&enterpriseOID=.1.2.3.4&trapName=trap1OID&associateTrapSeverity=true

SNMP v2 Trap:

http://localhost:9091/AppManager/xml/AddTrapListener?apikey=1e391cc0520ece06cbb85766fafebf78&trapStatus=enable&trapVersion=v2&severity=critical&trapOID=.0.1.2.3.4&trapName=trap2

SNMP v3 Trap:

http://localhost:9091/AppManager/xml/AddTrapListener?apikey=1e391cc0520ece06cbb85766fafebf78&trapStatus=enable&trapVersion=v3&severity=clear&trapOID=.0.1.2.3.4&trapName=trap3&v3UserName=mithun

With varbind filters and varbind-based severity:

http://localhost:9091/AppManager/xml/AddTrapListener?apikey=1e391cc0520ece06cbb85766fafebf78&trapStatus=enable&filterCondition=OR&filterText={"varId":"1","varCondition":"CT","varValue":"critical"},{"varId":"3","varCondition":"SW","varValue":"hi"}&trapVersion=v1&severity=varbindbased&criticalCondition=AND&criticalThreshold={"varId":"1","varCondition":"CT","varValue":"critical"}&trapType=6&specificType=2&enterpriseOID=.1.2.3.4&trapName=trap1OID&associateTrapSeverity=true

With actions and monitor groups:

http://localhost:9091/AppManager/xml/AddTrapListener?apikey=1e391cc0520ece06cbb85766fafebf78&trapStatus=enable&trapVersion=v1&severity=varbindbased&criticalCondition=AND&criticalThreshold={"varId":"1","varCondition":"CT","varValue":"critical"}&warningCondition=AND&warningThreshold={"varId":"1","varCondition":"CT","varValue":"critical"}&clearCondition=AND&clearThreshold={"varId":"1","varCondition":"CT","varValue":"critical"}&trapType=6&specificType=2&enterpriseOID=.1.2.3.4&trapName=trap1OID&associateTrapSeverity=true&warningActions=10000003,10000004,10000005&monitorGroups=10000013,100000134