SNMP Connector allows you to monitor and configure the network components such as servers, routers, switches or printers through the WSO2 ESB. Simple Network Management Protocol (SNMP) is an Internet-standard protocol for managing devices on IP networks. It uses the snmp4j library which is an enterprise class free open source SNMP implementation for Java™ SE.
Before start, the ESB, download snmp4j-2.5.5.jar and add it to the <ESB_HOME>/repository/components/lib directory.
Environment Setup
- Download ESB 5.0.0 from here.
- Deploy the SNMP Connector.(Refer this to add and enable the connector)
<proxy xmlns="http://ws.apache.org/ns/synapse"
name="SNMPSet"
startOnLoad="true"
statistics="disable"
trace="disable"
transports="https,http,local">
<target>
<inSequence>
<property expression="json-eval($.host)" name="host"/>
<property expression="json-eval($.port)" name="port"/>
<property expression="json-eval($.snmpVersion)" name="snmpVersion"/>
<property expression="json-eval($.community)" name="community"/>
<property expression="json-eval($.retries)" name="retries"/>
<property expression="json-eval($.timeout)" name="timeout"/>
<property expression="json-eval($.updateOids)" name="updateOids"/>
<snmp.init>
<host>{$ctx:host}</host>
<port>{$ctx:port}</port>
<snmpVersion>{$ctx:snmpVersion}</snmpVersion>
<community>{$ctx:community}</community>
<retries>{$ctx:retries}</retries>
<timeout>{$ctx:timeout}</timeout>
</snmp.init>
<snmp.snmpSet>
<updateOids>{$ctx:updateOids}</updateOids>
</snmp.snmpSet>
<respond/>
</inSequence>
</target>
<description/>
</proxy>
Parameter description
- host: The address of the target device.
- port: The port number of SNMP.
- snmpVersion: The SNMP version.
- community: The community string that acts as a password. This is used to authenticate messages that are sent between the management station and the device (the SNMP Agent).
- retries: The number of times a request should be sent when a timeout occurs.
- timeout: The time interval that a request waits for a response message from an agent.
- updateOids: A JSON array of the objects identifiers (OIDs) that need to be updated, and the new value and data type for each OID.
{
"host":"127.0.0.1",
"port":"161",
"snmpVersion":"2c",
"updateOids":[
{
"oid":"1.3.6.1.2.1.1.5.0",
"value":"vives@it-slav.net",
"type":"String"
},
{
"oid":"1.3.6.1.2.1.1.4.0",
"value":"vives",
"type":"String"
}
],
"community":"private",
"retries":"2",
"timeout":"1000"
}
Response
{
"Response": "OIDs successfully updated with [1.3.6.1.2.1.1.5.0 = vives@it-slav.net, 1.3.6.1.2.1.1.4.0 = vives]"
}

Comments
Post a Comment