WebLogic SNMP to monitor Server Runtime state

The below article demonstrates the configuration of WebLogic SNMP to monitor the Server RunTime state using  String Monitor and generate the SNMP traps accordingly.

SNMP: It is basically Internet Protocol used to manage the devices over the IP based Network. The devices could be servers ,routers, printers, switches etc.

WebLogic Server software includes the ability to communicate with enterprise-wide management systems using Simple Network Management Protocol (SNMP). The WebLogic Server SNMP capability enables you to integrate management of WebLogic Servers into an SNMP-compliant management system. Such a system provides a single view of the various software and hardware resources of a complex, distributed system.

In the below example, we can check whether the state of a server changes from RUNNING and generate trap notifications accordingly.

The steps are as below.

1. Creating SNMP agent.

2. Creating SNMP String Monitor

3. Creating SNMP Trap Destination.

4. Verifying the SNMP Alerts.

1. Creating SNMP Agent:

a. Login into the Administration Console, navigate to Diagnostics → SNMP.

Click on New tab to create a Server SNMP Agent

b. Click on the newly created SNMP Agent → Enable the SNMP agent and you can modify the default SNMP agent attributes like SNMP ports etc.

c.Target the SNMP Agent to the Managed Server MS1.

2. Creating SNMP String Monitor:

String Monitor: A string monitor observes changes in attributes that are expressed as String objects.

You can specify that a trap is generated if 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.

a. Click on String Monitor tab from the console.

b. From the drop down list of Mbeans, select ‘ServerLifeCycleRuntime‘ Mbean

c. Select the State attribute from the drop down list.

d. Enter the string value with which the Server State value would be compared to. Specify it as RUNNING.

e. Click on the newly created SNMP Monitor and specify which Runtime Mbean you want to monitor (MS1), polling interval of the MBeans.

f. Target the created String monitor to the Managed server MS1.

3. Creating SNMP Trap Destination:

a. Click SNMP Agent –>  Trap Destinations –>  New.

b. Specify the Trap Destination attributes like Host and Ports.

4. Verify the SNMP Traps:

To verify that a WebLogic Server SNMP Agent is generating and sending notifications, we can use the WebLogic command line utility SnmpTrapMonitor.

a. Open a command prompt and set the classpath to the weblogic.jar file under the %WLS_HOME%/lib folder.

set classpath=%classpath%;%WLS_HOME%serverlibweblogic.jar

b. Run the weblogic command line utility weblogic.diagnostics.snmp.cmdline.Manager SnmpTrapMonitor to receive notifications.

Make sure that you specify the same listen port for this Trap Monitor as the trap destination that you created for the SNMP Agent.

For example, if your trap destination specifies a listen port of 171, enter the following command: java

java weblogic.diagnostics.snmp.cmdline.Manager SnmpTrapMonitor -p 171

The SNMP setup is complete. The config.xml file would like below.

**********************************************************************

 

<snmp-agent-deployment>

<name>ServerSNMPAgent-0</name>

<enabled>true</enabled>

<send-automatic-traps-enabled>true</send-automatic-traps-enabled>

<snmp-port>161</snmp-port>

<snmp-trap-version>1</snmp-trap-version>

<community-prefix>public</community-prefix>

<snmp-trap-destination>

<name>TrapDestination-0</name>

<host>localhost</host>

<port>171</port>

<community>public</community>

<security-level>noAuthNoPriv</security-level>

</snmp-trap-destination>

<snmp-string-monitor>

<name>SNMPStringMonitor-0</name>

<enabled-server>MS1</enabled-server>

<monitored-m-bean-type>ServerLifeCycleRuntime</monitored-m-bean-type>

<monitored-m-bean-name>MS1</monitored-m-bean-name>

<monitored-attribute-name>State</monitored-attribute-name>

<polling-interval>5</polling-interval>

<string-to-compare>RUNNING</string-to-compare>

<notify-differ>true</notify-differ>

<notify-match>false</notify-match>

</snmp-string-monitor>

 

**********************************************************************

If the server state of the Managed Server MS1 changes from RUNNING would generate Traps on to the listener as below.

From the command line utility:

**********************************************************************

java weblogic.diagnostics.snmp.cmdline.Manager SnmpTrapMonitor -p 171
Listening on port:171
— Snmp Trap Received —
Version        : v1
Source         : UdpEntity:127.0.0.1:161
Community      : public
Enterprise     : enterprises.3817.1.1000
TrapOID        : coldStart
RawTrapOID     : 1.3.6.1.6.3.1.1.5.1
Trap Objects   : {
}
Raw VarBinds   : {
}

**********************************************************************

From the Managed server console or server logs.

<Notice> <SNMP> <BEA-320931> <The SNMP trap version is 1>

For further references:

http://download.oracle.com/docs/cd/E13222_01/wls/docs103/snmpman/index.html

Best Regards,

Wonders Team. 🙂