A beginner’s guide to programming SNMP on Java


What is SNMP?

The Simple Network Management Protocol is used communicate Management Information between the Network Management System and the Network Elements.

Using SNMP, the Network operators can be able to manage their network elements, identify the fault and can configure the remote system.

Let us take a simple example to understand SNMP.

Consider a Network with 1000 Network elements like routers, switches, gateways and other network devices.

One fine day, a network element went down due to some internal failures. Now how do the Network operator can find which element went down?

If the numbers of devices are lesser, then the operator can easily find the right device. If the Network is a very larger one, finding the right is really a cumbersome task.

Using a management protocol like SNMP you can easily figure out the right device.


1. From a management application, the SNMP protocol can be used to poll the SNMP Agent which is running in the Network Device to find its availability.

2. Using SNMP, the Network Management Systems can exchange management information between Network devices.

3. The Network Management Systems can query the SNMP Agent for a particular values or status.

4. SNMP Agent running in the device can send notification to the Management station as and when some thing goes wrong in the device.

SNMP Operations:

The lists of operations supported in SNMP are,

1. Get Request
    a. Get Request is a Read operation on the Managed Device.
    b. Get request is used to fetch information from the Managed Device for a particular Object Identifier (OID)

2. Get Next Request
    a. Get Next Request is same as Get Request operation. It is used to retrieve the value of the next OID value in the MIB hierarchy.
    b. Get Next Request is useful to retrieve more than one piece of information from the Managed Device.

3. Get Bulk
    a. Get Bulk Request is used to retrieve large amount of data from the MIB objects.
    b. It internally uses series of Get Next operation to retrieve all data from the MIB tables.

4. Set Request
    a. Set Request is a Write operation on the Managed Device.
    b. Set Request is used to set/write values in the Managed Device. Basically it is used to configure Network Elements.

5. Trap
    a. Trap is a type of Asynchronous Notification propagated from the Managed Device to the Network Management System.
    b. Traps are generated from the Network Elements when it experiences some error condition.

6. Inform
    a. SNMP Inform is similar to Traps but is more reliable.
    b. When an Agent sends a Trap to the Network Management System (Manager), the Manager receives the Trap and no acknowledgement is sent to Agent. By this way, the Agent doesn’t know whether the Trap has been received by Manager or not. Whereas in Inform Request, the Manager upon receiving the Inform Request can acknowledge the Agent with a SNMP Response PDU. By this way, Agent can be able to know whether Inform has reached or not.

If the Agent didn’t receive the Acknowledgement from the Manager, it can resend the Inform Request again.

SNMP Versions Supported:

1. SNMP – V1
    a. SNMPv1 was the first version of SNMP protocol.
    b. SNMPv1 security is based on the Community String authentication.
    c. List of operations supported in v1 are Get, Get Next, Get Response, Set, Trap.

2. SNMP – V2
    a. SNMPv2 is the next evolution of SNMPv1.
    b. Apart from the operations defined in SNMPv1, it adds operations like Get Bulk and Inform. Some of the message formats of the above operations were changed in v2.
    c. SNMPv2c is the commonly used one. It also uses the same Community String based security.

3. SNMP – V3
    a. SNMPv3 is the recent version and has evolved towards Security.
    b. It includes the below security models
        i. User based Security Model
            1. Used to identify that the message is from the right source
        ii. View based Access Control Model
            1. Used to control which User can access the parts of the MIB objects.

SNMP Message Formats:

The SNMP Message Format consists of the following,

     a. SNMP Version Identifier
     b. SNMP Community Name
     c. Protocol Data Unit (PDU)

     List of supported PDU types are
          - GetRequest PDU
          - GetNextRequest PDU
          - GetResponse PDU
          - GetBulk PDU
          - SetRequest PDU
          - Trap PDU

1. SNMP V1 & V2 Message Format - Get/GetNext/Set/GetResponse - PDU


2. SNMP V1 Message Format - Trap PDU


3. SNMP V2 Message Format - GetBulk PDU


Conclusion:

Using SNMP, you can manage any Network Devices. The operations in SNMP are simple and you can easily figure out the causes in the device either via polling the device or notifications from the device.

To know more about the Implementation of the above SNMP Operations using SNMP4j, refer the below links.

Post a Comment

Mới hơn Cũ hơn