Skip to main content

Working with WSO2 SNMP Connector

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
Following is a sample proxy service that illustrates how to test the SNMPSet operation.

 <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.

Sample Request

 {   
   "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

Popular Posts

How to install draw.io Desktop Application on Kali Linux?

draw.io is an online diagramming open source web application which can be used as flowchart maker, network diagram software, ER diagram tool, UML diagramand more. It can be freely accessible website of draw.io or official Docker image or Desktop version for macOS, Linux & Windows. This guide includes detailed instructions about Desktop version installation on Kali Linux. Download the .deb build for draw.io sudo apt update sudo apt -y install wget curl curl -s https://api.github.com/repos/jgraph/drawio-desktop/releases/latest | grep browser_download_url | grep '\.deb' | cut -d '"' -f 4 | wget -i - Install with dpkg command sudo apt -f install ./drawio-amd64-*.de When application is installed, launch the application with following command. drawio Now application is ready to use. Click on " Create New Diagram"  to create new project or click on " Open Existing Diagram " to edit. ...

What is Honeypot?

A  honeypot is a security mechanism that creates a virtual trap to lure attackers. Simply we can say that this is a  decoy box residing inside your network demilitarized zone  (DMZ), set up by a security professional to trap or aid in locating hackers, or to draw them  away from the real target system. Since this a  decoy system , a malicious attacker might try to attack; software on  the system can log information about the attacker such as the IP address. This information  can be used to try to locate the attacker either during or after the attack. Honeypots vary based on design and deployment models, but they are all decoys intended to look like legitimate, vulnerable systems to attract cyber criminals. Type of Honeypot Production Honeypot : Used by companies and corporations for the purpose of researching the motives hackers as well ass diverting and mitigating the risk of attacks on the overall network. Research Honeypot : Used by nonprofit organi...

How to install Oracle Virtualbox in Ubuntu?

Introduction VirtualBox is a powerful free tool offered by Oracle for running an operating system on your computer virtually. In this tutorial lets learn how to install VirtualBox on Ubuntu. Installation 1. Open a terminal or press Ctrl + Alt +T 2. Enter the following command to all the packages or dependencies.      sudo apt-get update ( make sure to give the root password) 3. Run the following command to download and install Virtualbox     sudo apt-get install vrtualbox virtualbox-ext-pack That's all! VirtualBox has been successfully installed on your Ubuntu machine, and you can start using it.