Pages

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:172.16.101.68:161
    Community      : public
    Enterprise     : enterprises.140.625
    AgentAddr      : 172.16.101.68
    TrapOID        : enterprises.140.625.0.70
    RawTrapOID     : 1.3.6.1.4.1.140.625.0.70
    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
Read More

Friday, December 20, 2013

Weblogic : Extend Your Weblogic Console with WLDF

WLDF was one of the great tool in Weblogic.WLDF was just an extension before 11g but it was included in the admin console which helps in monitoring all the Weblogic Mbeans and can get other details too.

In this article we will see how we can use the WLDF console integrated in the Weblogic admin console

WebLogic uses watches to monitor all kinds of things to see how you system is performing, but not all watches are running. We will see how we can monitor the System Attributes using the WLDF Console.

First we need to create a watch to pick up notifications about the state of the CPU.

1. Click on the Diagnostic Modules in the Weblogic Console
2. In the next Screen, enter the name for the Diagnostic Module. Save
Even though the Diagnostic module was created, it did not have any metrics enabled. Click on the newly Created Diag­nos­tic mod­ule and select the Con­fig­u­ra­tion tab and Col­lected Met­rics sub tab.


3. Click New in the Configuration tab.
4. In the next screen we can choose between “Server run­time” and “Domain run­time” met­rics. (The for­mer means that met­rics will be col­lected at server level; the other option, Domain Run­time, pro­vides access to the Domain Wide met­rics and is avail­able only for the Admin Server)
Select the ‘Domain Runtime’ Metric












5. In the next screen, select the MBean as ‘com.sun.management.UnixOperatingSystem’.

6. In the next screen, select from the Available Attributes to Choosen Attributes.

7. In the next Screen, select the Instances and Finish.

Now Go the Home page and Click On the ‘Monitoring DashBoard’

There will be a new Tab Opened, Inside the new Monitoring DashBoard we see
View List and Metric Browser

Select the server for which you have assigned the Diagnostic Module in this case ‘admin Server’.
Once you select this then move to the Metric Browser, Type ‘Unix’ in the Types which will show you the UnixOperatingSystem under that. Click that

Now we can see ‘java.lang:type=OperatingSystem’ in the Instances Field. Click on this which will show the available metrics in the “Metrics” fields.

Select them and drag them to the New Chart which will give you various chart information regarding the metrics we selected.













Note: Make Sure You Start the Monitoring by click on the green Button on the Top of the View List and Metric Browser tabs.





















More To Come, happy learning
Read More

Weblogic Watch and Notifications

In this article we will see how we can use the Watches and Noti­fi­ca­tions.
  • Watch: this com­po­nent is used to mon­i­tor the MBean attributes.
  • Noti­fi­ca­tion: this com­po­nent includes the events which are trig­gered based on the val­ues set in the watch. There can be dif­fer­ent types of alert like SNMP alerts, JMS Mes­sages, JMX noti­fi­ca­tions etc.
In this article we will see how we can use Weblogic WLDF to interact with JMS along with the configuration of the Watch and Notifications

Create a WLDF Diagnostic Module
1. Click on the Diagnostic Modules in the Weblogic Console
2. In the next Screen, enter the name for the Diagnostic Module. Save

Even though the Diagnostic module was created, it did not have any metrics enabled. Click on the newly Created Diag­nos­tic mod­ule and select the Con­fig­u­ra­tion tab and Col­lected Met­rics sub tab.

3. Click New in the Configuration tab.
4. In the next screen we can choose between “Server run­time” and “Domain run­time” met­rics. (The for­mer means that met­rics will be col­lected at server level; the other option, Domain Run­time, pro­vides access to the Domain Wide met­rics and is avail­able only for the Admin Server)
Select the ‘Domain Runtime’ Metric









5. In the next Screen, Select the ‘weblogic.management.runtime.JVMRuntimeMBean’











6. In the next screen, specify which attribute of the Mbean you want to monitor. For instance select ‘HeapSizeMax’.





















7. In the next Screen, select the server instance which you want to monitor. Click finish and the collection metrics is created.





















The Watch and Notification system can be used to create automated monitors that observe specific diagnostic state and send notifications based on configured rules.

Watch:- It is basically used to monitor the Mbean attributes.

Notifications: There are the events which are triggered based on the values set in the watch. There can be different kind of alerts like SNMP alerts, JMS Messages, JMX notifications etc.

Now let’s create a notification first which sends notification messages to the JMS Sub System. For this we need to Configure JMS In weblogic which is available here.

Create a Notification
1. Click the Newly Created Diagnostic Module.
2. Click on the Watches and Notifications tab.
3. Go to the Notification tab and click New.
4. In the next Screen, select the Type as ‘JMS Message’















5. In the next Screen, Enter a Name for the Notification. Make Sure ‘enable notification’ check box is checked.














6. In the next screen enter a the JMS Details, in this case , JNDI name is ‘Queue1’ and Connection Factory JNDI Name is “CF1’



















7. Click Finish

Create a Watch
1. Click the Newly Created Diagnostic Module.
2. Click on the Watches and Notifications tab.
3. Go to the Watch tab and click New.
4. In the next screen, enter the watch name and watch Type as ‘Collected Metrics’ and make sure ‘enable Watch’ is checked.



















5. In the next screen, Click on the Add Expression button which takes us to the next screen.















6. In the next screen, select the ‘Domain Runtime’ for MBean Server Location.









7. In the next screen , select the ‘weblogic.management.runtime.JVMRuntimeMBean’ for the MBean type.











8.  In the next screen, select the Instance








9.  In the next screen, enter the Details
Message Attribute = HeapSizeMax
Operator = >
Value = 10






















and click on Finish to come back to the Create watch.
10. In the next Screen make sure to check ‘Use an automatic reset alarm’.














11. In the last screen, select the Notifications available to Choosen.



















12. Finish


Target the WLDF to any of the servers whose MBeans are monitored.

Now Check the Server logs to see

WatchRuleType: Harvester
WatchRule: (${DomainRuntime//[weblogic.management.runtime.JVMRuntimeMBean]com.bea:Location=AdminServer,Name=AdminServer.......)
WatchData: com.bea:Location=AdminServer,Name=AdminServer,ServerRuntime=AdminServer,Type=JVMRuntime//HeapSizeMax = 477233152
WatchAlarmType: AutomaticReset
WatchAlarmResetPeriod: 60000 

If we compile the QueueReceive.java class in the here , we can see messages coming like
Message Received: MapMessage[ID:<114623.1387464249708.0>]
Message Received: MapMessage[ID:<114623.1387464319708.0>]

More to Come , Happy Learning
Read More

Thursday, December 19, 2013

Weblogic - WLDF

As a Application Server admin, it is always complex to me to monitor various servers , cluster and even resources deployed to servers in a weblogic. There is a need for some technology which will do the monitoring for me and send me the alerts when a resource is down.
The Weblogic Diagnostic Framework (WLDF ) which is a part of the weblogic Server allows to send notifications when certain contains are detected. This allows us to configure rules which match runtime conditions and when met send notifications.
The major components are
  • Diag­nos­tic Image Cap­ture: This created a Diagnostic Snapshot from the serer that can be used for analysis
  • Archive: cap­tures and per­sists data events, log records and met­rics from server instances and applications.
  • Har­vester: cap­tures met­rics from run-time MBeans, includ­ing WebLogic Server MBeans and cus­tom MBeans, which can be archived and later accessed for view­ing his­tor­i­cal data.
  • Watches and Noti­fi­ca­tions: pro­vides the means for mon­i­tor­ing server and appli­ca­tion states and send­ing noti­fi­ca­tions based on cri­te­ria set in the watches.
  • Log­ging ser­vices: man­age logs for mon­i­tor­ing server, sub­sys­tem, and appli­ca­tion events.

Ora­cle Weblogic Diag­nos­tic Module
As said earlier, a diagnostic module allows creating a diagnostic snapshot from the server that can be used as a post-failure analysis. In this post we will see how we can create a diagnostic module.

1. Click on the Diagnostic Modules in the Weblogic Console
2. In the next Screen, enter the name for the Diagnostic Module. Save

Even though the Diagnostic module was created, it did not have any metrics enabled. Click on the newly Created Diag­nos­tic mod­ule and select the Con­fig­u­ra­tion tab and Col­lected Met­rics sub tab.

3. Click New in the Configuration tab.
4. In the next screen we can choose between “Server run­time” and “Domain run­time” met­rics. (The for­mer means that met­rics will be col­lected at server level; the other option, Domain Run­time, pro­vides access to the Domain Wide met­rics and is avail­able only for the Admin Server)
5. In the next screen, select the MBean type “weblogic.management.runtime.JVMRuntimeMBean”
6. In the next screen, select the attribute of the Mbean you want to collect.
7. Select ‘Heap­Size­Max’ and click “Fin­ish”.

Finally select the tar­get instance which you want to mon­i­tor and click Finish.

More to Come , Happy Learning 
Read More

WebLogic – Jms

Java Messing Service is one of the Important Service that every Application Server Provides. There are 2 types of Messaging Models

Point-To-Point – This enables the delivery of the message to exactly one Recipient.
Publisher-Subscribe – This enables the delivery of the message to multiple recipients.

In this article we will see how to configure PTP model with Queue. Messaging application in PTP sned and receive messages using Queue. In this model a Queue-sender sends a message and a Queue-receiver receives the messages .In this case the Queue-sender sends a message to a Queue to which the Receiver listens.

Configure a JMS Server
Follow the Steps to configure the JMS Server in Weblogic.

1. Move to Weblogic Admin Console à Messaging à JMS Servers. Once you click here, 


















2. Target the JMS Server to Weblogic Servers












Configure JMS System Module
The JMS Module holds the Queue and Topics. To configure JMS System Module

1. Move to Services à Messaging à JMS Module,
2. Create a JMS Module and Target it to the Weblogic Server , name = JMSServer


















3.Click Next and in the next window , check "would like to add resources to the jsm module"

Create a Sub Deployment
To Create a Sub Deployment, Click on the Sub deployment tab in the System Module.

1. Create a Sub Deployment , Name=SystemModule

2. Target it to the JMS Server



















Create a Connection Factory
To create a Connection Factory, Click on the New under the Configuration Tab of the JMS System Module

1. Check the Connection Factory and Click Next
2. Create a Connection Factory By Providing the JNDI name = CF1

2. Target the Connection Factory to the Sub Deployment by Clicking on the Advanced Targeting.

3. Select the Sub Deployment and Check the ‘JMS Server’ in the Servers tab




















Create a Queue
Click on the New under the Configuration Tab of the JMS System Module

1. Select Queue and Click Next
2. Provide the Necessary Details - JNDI Name = Queue1















3. Target the Queue to the Sub Deployment by Clicking on the Advanced Targeting.
4. Select the Sub Deployment and Check the ‘JMS Server’ in the Servers tab




















Now in the JMS resource page ,we can see both Connection Factory and Queue are been Configured.

Test the Setup

Compile both the class providing the location of the jms libraries like
javac -classpath .:/root/Oracle/Middleware/wlserver_10.3/server/lib/wljmsclient.jar  QueueSend.java

javac -classpath .:/root/Oracle/Middleware/wlserver_10.3/server/lib/wljmsclient.jar  QueueReceive.java

Execute both the classes in separate command prompts like
Queue Send
java -classpath .:/root/Oracle/Middleware/wlserver_10.3/server/lib/wljmsclient.jar  QueueReceive t3://localhost:7001
JMS Ready To Receive Messages (To quit, send a "quit" message).
Message Received: hello
Message Received: too much

Queue Receive
java -classpath .:/root/Oracle/Middleware/wlserver_10.3/server/lib/wljmsclient.jar  QueueSend t3://localhost:7001
Enter message ("quit" to quit):
hello
JMS Message Sent: hello

Enter message ("quit" to quit):
too much
JMS Message Sent: too much

Enter message ("quit" to quit):

More To Come , Happy learning J 
Read More