Thursday, December 26, 2013

Weblogic SNMP Configuration

The Simple Network Management Protocol (SNMP) is an application layer protocol that facilitates the exchange of management information between network devices and it is part of the Transmission Control Protocol/Internet Protocol (TCP/IP) protocol suite. SNMP enables network administrators to manage network performance, solve and find network problems, and plan for network growth.

In weblogic, we can configure SNMP agents that gather information related to the underlying resources and send them to the appropriate managers. These are sent to managers in response to the requests that manager made.

In this article we will see how to create a SNMP agent that collects metrics of a resource.

Create a SNMP Agent

1. Click a SNMP under the Diagnostics in the Weblogic Console

2. On the Right hand side, click on the New under the ‘Server SNMP Agent’.
3. Give a Name to the SNMP agent and save
4. Target the SNMP agent to a managed Server

Now click on the Newly Created Server SNMP agent, under the General tab
Check for the SNMP UDP port which is the port we use to listen.
Make sure we enable the check box “enabled” and Save.

Create a String Monitor

Now click on the ‘String Monitors’ tab, and create a new String Monitor.

A string monitor observes changes in attributes that are expressed as String objects.
1. Create a New String Monitor
2. Provide a Name and in the Monitored Mbean type , select the ‘ServerLifeCycleRuntime’ bean and Click Next

3. In the next screen, select the ‘state’ in the Monitored Attribute Name and click Next.

4. In the Next Screen, give the String to Compare value as ‘RUNNING’. And click Finish.

Now click on the Newly Created String Monitor and specify which runtime beam we want to monitor (in this case ServerA weblogic Instance) and we can also specify the Pooling Interval.

5. Target the Newly Created String Monitor to the ServerA .

Create a TRAP
Now we will create a Trap,

We can specify that a trap that we create now is generated when there is a match between the value and the string you provide, or you can specify that the trap is generated if the value differs from the string you provide.

So in this case, the Server will generate a string message when the State of the Server changes. So a trap is generated whenever the state message changes.

1. Click on the Trap Destinations tab and select new.
2. Keep the Settings (Host, Port) as they are and save.

Testing the Traps

When the SNMP agent is created we can see message like this in the Managed Server Instance logs (in this case ServerA logs)

<Dec 24, 2013 8:54:19 PM IST> <Notice> <SNMP> <BEA-320953> <The SNMP Agent has been started on port 161.>
<Dec 24, 2013 8:54:19 PM IST> <Notice> <SNMP> <BEA-320931> <The SNMP trap version is 1>

So the SNMP agent was started on the port 161

In order to test the SNMP agent, start the command and once started it displays a message saying that it is listening on port 162.

Now stop the ServerA weblogic Instance which will make the State value of the ServerA to STOPPED and since that value is different from RUNNING string that we provided it will generatea Trap which is

java -classpath .:/root/Oracle/Middleware/wlserver_10.3/server/lib/weblogic.jar weblogic.diagnostics.snmp.cmdline.Manager SnmpTrapMonitor -p 162

Listening on port:162

--- Snmp Trap Received ---
    Version        : v1
    Source         : UdpEntity:
    Community      : public
    Enterprise     : enterprises.140.625
    AgentAddr      :
    TrapOID        : enterprises.140.625.0.70
    RawTrapOID     :
    Trap Objects   : {
   { enterprises.140.625.100.5=Tue Dec 24 20:53:01 IST 2013 }
   { enterprises.140.625.100.10=ServerA }
    Raw VarBinds   : {
   { enterprises.140.625.100.5=Tue Dec 24 20:53:01 IST 2013 }
   { enterprises.140.625.100.10=ServerA }

Many More to Come, Happy learning J