This site contains the documentation that is relevant to older WSO2 product versions and offerings.
For the latest WSO2 documentation, visit https://wso2.com/documentation/.

Configuring SNMP Inbound Operations

The SNPP inbound endpoint allows you to consume messages from SNMP Agent via WSO2 ESB. WSO2 ESB SNMP inbound endpoint acts as a message consumer. It listens to alarms “TRAP” coming from the agent  and injects the messages to the ESB sequence

Before you begin

To use the SNMP inbound endpoint, download the following files: 

  • Go to https://store.wso2.com/store/assets/esbconnector/snmp and click Download Streaming Connector to download the inbound org.apache.synapse.snmp.listen.class-x.x.x.jar file. 
  • Copy this JAR file to the <ESB_HOME>/repository/components/dropins directory. 
  • download snmp4j-2.5.5.jar and add it to the <ESB_HOME>/repository/components/lib directory then start the ESB.  

Sample configuration

The inbound configuration can be added in the Inbound UI.

Inbound configuration


Inbound Configuration
<?xml version="1.0" encoding="UTF-8"?>
<inboundEndpoint xmlns="http://ws.apache.org/ns/synapse" 
					name="SNMP" 
					sequence="request" 
					onError="fault" 
					class="org.wso2.carbon.inbound.snmp.SNMPListeningConsumer" 
					suspend="false">
    <parameters>
        <parameter name="inbound.behavior">eventBased</parameter>
        <parameter name="sequential">true</parameter>
        <parameter name="coordination">true</parameter>
        <parameter name="port">1162</parameter>
        <parameter name="snmpVersion">2c</parameter>
        <parameter name="host">localhost</parameter>
        <parameter name="isTCP">false</parameter>
    </parameters>
</inboundEndpoint>


We can get the trap message properties such as PDURequestID, ListenAddress, PDUIsProcessed, PeerAddress, PDUErrorStatusText, PDUErrorIndex, PDUErrorStatus, SecurityName, SecurityLevel, Security_Model, PDUHandle, StateReference, MessageDispatcher, MessageProcessingModel, Source, PDUType, MaxInboundMessageSize, MaxSizeResponsePdu, PDUNonRepeater, PDUBerLength, PDUBerPayloadLength, TmStateReference from the sequence as below.


Sequence
<?xml version="1.0" encoding="UTF-8"?>
<sequence name="request" onError="fault" xmlns="http://ws.apache.org/ns/synapse">
    <log level="custom">
        <property expression="get-property('Listen_Address')"
            name="ListenAddress" xmlns:ns="http://org.apache.synapse/xsd"/>
        <property expression="get-property('PDU_RequestID')"
            name="PDURequestID" xmlns:ns="http://org.apache.synapse/xsd"/>
        <property expression="get-property('PDU_Is_Processed')"
            name="PDUIsProcessed" xmlns:ns="http://org.apache.synapse/xsd"/>
        <property expression="get-property('Peer_Address')"
            name="PeerAddress" xmlns:ns="http://org.apache.synapse/xsd"/>
        <property expression="get-property('PDU_Error_Status_Text')"
            name="PDUErrorStatusText" xmlns:ns="http://org.apache.synapse/xsd"/>
        <property expression="get-property('PDU_Error_Index')"
            name="PDUErrorIndex" xmlns:ns="http://org.apache.synapse/xsd"/>
    </log>
    <log level="full"/>
</sequence>
ParameterDescriptionRequiredPossible ValuesDefault Value

host

IP address of the SNMP agent.

yes

N/A

N/A

port

Port of the SNMP agent.

yes

N/AN/A
snmpVersion

The version of SNMP.

yes

1 or 2c

N/A
isTCP
Indicates which type of protocol used in the Transport Layer. If it value is true then protocol is TCP, otherwise proocol is UDP.
yestrue or falsefalse