• No results found

WLS_11gR1 Diagnostics Lab

N/A
N/A
Protected

Academic year: 2021

Share "WLS_11gR1 Diagnostics Lab"

Copied!
30
0
0

Loading.... (view fulltext now)

Full text

(1)

WebLogic Server 11gR1 Diagnostics Lab

WebLogic Server 11gR1 Diagnostics Lab

Overview

Overview

The following hands-on labs are intended to provide an introduction to the The following hands-on labs are intended to provide an introduction to the WebLogic Server Diagnostic Framework (WLDF), a framework of diagnostic WebLogic Server Diagnostic Framework (WLDF), a framework of diagnostic utilities built into the

utilities built into the WebLogic Server architecture. WebLogic Server architecture. The labs are The labs are intended to giveintended to give you practice in configuring the major features of WLDF and to provide a template you practice in configuring the major features of WLDF and to provide a template for configuring diagnostics for your own WebLogic Server domains.

for configuring diagnostics for your own WebLogic Server domains. There are

There are 13 labs 13 labs in all. in all. These cover:These cover: 1.

1. Browsing Browsing WebLogic Server WebLogic Server MBeansMBeans 2.

2. Changing Changing WebLogic Server WebLogic Server Debug Debug settingssettings 3.

3. Configuring Configuring a a JDBC JDBC Diagnostic ArchiveDiagnostic Archive 4.

4. Creating Creating a a System System Diagnostic Diagnostic ModuleModule 5.

5. System-Scoped DSystem-Scoped Diagnostic iagnostic Monitors (Monitors (WLDF WLDF Profiles)Profiles) 6.

6. Enabling Enabling Application-Scoped Application-Scoped InstrumentationInstrumentation 7.

7. Exporting and Exporting and Transforming WLDF Transforming WLDF Event DataEvent Data 8.

8. Configuring Configuring Collected Collected Metrics Metrics HarvestingHarvesting 9.

9. Exporting and Exporting and Transforming WLDF Transforming WLDF Collected Metrics Collected Metrics DataData 10.

10. Creating a Creating a Diagnostic WDiagnostic Watchatch 11.

11. Configuring WConfiguring WLDF NotificatLDF Notificationsions The lab materials

The lab materials are included in are included in a zipped a zipped archive file (DiagnosticLab.zip). archive file (DiagnosticLab.zip). YouYou can unzip this and store it anywhere on your local machine, this folder will be can unzip this and store it anywhere on your local machine, this folder will be referred below as

referred below as %LAB_HOME%. %LAB_HOME%. In it, you In it, you will find the following will find the following folders:folders: Apps

Apps – –Web apps used in the labsWeb apps used in the labs Notifications

Notifications – –Utility classes and scripts for handling notificationsUtility classes and scripts for handling notifications Profiles

Profiles – – Copies of WebLogic Server standard diagnostic profilesCopies of WebLogic Server standard diagnostic profiles Shortcuts

Shortcuts – –A number of useful MS-Windows shortcuts for starting servers etc.A number of useful MS-Windows shortcuts for starting servers etc. SQL

SQL – –SQL scripts for creating database schemasSQL scripts for creating database schemas Transforms

Transforms – – XSLT stylesheets for viewing WLDF archive dataXSLT stylesheets for viewing WLDF archive data Utilities

(2)

Lab Setup

Lab Setup

 –

 –

Setting Up the DiagnosticsLab Domain

Setting Up the DiagnosticsLab Domain

Create a simple WebLogic Server 11gR1 domain using the Configuration Wizard. Create a simple WebLogic Server 11gR1 domain using the Configuration Wizard. All you need for this lab is a simple domain with one server

All you need for this lab is a simple domain with one server  – –in this guide we willin this guide we will assume that you have created a domain, with the following settings:

assume that you have created a domain, with the following settings: 

 Domain name:Domain name: DiagnosticsLabDiagnosticsLab 

 Administrator credentials: weblogic/weblogic1Administrator credentials: weblogic/weblogic1 

 Development mode, JRockit SDKDevelopment mode, JRockit SDK 

 AdminServer, listen port: 7001AdminServer, listen port: 7001 

 Do not configure managed servers, clusters and machinesDo not configure managed servers, clusters and machines

When you have created the domain, before starting the AdminServer, we want to When you have created the domain, before starting the AdminServer, we want to make a number of edits to

make a number of edits to %DOMAIN_HOME%/bin/setDomainEnv.cmd%DOMAIN_HOME%/bin/setDomainEnv.cmd:: Use JRockit to enable Thread Dumps 

Use JRockit to enable Thread Dumps  Add the following line:

Add the following line:

set JAVA_VENDOR=Oracle set JAVA_VENDOR=Oracle

near the beginning of the file, before the line: near the beginning of the file, before the line:

if "%JAVA_VENDOR%"=="Oracle" ( if "%JAVA_VENDOR%"=="Oracle" ( Enable Fastswap to work with WLDF 

Enable Fastswap to work with WLDF  Look for the line:

Look for the line:

set enableHotswapFlag= set enableHotswapFlag= and change it this way:

and change it this way:

set set enableHotswapFlag=-javaagent:%WL_HOME%\server\lib\diagnostics-agent.jar

agent.jar

Disable wsee async response (BEA-22013) warnings  Disable wsee async response (BEA-22013) warnings  Add

Add – –Dweblogic.wsee.skip.async.response=trueDweblogic.wsee.skip.async.response=true to theto the JAVA_PROPERTIESJAVA_PROPERTIES environment variable: environment variable: set JAVA_PROPERTIES=Dplatform.home=%WL_HOME% set JAVA_PROPERTIES=Dplatform.home=%WL_HOME% Dwls.home=%WLS_HOME% Dweblogic.home=%WLS_HOME% Dwls.home=%WLS_HOME% Dweblogic.home=%WLS_HOME% -Dweblogic.wsee.skip.async.response=true Dweblogic.wsee.skip.async.response=true

Modify the file paths for the shortcuts provided inside

Modify the file paths for the shortcuts provided inside

%LAB_HOME%/Shortcuts , these shortcuts will be used through all the lab

%LAB_HOME%/Shortcuts , these shortcuts will be used through all the lab

exercises

(3)

Lab 1- Browsing WebLogic Server MBeans

Lab 1- Browsing WebLogic Server MBeans

In this exercise, you will practice browsing the WebLogic Server MBean trees. In this exercise, you will practice browsing the WebLogic Server MBean trees.

Start Diagnotics domain‟s AdminServer (you can use Start Diagnotics domain‟s AdminServer (you can use

%LAB_HOME%\Shortcuts\Admin Server.lnk %LAB_HOME%\Shortcuts\Admin Server.lnk))

For this exercise, we will use both WLST and WLNav, an open-source utility For this exercise, we will use both WLST and WLNav, an open-source utility originally developed by

originally developed by WebLogic Server consultants.. WebLogic Server consultants.. You will You will find a copy find a copy ofof WLNav in the %LAB_HOME%/Utilities folder.

WLNav in the %LAB_HOME%/Utilities folder.

WLNav is packaged as a web app archive (WLNav.war) and you can deploy it WLNav is packaged as a web app archive (WLNav.war) and you can deploy it easily using either the admin console Deployments page or the following

easily using either the admin console Deployments page or the following

weblogic.Deployer command (don‟t forget to c

weblogic.Deployer command (don‟t forget to call setDomainEnv.cmd first):all setDomainEnv.cmd first):  java weblogic.Deployer -username weblogic -password weblogic1 -targets  java weblogic.Deployer -username weblogic -password weblogic1 -targets

AdminServer -deploy %LAB_HOME%\Utilities\wlnav.war AdminServer -deploy %LAB_HOME%\Utilities\wlnav.war You should

You should also deploy also deploy browsestore and shopping browsestore and shopping applications, located inapplications, located in %LAB_HOME%\apps

%LAB_HOME%\apps

 java weblogic.Deployer -username weblogic -password weblogic1 -targets  java weblogic.Deployer -username weblogic -password weblogic1 -targets

AdminServer -deploy

AdminServer -deploy %LAB_HOME%\Apps\Browsestore\app\browsestore.war%LAB_HOME%\Apps\Browsestore\app\browsestore.war  java weblogic.Deployer -username weblogic -password weblogic1 -targets  java weblogic.Deployer -username weblogic -password weblogic1 -targets

AdminServer -deploy

AdminServer -deploy %LAB_HOME%\Apps\Shopping\app\ShoppingCart.war%LAB_HOME%\Apps\Shopping\app\ShoppingCart.war Browse to

Browse to http://localhost:7001/wlnavhttp://localhost:7001/wlnav and you should see something like this:and you should see something like this:

Enter the password for the DiagnosticsLab AdminServer („weblogic

Enter the password for the DiagnosticsLab AdminServer („weblogic 11‟) and click‟) and click the „login‟ button.

the „login‟ button. You should You should now see now see thethe main WLNav screen, which looks likemain WLNav screen, which looks like this:

(4)

You can switch between the various MBean trees (e.g. Server Runtime/Config, You can switch between the various MBean trees (e.g. Server Runtime/Config, Domain Runtime/Config) by clicking on the tabs

Domain Runtime/Config) by clicking on the tabs at the top of at the top of the screen. the screen. TryTry selecting the

selecting the ServerRuntimeServerRuntime MBeans, then click on theMBeans, then click on the ApplicationRuntimesApplicationRuntimes link,link, then select an application (

then select an application ( browsestore.warbrowsestore.war). ). Next Next click click onon ComponentRuntimesComponentRuntimes -> AdminServer -> browsestore

-> AdminServer -> browsestore to view runtime information about the instance ofto view runtime information about the instance of the browsestore.war application currently running on AdminServer.

the browsestore.war application currently running on AdminServer. Next click on

Next click on Servlets->Welcome.jspServlets->Welcome.jsp, scroll down to view the Attributes in the, scroll down to view the Attributes in the pane on the right

pane on the right of the screen. of the screen. For example, you can For example, you can see thesee the InvocationTotalCount

InvocationTotalCount attribute. attribute. Open Open a a browser browser toto http://localhost:7001/browsestore

http://localhost:7001/browsestore,, refresh the WLNav browser window and yourefresh the WLNav browser window and you will see

will see InvocationTotalCountInvocationTotalCount incremented by one.incremented by one.

Next, we will see how you can use weblogic.WLST to view the MBean tree in Next, we will see how you can use weblogic.WLST to view the MBean tree in

exactly the same way.

exactly the same way. We will take advantage of We will take advantage of WLNav‟s History tab: cWLNav‟s History tab: click onlick on

the tab at the top marked „History‟ and then scroll all the way down to the bottom the tab at the top marked „History‟ and then scroll all the way down to the bottom

of the main pane.

of the main pane. You should see a You should see a complete history of all the complete history of all the WLST commandsWLST commands that WLNav has used to browse the MBean tree:

(5)

We will use the WLST commands (highlighted in purple) to navigate the MBean We will use the WLST commands (highlighted in purple) to navigate the MBean tree with

tree with WLST in online mode. WLST in online mode. Open a Open a command shell, set ycommand shell, set your environmentour environment with setDomainEnv.cmd (or use the shortcut provided) and enter the following with setDomainEnv.cmd (or use the shortcut provided) and enter the following commands (you should see the WLST output as well, but I have left it out here commands (you should see the WLST output as well, but I have left it out here for clarity):

for clarity): >

> java weblogic.WLST java weblogic.WLST wls:/offline>

wls:/offline>connect („weblogic‟, „weblogicconnect („weblogic‟, „weblogic11‟, „t3://localhost:7001‟)‟, „t3://localhost:7001‟)

wls:/DiagnosticLab/serverConfig>

wls:/DiagnosticLab/serverConfig>cd („serverRuntime:/ApplicationRuntimes‟)cd („serverRuntime:/ApplicationRuntimes‟)

wls:/DiagnosticLab/serverRuntime/ApplicationRuntimes> wls:/DiagnosticLab/serverRuntime/ApplicationRuntimes> ls()ls() wls:/DiagnosticLab/serverRuntime/ApplicationRuntimes>

wls:/DiagnosticLab/serverRuntime/ApplicationRuntimes> cdcd(‟browsestore(‟browsestore.war.war‟)‟)

wls:/…> wls:/…> ls()ls() wls:/…> wls:/…> cdcd(„ComponentRuntimes‟)(„ComponentRuntimes‟) wls:/…> wls:/…> ls()ls() wls:/…> wls:/…> cdcd(„AdminServer_/browsestore‟)(„AdminServer_/browsestore‟) wls:/…> wls:/…> ls()ls()

You should see all the attributes for the browsestore application running on the You should see all the attributes for the browsestore application running on the AdminServer displayed like this:

(6)

Experiment by browsing around the WebLogic Server MBean trees using WLNav Experiment by browsing around the WebLogic Server MBean trees using WLNav

and/or WLST: don‟t forget, if you have problems with the syntax for WLST, just and/or WLST: don‟t forget, if you have problems with the syntax for WLST, just

use WLNav and look up the command history. use WLNav and look up the command history.

When you have finished, disconnect from WLST with the following commands: When you have finished, disconnect from WLST with the following commands:

wls:/…>

wls:/…> disconnect()disconnect() wls:/offline>

(7)

Lab 2

Lab 2

Changing WebLogic Server Debug settings

Changing WebLogic Server Debug settings

Start the DiagnosticsLab

Start the DiagnosticsLab AdminServerAdminServer and logon to the and logon to the admin console. admin console. NavigateNavigate to the

to the Environment -> Servers ->AdminServerEnvironment -> Servers ->AdminServer page and select thepage and select the DebugDebug tab.tab. This screen allows you to set the various debug flags that will cause WebLogic This screen allows you to set the various debug flags that will cause WebLogic Server to output

Server to output detailed debug messages from its detailed debug messages from its subsystems. subsystems. You should seeYou should see

two

two nodes: „default‟ and nodes: „default‟ and „weblogic‟. „weblogic‟. Click onClick on the „+‟ sign to expand the „weblogic‟the „+‟ sign to expand the „weblogic‟

node and you should see a list of subsystems like this: node and you should see a list of subsystems like this:

You can use this page to change WebLogic Server‟s debug settings dynamically. You can use this page to change WebLogic Server‟s debug settings dynamically.

You would usually start by enabling debugging at the subsystem level; however, You would usually start by enabling debugging at the subsystem level; however, this will typically produce a great deal of output and so you will usually want to this will typically produce a great deal of output and so you will usually want to turn on particular debug flags within a given subsystem while turning off debug at turn on particular debug flags within a given subsystem while turning off debug at the subsystem level, once you have isolated the problem or area you wish to the subsystem level, once you have isolated the problem or area you wish to investigate.

investigate.

For this lab, try turning on debugging for the „diagnostics‟ subsystem as a whole. For this lab, try turning on debugging for the „diagnostics‟ subsystem as a whole. If you expand the „diagnostics‟ node, you will see that this covers a

If you expand the „diagnostics‟ node, you will see that this covers a whole set ofwhole set of debug options as shown in the following screenshot:

(8)

Here we have specifically enabled debug messages for the instrumentation Here we have specifically enabled debug messages for the instrumentation module as well as turning on debugging for the diagnostics subsystem as a module as well as turning on debugging for the diagnostics subsystem as a whole.

whole. This means This means that all that all the other the other modules also have modules also have debug enabled. debug enabled. As youAs you will see, this produces a great deal of output and you may want to limit that by will see, this produces a great deal of output and you may want to limit that by turning off the

turning off the debug flag for debug flag for the diagnostics subsystem as the diagnostics subsystem as a whole. a whole. TryTry

experimenting with other debug options: other subsystems of interest might be experimenting with other debug options: other subsystems of interest might be

„servlet‟, „deploy‟ or „application‟. „servlet‟, „deploy‟ or „application‟.

To view the debug messages, select the „Logging‟ tab (next to „Debug‟), scroll To view the debug messages, select the „Logging‟ tab (next to „Debug‟), scroll down and

down and expand the expand the „Advanced‟ section. „Advanced‟ section. Change theChange the Minimum severity to logMinimum severity to log

to „Debug‟ so that the debug messages appear in the server‟s log located in to „Debug‟ so that the debug messages appear in the server‟s log located in

%DOMAIN_HOME%\servers\AdminServer\logs\AdminServer.log

%DOMAIN_HOME%\servers\AdminServer\logs\AdminServer.log . . If If you you watchwatch the log as you work your way through the lab, you will see all the various

the log as you work your way through the lab, you will see all the various diagnostic messages.

(9)

Lab 3

Lab 3

Configuring a JDBC Diagnostic Archive

Configuring a JDBC Diagnostic Archive

In this lab, you will configure your local Oracle Database 10g XE instance to act In this lab, you will configure your local Oracle Database 10g XE instance to act as a WLDF Diagnostic Archive

as a WLDF Diagnostic Archive. . If you If you haven‟t already done haven‟t already done so, please so, please installinstall

Oracle Database 10g XE on your local system, and run

Oracle Database 10g XE on your local system, and run OracleXETNSListenerOracleXETNSListener and

and OracleServiceXEOracleServiceXE windows services.windows services. 

 Go toGo to http://localhost:8080/apex/ http://localhost:8080/apex/ , enter your system, enter your system as username andas username and

systems‟s password. systems‟s password.

 Navigate toNavigate to Administration->Database UsersAdministration->Database Users and clickand click CreateCreate button.button. 

 create a user „weblogic‟ with password „weblogic‟create a user „weblogic‟ with password „weblogic‟, grant CONNECT and, grant CONNECT and RESOURCE roles to it.

RESOURCE roles to it.

 Open command prompt and run sqlplus with weblogic uOpen command prompt and run sqlplus with weblogic u ser‟s credentials.ser‟s credentials. You should logged in successfully.

(10)

 Before creating the data source to use for the Diagnostic Archive, youBefore creating the data source to use for the Diagnostic Archive, you need to create the database schema that WebLogic Server will use to need to create the database schema that WebLogic Server will use to store its diagnostic

store its diagnostic data. data. WebLogic Server uses WebLogic Server uses two tables:two tables: WLDF_HVSTWLDF_HVST (to store WLDF harvested metric data) and

(to store WLDF harvested metric data) and WLS_EVENTSWLS_EVENTS (to store(to store WLDF event data).

WLDF event data). A SQL A SQL script to create script to create these tables is available these tables is available inin %LAB_HOME%\SQL\WLDF_Data_Archive_Oracle.ddl

%LAB_HOME%\SQL\WLDF_Data_Archive_Oracle.ddl .. Execute this script from sqlplus to create the tables. Execute this script from sqlplus to create the tables.

When you have created the database schema, use the admin console to create a When you have created the database schema, use the admin console to create a new data source to use for the JDBC Diagnostic Archive.

new data source to use for the JDBC Diagnostic Archive. 

 Navigate to theNavigate to the Services-> Data SourcesServices-> Data Sources page and selectpage and select New->GenericNew->Generic Data Source

Data Source.. 

 SetSet NameName == ArchiveDSArchiveDS, JNDI Name =, JNDI Name = ArchiveDS,ArchiveDS, Database type =Database type = Oracle,

Oracle, clickclick NextNext 

(11)

 Enter the following in theEnter the following in the Connection PropertiesConnection Properties page: Database name =page: Database name = XE

XE, Host Name =, Host Name = localhostlocalhost, port =, port = 15211521, database username =, database username = weblogicweblogic,, password =

password = weblogicweblogic. Click. Click NextNext 

 PressPress Test ConfigurationTest Configuration button. You should see the messagebutton. You should see the message

““Connection Test SucceededConnection Test Succeeded”. Click”. Click NextNext.. 

 SelectSelect AdminServerAdminServer as a target, clickas a target, click FinishFinish..

When you have created the JDBC data source (ArchiveDS), configure a JDBC When you have created the JDBC data source (ArchiveDS), configure a JDBC Diagnostic Archive using the admin console:

Diagnostic Archive using the admin console: 

 navigate tonavigate to Diagnostics -> ArchivesDiagnostics -> Archives 

 selectselect AdminServerAdminServer 

 set Type =set Type = JDBCJDBC, Data Source =, Data Source = ArchiveDSArchiveDS, click, click SaveSave..

Restart the AdminServer server to consume this configuration change. Restart the AdminServer server to consume this configuration change.

(12)

Lab 4

Lab 4

Creating

Creating a System D

a System Diagnos

iagnostic Modul

tic Module

e

To use the WebLogic Diagnostic Framework on AdminServer, you need to create To use the WebLogic Diagnostic Framework on AdminServer, you need to create a System Diagnostic Module.

a System Diagnostic Module. 

 Log on to the admin console and go toLog on to the admin console and go to Diagnostics -> Diagnostic ModulesDiagnostics -> Diagnostic Modules.. 

 CreateCreate NewNewbutton, name button, name your your new new Diagnostic ModuleDiagnostic Module DiagnosticLabModule

DiagnosticLabModule and clickand click OkOk.. 

 Click on the newly created module and go to theClick on the newly created module and go to the TargetsTargets tab.tab. 

 Set AdminServer.as a target for the module, clickSet AdminServer.as a target for the module, click SaveSave.. Notice

Notice that besides the „that besides the „General‟General‟ tab, there are three additional tabs that you usetab, there are three additional tabs that you use to configure

to configure MetricsMetrics;; Watches and NotificationsWatches and Notifications; and; and InstrumentationInstrumentation at a serverat a server level.

level. We will work with each oWe will work with each of these in turn, f these in turn, but note that you cbut note that you can control thean control the operation of the WebLogic Diagnostic Framework at the server level by enabling operation of the WebLogic Diagnostic Framework at the server level by enabling or disabling these features in the system diagnostic module.

or disabling these features in the system diagnostic module.

To see how the configuration for the diagnostic subsystem is persisted, open a To see how the configuration for the diagnostic subsystem is persisted, open a file browser and go to the

file browser and go to the <domain_home>/config/diagnostics<domain_home>/config/diagnostics folder to view thefolder to view the configuration files.

configuration files. There wThere will be ill be a file a file called DiagnosticLabModule-<x>.called DiagnosticLabModule-<x>.xml andxml and if you open this you will see that it contains the configuration for the diagnostic if you open this you will see that it contains the configuration for the diagnostic subsystem.

subsystem. As you As you progress through the lab progress through the lab exercises, you may exercises, you may want to returnwant to return and view this file to see how WebLogic Server stores its diagnostic configuration. and view this file to see how WebLogic Server stores its diagnostic configuration. Here is an example of a diagnostic system module with instrumentation, watch, Here is an example of a diagnostic system module with instrumentation, watch, notification and harvester elements configured.

(13)

Lab 5

Lab 5

Syst

System-Scoped Diagnostic Monitors

em-Scoped Diagnostic Monitors (WLDF

(WLDF

Profiles)

Profiles)

WebLogic Server 11gR1 ships with a number of example WLST scripts that you WebLogic Server 11gR1 ships with a number of example WLST scripts that you can use to configure diagnostic data gathering for most of the major subsystems. can use to configure diagnostic data gathering for most of the major subsystems. These can be found with the WebLogic Server 11gR1 examples:

These can be found with the WebLogic Server 11gR1 examples:

%MIDDLEWARE_HOME%/wlserver_10.3/samples/server/examples/src/example %MIDDLEWARE_HOME%/wlserver_10.3/samples/server/examples/src/example s/diagnostics/wldfprofiles/src

s/diagnostics/wldfprofiles/src

You will also find a copy of these scripts in the

You will also find a copy of these scripts in the %LAB_HOME%/Profiles%LAB_HOME%/Profiles folder,folder, for use with the labs.

for use with the labs.

There are a number of Jython files with utility classes used to create, enable and There are a number of Jython files with utility classes used to create, enable and disable WLDF diagnostic profiles as well as WLST scripts to create notifications disable WLDF diagnostic profiles as well as WLST scripts to create notifications using SMTP

using SMTP (email) and SNMP (email) and SNMP (network management) notifications. (network management) notifications. We willWe will look at how to configure various notification methods in the following labs, so for look at how to configure various notification methods in the following labs, so for

now let‟s concentrate on the WLST scripts to enable/disable diagnostic metric now let‟s concentrate on the WLST scripts to enable/disable diagnostic metric

and event data collection for the major WebLogic subsystems (Core, EJB, JDBC, and event data collection for the major WebLogic subsystems (Core, EJB, JDBC, JMS, JTA,

JMS, JTA, WebApp and Web Services). WebApp and Web Services). There is a There is a WLDF Profiles OverviewWLDF Profiles Overview document in the

document in the

%MIDDLEWARE_HOME%/wlserver_10.3/samples/server/examples/src/example %MIDDLEWARE_HOME%/wlserver_10.3/samples/server/examples/src/example s/diagnostics/wldfprofiles

s/diagnostics/wldfprofiles directory (directory (Instructions.htmlInstructions.html): this has more detail on the): this has more detail on the different profiles and how to use

different profiles and how to use them. them. As you will As you will see, It is very see, It is very easy to useeasy to use these diagnostic profiles with any WebLogic Server domain.

these diagnostic profiles with any WebLogic Server domain.

Open a command shell (set your environment with setDomainEnv.cmd), cd to Open a command shell (set your environment with setDomainEnv.cmd), cd to %LAB_HOME%/Profiles

%LAB_HOME%/Profiles and run the following weblogic.WLST command toand run the following weblogic.WLST command to enable all profiles on AdminServer:

enable all profiles on AdminServer: > 

>  java weblogic.WLST enableAllProfiles.py user="weblogic" pass="weblogic1"  java weblogic.WLST enableAllProfiles.py user="weblogic" pass="weblogic1"  url="t3://localhost:7001" wldfResource="DiagnosticLabModule" 

url="t3://localhost:7001" wldfResource="DiagnosticLabModule"  targets="AdminServer" harvesterPeriod=60000 

targets="AdminServer" harvesterPeriod=60000 

You should see several screens of output messages from WLST, rather like this: You should see several screens of output messages from WLST, rather like this:

(14)

Now open the admin console and navigate to the

Now open the admin console and navigate to the Diagnostics -> DiagnosticDiagnostics -> Diagnostic Modules

Modules page; click onpage; click on DiagnosticLabModuleDiagnosticLabModule to view the new configuration andto view the new configuration and start by selecting the

start by selecting the Collected MetricsCollected Metrics tab. tab. You will You will see a see a number of number of keykey WebLogic Server metrics are now being collected, like this:

WebLogic Server metrics are now being collected, like this:

Click on one of the metric sets (e.g.

Click on one of the metric sets (e.g. JDBCDataSourceRuntimeMBeanJDBCDataSourceRuntimeMBean) and notice) and notice that the system has been configured to collect metrics on all available attributes that the system has been configured to collect metrics on all available attributes of this runtime MBean, which will provide a wealth of data about the health and of this runtime MBean, which will provide a wealth of data about the health and performance of the JDBC subsystem:

(15)

To collect JDBC metric data on the

To collect JDBC metric data on the ArchiveDSArchiveDS data source you created earlier,data source you created earlier, all you now have to do is switch to the Instances tab and move the MBean all you now have to do is switch to the Instances tab and move the MBean

instance from „

instance from „Available‟Available‟ to „to „Chosen‟Chosen‟ andand SaveSave. . Remember to Remember to check that check that thethe

Metric („JDBCDataSourceRuntimeMBean‟) has been enabled and that metric Metric („JDBCDataSourceRuntimeMBean‟) has been enabled and that metric

collection is also enabled in the system diagnostic module. collection is also enabled in the system diagnostic module. If you now return to the

If you now return to the DiagnosticLabModuleDiagnosticLabModule page and select thepage and select the Watches andWatches and Notifications

Notifications tab, you will see that a number of WLDF watches have also beentab, you will see that a number of WLDF watches have also been configured:

(16)

Click on one of these to view the configuration (for example,

Click on one of these to view the configuration (for example, JRockitHeapWatchJRockitHeapWatch)) and then select the Rule Expression tab to view the definition of the watch rule. and then select the Rule Expression tab to view the definition of the watch rule. In this case, it is:

In this case, it is:

${[weblogic.management.runtime.JRockitRuntim

${[weblogic.management.runtime.JRockitRuntimeMBean]//HeapFreePercent} eMBean]//HeapFreePercent} < <  10 

10 

This means that WLDF will watch for a condition where JRockit is reporting that This means that WLDF will watch for a condition where JRockit is reporting that less than 10% of the

less than 10% of the available heap memory is free. available heap memory is free. Remember that you canRemember that you can always enable/disable this particular watch, and you can also enable/disable all always enable/disable this particular watch, and you can also enable/disable all watches in the

watches in the configuration for the system configuration for the system diagnostic module. diagnostic module. The watch The watch is nowis now configured and you can easily create notifications that will fire if the watch rule configured and you can easily create notifications that will fire if the watch rule evaluates to true (we

evaluates to true (we will see how to will see how to do this later). do this later). The diagnostic profile scriptThe diagnostic profile script will already have created two notifications, using JMX and SNMP, and you now will already have created two notifications, using JMX and SNMP, and you now only have to complete the configuration for those notifications (for example, only have to complete the configuration for those notifications (for example, providing javamail properties for the SMTP notification).

providing javamail properties for the SMTP notification).

You might like to revisit the system diagnostic module‟s configuration file You might like to revisit the system diagnostic module‟s configuration file

<domain_home>/config/diagnostics/DiagnosticLabModule-<x>.xml

<domain_home>/config/diagnostics/DiagnosticLabModule-<x>.xml to view theto view the changes that have been added to the system diagnostic descriptor.

(17)

Lab 6

Lab 6

Enabling Application-Scoped Instrumentation

Enabling Application-Scoped Instrumentation

One of the powerful features of the WebLogic Diagnostic Framework is its ability One of the powerful features of the WebLogic Diagnostic Framework is its ability to support instrumentation of application code, using the AspectJ implementation to support instrumentation of application code, using the AspectJ implementation of the

of the Aspect-Oriented Programming (AOP) Aspect-Oriented Programming (AOP) model. model. Essentaily, this enables Essentaily, this enables youyou to define various diagnostic actions (such as trace messages, display arguments to define various diagnostic actions (such as trace messages, display arguments and return values, elapsed time statistics, stack traces and thread dumps) that and return values, elapsed time statistics, stack traces and thread dumps) that are to be executed whenever any method matching a particular pattern (called a are to be executed whenever any method matching a particular pattern (called a

„pointcut‟) is called or executed.

„pointcut‟) is called or executed. There is no nThere is no need to make aeed to make any modifications tony modifications to

the application source code and in fact instrumentation can be enabled on an the application source code and in fact instrumentation can be enabled on an application deployed as a packaged Java archive (such as an .ear or .war file). application deployed as a packaged Java archive (such as an .ear or .war file). WebLogic Server provides an abstraction layer to simplify the task of configuring WebLogic Server provides an abstraction layer to simplify the task of configuring application instrumentation, using constructs called diagnostic monitors which application instrumentation, using constructs called diagnostic monitors which are pre-configured to execute certain diagnostic actions, leaving the programmer are pre-configured to execute certain diagnostic actions, leaving the programmer or administrator to specify only the context in which diagnostic traces are wanted. or administrator to specify only the context in which diagnostic traces are wanted. It is possible to configure system-scoped diagnostic monitors that will execute, It is possible to configure system-scoped diagnostic monitors that will execute, for example, whenever any servlet session is created, or whenever a JDBC for example, whenever any servlet session is created, or whenever a JDBC connection is started.

connection is started. This makes This makes it easy it easy to configure to configure application instrumentationapplication instrumentation but often these system-scoped diagnostic monitors produce too much diagnostic but often these system-scoped diagnostic monitors produce too much diagnostic data, particularly in a

data, particularly in a large and complicated application. large and complicated application. In such cases, In such cases, it is oftenit is often better to use application-scoped instrumentation, which allows more fine-grained better to use application-scoped instrumentation, which allows more fine-grained control over the diagnostic data that is generated.

control over the diagnostic data that is generated.

In this lab, you will, learn how to configure application-scoped instrumentation for In this lab, you will, learn how to configure application-scoped instrumentation for custom applications.

custom applications. We will We will work wwork with theith the browsestorebrowsestore andand ShoppingCartShoppingCart webweb applications

applications – – these are simple webapps that contain a number of Java classesthese are simple webapps that contain a number of Java classes that implement the

that implement the servlet interface. servlet interface. We will configure We will configure instrumention to gatherinstrumention to gather diagnostic data on these servlet classes.

diagnostic data on these servlet classes. You will find

You will find a copy a copy of the of the browsestore application in thebrowsestore application in the %LAB_HOME%/apps%LAB_HOME%/apps folder.

folder. You You will find will find a a folder calledfolder called browsestorebrowsestore with two sub-folders, appwith two sub-folders, app andand plan

plan: the first contains: the first contains browsestore.warbrowsestore.war in exploded .war format and the secondin exploded .war format and the second will contain the Deployment Plan, which we will use to reconfigure the diagnostic will contain the Deployment Plan, which we will use to reconfigure the diagnostic module later on.

module later on. We will not be versioning the We will not be versioning the app, so this directory structure willapp, so this directory structure will suffice for now.

suffice for now.

Remember that you configured the domain to support Fastswap with the Remember that you configured the domain to support Fastswap with the WebLogic Diagnostic Framework: this means that changes to compiled Java WebLogic Diagnostic Framework: this means that changes to compiled Java classes automatically reloaded via Fastswap can contain instrumentation classes automatically reloaded via Fastswap can contain instrumentation  – –

WebLogic Server‟ will invoke the AspectJ compiler to „weave‟ the instrumentation WebLogic Server‟ will invoke the AspectJ compiler to „weave‟ the instrumentation

into the newly-compiled classes. into the newly-compiled classes. First note that we have to enable

First note that we have to enable Fastswap in the app‟s WEBFastswap in the app‟s WEB-INF/weblogic.xml-INF/weblogic.xml deployment descriptor, as follows:

(18)

<?xml version='1.0' encoding='UTF-8'?>  <?xml version='1.0' encoding='UTF-8'?>  <weblogic-web-app xmlns="http://www.bea.com/ns/weblogic/90"  <weblogic-web-app xmlns="http://www.bea.com/ns/weblogic/90"  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">  <fast-swap/>  <fast-swap/>  </weblogic-web-app>  </weblogic-web-app> 

To enable instrumentation, an additional deployment descriptor is added to the To enable instrumentation, an additional deployment descriptor is added to the

app‟s META

app‟s META-INF directory, -INF directory, called weblogic-diagnostics.called weblogic-diagnostics.xml. xml. Open this Open this file with file with aa browser or XML editor and look at the <instrumentation> section, which defines browser or XML editor and look at the <instrumentation> section, which defines the application-scoped instrumentation for this application:

the application-scoped instrumentation for this application: <instrumentation> <instrumentation> <enabled>true</enabled> <enabled>true</enabled> <include>com.servlets.*</include> <include>com.servlets.*</include> <wldf-instrumentation-monitor> <wldf-instrumentation-monitor> <name>ServletArgs</name> <name>ServletArgs</name> <enabled>true</enabled> <enabled>true</enabled> <action>DisplayArgumentsAction</action> <action>DisplayArgumentsAction</action> <location-type>before</location-type> <location-type>before</location-type>

<pointcut>call( * com.servlets.* get*(...));</pointcut> <pointcut>call( * com.servlets.* get*(...));</pointcut> </wldf-instrumentation-monitor> </wldf-instrumentation-monitor> <wldf-instrumentation-monitor> <wldf-instrumentation-monitor> <name>ServletRetVal</name> <name>ServletRetVal</name> <enabled>true</enabled> <enabled>true</enabled> <action>DisplayArgumentsAction</action> <action>DisplayArgumentsAction</action> <location-type>after</location-type> <location-type>after</location-type>

<pointcut>call( * com.servlets.* get*(...));</pointcut> <pointcut>call( * com.servlets.* get*(...));</pointcut> </wldf-instrumentation-monitor> </wldf-instrumentation-monitor> <wldf-instrumentation-monitor> <wldf-instrumentation-monitor> <name>ServletElapsed</name> <name>ServletElapsed</name> <enabled>true</enabled> <enabled>true</enabled> <action>TraceElapsedTimeAction</action> <action>TraceElapsedTimeAction</action> <location-type>around</location-type> <location-type>around</location-type>

<pointcut>call( * com.servlets.* get*(...));</pointcut> <pointcut>call( * com.servlets.* get*(...));</pointcut> </wldf-instrumentation-monitor> </wldf-instrumentation-monitor> <wldf-instrumentation-monitor> <wldf-instrumentation-monitor> <name>ServletStack</name> <name>ServletStack</name> <enabled>true</enabled> <enabled>true</enabled> <action>StackDumpAction</action> <action>StackDumpAction</action> <location-type>before</location-type> <location-type>before</location-type>

(19)

<pointcut>call( * com.servlets.* getPaper*(...));</pointcut> <pointcut>call( * com.servlets.* getPaper*(...));</pointcut> </wldf-instrumentation-monitor> </wldf-instrumentation-monitor> <wldf-instrumentation-monitor> <wldf-instrumentation-monitor> <name>ServletThreads</name> <name>ServletThreads</name> <enabled>true</enabled> <enabled>true</enabled> <action>ThreadDumpAction</action> <action>ThreadDumpAction</action> <location-type>before</location-type> <location-type>before</location-type>

<pointcut>call( * com.servlets.* getFurn*(...));</pointcut> <pointcut>call( * com.servlets.* getFurn*(...));</pointcut> </wldf-instrumentation-monitor> </wldf-instrumentation-monitor> <wldf-instrumentation-monitor> <wldf-instrumentation-monitor> <name>ServletStats</name> <name>ServletStats</name> <enabled>true</enabled> <enabled>true</enabled> <action>MethodInvocationStatisticsAction</action> <action>MethodInvocationStatisticsAction</action> <location-type>around</location-type> <location-type>around</location-type>

<pointcut>call( * com.servlets.* get*(...));</pointcut> <pointcut>call( * com.servlets.* get*(...));</pointcut> </wldf-instrumentation-monitor>

</wldf-instrumentation-monitor> </instrumentation>

</instrumentation>

The <wldf-instrumentation> stanzas configure diagnostic monitors that will The <wldf-instrumentation> stanzas configure diagnostic monitors that will produce a variety of diagnostic actions (e.g.

produce a variety of diagnostic actions (e.g. MethodInvocationStatisticsActionMethodInvocationStatisticsAction))

whenever any

whenever any class which matches class which matches a certain pattern (or a certain pattern (or “pointcut”) is called. “pointcut”) is called. Of Of 

course, the secret to producing the most useful diagnostic data is to specify the course, the secret to producing the most useful diagnostic data is to specify the classes to trace as tightly as possible.

classes to trace as tightly as possible.

To see the diagnostic monitors in operation, deploy the application using the To see the diagnostic monitors in operation, deploy the application using the admin console.

admin console.

When you have done so, browse to the

When you have done so, browse to the Deployments -> browsestore ->Deployments -> browsestore -> Configuration -> Instrumentation

Configuration -> Instrumentation page and note that the diagnostic configurationpage and note that the diagnostic configuration from the weblogic-diagnostics.xml descriptor is reflected there:

from the weblogic-diagnostics.xml descriptor is reflected there:

Make sure that your system diagnostic module (

Make sure that your system diagnostic module ( DiagnosticLabModuleDiagnosticLabModule) has) has instrumentation enabled, check it in the

instrumentation enabled, check it in the Diagnostics -> Diagnostics Modules ->Diagnostics -> Diagnostics Modules -> DiagnosticLabModule -> Instrumentation Tab

(20)

Run the application

Run the application ((http://localhost:7001/browsestorehttp://localhost:7001/browsestore)) and browse the store toand browse the store to generate some diagnostic trace

generate some diagnostic trace information. information. You can You can see the see the diagnostic data (indiagnostic data (in raw form

raw form – – we will look later at how to extract and refactor that data) by openingwe will look later at how to extract and refactor that data) by opening a SQL*Plus command window as weblogic user and running the following SQL a SQL*Plus command window as weblogic user and running the following SQL query:

query: SQL>

SQL> select monitor, classname, methodname from wls_eventsselect monitor, classname, methodname from wls_events;;

Because you will be generating a fair amount of diagnostic event data, you may Because you will be generating a fair amount of diagnostic event data, you may find it easier to see the diagnostic data being generated if you first truncate the find it easier to see the diagnostic data being generated if you first truncate the wls_events table

wls_events table (“SQL> truncate table wls_events; commit;”)(“SQL> truncate table wls_events; commit;”) before running thebefore running the application; you can then view the fresh diagnostic traces by running the SQL application; you can then view the fresh diagnostic traces by running the SQL select statement.

(21)

Lab 7

Lab 7

Exporting and Transforming WLDF Event Data

Exporting and Transforming WLDF Event Data

Open a command shell and set your environment with setDomainEnv.cmd, CD to Open a command shell and set your environment with setDomainEnv.cmd, CD to your

your %LAB_HOME%\Transforms%LAB_HOME%\Transforms directory. directory. Use Use WLST to WLST to export your export your diagnosticdiagnostic event archive to a local XML file:

event archive to a local XML file: > 

>  java weblogic.WLST java weblogic.WLST wls:/offline>  wls:/offline> connect('weblogic','weblogic1','t3://localhost:7001')connect('weblogic','weblogic1','t3://localhost:7001') wls:/DiagnosticLab/serverConfig>  wls:/DiagnosticLab/serverConfig>  exportDiagnosticDataFromServer(logicalName='EventsDataArchive',exportFileN exportDiagnosticDataFromServer(logicalName='EventsDataArchive',exportFileN ame='DiagnosticEvents.xml') ame='DiagnosticEvents.xml') wls:/DiagnosticLab/serverConfig>  wls:/DiagnosticLab/serverConfig> disconnect()disconnect() wls:/offline>  wls:/offline> exit()exit() Open

Open DiagnosticEvents.xmlDiagnosticEvents.xml with a text editor. with a text editor. You will You will see that the see that the XML fileXML file consists of a

consists of a <DataInfo><DataInfo> stanza that describes the data that is held in thisstanza that describes the data that is held in this diagnostic archive: note how this matches the database schema you can view diagnostic archive: note how this matches the database schema you can view

using SQL*Plus with the comm

using SQL*Plus with the command: „desc wls_events;‟. and: „desc wls_events;‟. The rest of the The rest of the XML fileXML file

consists of multiple

consists of multiple <DataRecord><DataRecord> stanzas which contain the actual event data.stanzas which contain the actual event data. If you scroll down, you will see the payloads for the

If you scroll down, you will see the payloads for the StackDumpActionStackDumpAction andand ThreadDumpAction

ThreadDumpAction events. events. Add the Add the following Processing Instruction to following Processing Instruction to use theuse the wldfEvents.xsl Stylesheet provided (in the DiagnosticsLab/Transforms folder): wldfEvents.xsl Stylesheet provided (in the DiagnosticsLab/Transforms folder): <?xml-stylesheet type="text/xsl" href="wldfEvents.xsl"?> 

<?xml-stylesheet type="text/xsl" href="wldfEvents.xsl"?> 

The start of the file should now look like this: The start of the file should now look like this: <?xml version='1.0' encoding='utf-8'?>

<?xml version='1.0' encoding='utf-8'?>

<?xml-stylesheet type="text/xsl" href="wldfEvents.xsl"?> <?xml-stylesheet type="text/xsl" href="wldfEvents.xsl"?>

<DiagnosticData xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" <DiagnosticData xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.bea.com/ns/weblogic/90/diagnostics/accessor/e xsi:schemaLocation="http://www.bea.com/ns/weblogic/90/diagnostics/accessor/e xport.xsd export.xsd" xport.xsd export.xsd" xmlns="http://www.bea.com/ns/weblogic/90/diagnostics/accessor/Export"> xmlns="http://www.bea.com/ns/weblogic/90/diagnostics/accessor/Export"> <DataInfo> <DataInfo> … …

Open the file with a browser and you should see something like this: Open the file with a browser and you should see something like this:

(22)

Have a quick look at the supplied

Have a quick look at the supplied wldf_events.xslwldf_events.xsl stylesheet, which you canstylesheet, which you can customize if you wish to

customize if you wish to provide a custom view provide a custom view of the WLDF Event of the WLDF Event data. data. If youIf you

are familiar with XSLT transforms, you might be interested to look at Phil Aston‟s are familiar with XSLT transforms, you might be interested to look at Phil Aston‟s excellent article “Mining WebLogic Diagnostic Data with XSLT”, which discuss excellent article “Mining WebLogic Diagnostic Data with XSLT”, which discuss eses how you can use XSLT to generate hierarchical reports from WLDF diagnostic how you can use XSLT to generate hierarchical reports from WLDF diagnostic events:

events:

http://www.oracle.com/technetwork/articles/entarch/mining-wldf-xslt-083813.html http://www.oracle.com/technetwork/articles/entarch/mining-wldf-xslt-083813.html

(23)

Lab 8

Lab 8

Configuring Collected Metrics Harvesting

Configuring Collected Metrics Harvesting

Open Admin Console , navigate to Diagnostics-> Diagnostics Modules -> Open Admin Console , navigate to Diagnostics-> Diagnostics Modules -> DiagnosticLabModule->Collected Metrics

DiagnosticLabModule->Collected Metrics. Set the Sampling Period to 60000 ms. Set the Sampling Period to 60000 ms and check that metrics is enabled

and check that metrics is enabled

Look through Collected Metrics table and try to find Look through Collected Metrics table and try to find WebAppComponentRuntimeMBean

WebAppComponentRuntimeMBean, If this metric exists, select it and click, If this metric exists, select it and click DeleteDelete button.

button.

Create a Metric based on the ServerRuntimeMBean server: Create a Metric based on the ServerRuntimeMBean server:

 ClickClick NewNew 

 For theFor the MBean Server LocationMBean Server Location choose ServerRuntimechoose ServerRuntime 

 For theFor the MBean typeMBean type, select custom, select custom MBean TypeMBean Type and enter:and enter:

weblogic.management.runtime.WebAppComponentRuntimeMBean weblogic.management.runtime.WebAppComponentRuntimeMBean 

 For Collected Attributes, choose:For Collected Attributes, choose: StatusStatus,, OpenSessionsCurrentCountOpenSessionsCurrentCount,, SessionsOpenedTotalCount

SessionsOpenedTotalCount 

 For Collected Instances, use:For Collected Instances, use:

com.bea:ApplicationRuntime=Shopping,Name=AdminServer_/ShoppingC com.bea:ApplicationRuntime=Shopping,Name=AdminServer_/ShoppingC art,ServerRuntime=AdminServer,Type=WebAppComponentRuntime art,ServerRuntime=AdminServer,Type=WebAppComponentRuntime 

 ClickClick FinishFinish

Open a few browser windows and run the ShoppingCart application Open a few browser windows and run the ShoppingCart application

(24)

true, we want each browser window to open a new session to the application true, we want each browser window to open a new session to the application server.

server. You can You can force this force this behaviour bybehaviour by clearing the browser‟s session cookiesclearing the browser‟s session cookies

(Firefox:

(Firefox: Tools -> Options ->Privacy->Remove Individual Cookies,Tools -> Options ->Privacy->Remove Individual Cookies, InternetInternet Explorer:

Explorer: Tools -> Internet Options -> General -> Delete CookiesTools -> Internet Options -> General -> Delete Cookies) and reloading) and reloading the application.

the application.

Use the admin console to monitor the number of sessions by navigating to Use the admin console to monitor the number of sessions by navigating to Deployments -> browsestore -> monitoring -> Sessions

Deployments -> browsestore -> monitoring -> Sessions. . After a After a couple ofcouple of minutes, you should be able to use SQL*Plus to view the WLDF Collected minutes, you should be able to use SQL*Plus to view the WLDF Collected Metrics with the following SQL command:

Metrics with the following SQL command:

SQL> select server, type, name, attrname, attrvalue from wls_hvst; SQL> select server, type, name, attrname, attrvalue from wls_hvst;

(25)

Lab 9

Lab 9

Exporting and Transforming WLDF Collected

Exporting and Transforming WLDF Collected

Metrics Data

Metrics Data

Open a command shell and set your environment with setDomainEnv.cmd, CD to Open a command shell and set your environment with setDomainEnv.cmd, CD to your

your %LAB_HOME%\Transforms%LAB_HOME%\Transforms directory. directory. Use Use WLST to WLST to export your export your diagnosticdiagnostic collected metrics archive to a local XML file:

collected metrics archive to a local XML file: > 

>  java weblogic.WLST java weblogic.WLST wls:/offline>  wls:/offline> connect('weblogic','weblogic1','t3://localhost:7001')connect('weblogic','weblogic1','t3://localhost:7001') wls:/DiagnosticLab/serverConfig>  wls:/DiagnosticLab/serverConfig>  exportDiagnosticDataFromServer(logicalName='HarvestedDataArchive',exportFil exportDiagnosticDataFromServer(logicalName='HarvestedDataArchive',exportFil eName='DiagnosticMetrics.xml') eName='DiagnosticMetrics.xml') wls:/DiagnosticLab/serverConfig>  wls:/DiagnosticLab/serverConfig> disconnect()disconnect() wls:/offline>  wls:/offline> exit()exit() Open

Open DiagnosticMetrics.xmlDiagnosticMetrics.xml with an editor and add the following processingwith an editor and add the following processing instruction to use the wldfMetrics.xsl Stylesheet provided (in the

instruction to use the wldfMetrics.xsl Stylesheet provided (in the %LAB_HOME%/Transforms

%LAB_HOME%/Transforms folder):folder):

<?xml-stylesheet type="text/xsl" href="wldfMetrics.xsl"?>  <?xml-stylesheet type="text/xsl" href="wldfMetrics.xsl"?>  The start of the file should look like this:

The start of the file should look like this: <?xml version='1.0' encoding='utf-8'?>  <?xml version='1.0' encoding='utf-8'?> 

<?xml-stylesheet type="text/xsl" href="wldfMetrics.xsl"?>  <?xml-stylesheet type="text/xsl" href="wldfMetrics.xsl"?> 

<DiagnosticData xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"  <DiagnosticData xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"  xsi:schemaLocation="http://www.bea.com/ns/weblogic/90/diagnostics/accessor/e  xsi:schemaLocation="http://www.bea.com/ns/weblogic/90/diagnostics/accessor/e  xport.xsd export.xsd"  xport.xsd export.xsd"  xmlns="http://www.bea.com/ns/weblogic/90/diagnostics/accessor/Export">  xmlns="http://www.bea.com/ns/weblogic/90/diagnostics/accessor/Export">  <DataInfo>  <DataInfo>  … …

Now open the file DiagnosticMetrics.xml with a browser and you should see Now open the file DiagnosticMetrics.xml with a browser and you should see something like this:

(26)
(27)

Lab 10

Lab 10

Configuring Diagnostic Watches

Configuring Diagnostic Watches

In this lab, you will use the Admin Console to create a diagnostic watch: In this lab, you will use the Admin Console to create a diagnostic watch: Navigate to

Navigate to Diagnostics -> Diagnostic Modules -> DiagnosticLabModule ->Diagnostics -> Diagnostic Modules -> DiagnosticLabModule -> Watches and Notifications

Watches and Notifications.. 

 Select the Watches tab and clickSelect the Watches tab and click NewNew:: 

 Set watch Name:Set watch Name: ShoppingWatch,ShoppingWatch, watch Type:watch Type: Collected MetricsCollected Metrics, Enable, Enable Watch:

Watch: Checked,Checked, clickclick NextNext 

 ClickClick Add ExpressionsAdd Expressions ButtonButton 

 Select MBean Server Location:Select MBean Server Location: ServerRuntimeServerRuntime 

 Mbean Type:Mbean Type:

weblogic.management.runtime.WebAppComponentRuntimeMBean weblogic.management.runtime.WebAppComponentRuntimeMBean   Instance:Instance: com.bea:ApplicationRuntime=Shopping,Name=AdminServer_/ShoppingC com.bea:ApplicationRuntime=Shopping,Name=AdminServer_/ShoppingC ard,ServerRuntime=AdminServer,Type=WebAppComponentRuntime ard,ServerRuntime=AdminServer,Type=WebAppComponentRuntime 

 Message Attribute:Message Attribute: OpenSessionsCurrentCountOpenSessionsCurrentCount, Operator:, Operator: >=>= , Value:, Value: 33 This will produce a watch rule:

This will produce a watch rule:

(${ServerRuntime//[weblogic.management.runtime.WebAppComponentRu  (${ServerRuntime//[weblogic.management.runtime.WebAppComponentRu  ntimeMBean]com.bea:ApplicationRuntime=Shopping,Name=AdminServer  ntimeMBean]com.bea:ApplicationRuntime=Shopping,Name=AdminServer   _/ShoppingCart,ServerRuntime=AdminServer,Type=WebAppComponent   _/ShoppingCart,ServerRuntime=AdminServer,Type=WebAppComponent  Runtime//OpenSessionsCurrentCount} >= 3) Runtime//OpenSessionsCurrentCount} >= 3) 

 ClickClick FinishFinish to go to the Configure Watch pageto go to the Configure Watch page – –you could add additionalyou could add additional watch expressions here and combine them to form a compound watch watch expressions here and combine them to form a compound watch

rule, but for

rule, but for now we‟ll now we‟ll keep it simple. keep it simple. Click onClick on FinishFinish to create theto create the diagnostic watch.

diagnostic watch.

At this point, you are able to configure an alarm (which enables you to control At this point, you are able to configure an alarm (which enables you to control how frequently the rule condition will be re-evaluated): you would use the Alarm how frequently the rule condition will be re-evaluated): you would use the Alarm

tab to do so,

tab to do so, but we won‟t do but we won‟t do so here. so here. You can also You can also configureconfigure Notifications thatNotifications that you want to fire when the watch rule expression evaluates to true, for example you want to fire when the watch rule expression evaluates to true, for example generating an SNMP trap, sending an email to the system administrator, putting generating an SNMP trap, sending an email to the system administrator, putting a message onto a

a message onto a JMS queue or broadcasting a JMS queue or broadcasting a JMX notification. JMX notification. We will set upWe will set up a set

a set of notifications in the of notifications in the next lab. next lab. After configuring the notifications, you wAfter configuring the notifications, you willill hook the watch up to the notifications and test to see these in action.

(28)

Lab 11

Lab 11

 –

 –

Configuring WLDF Notifications

Configuring WLDF Notifications

Configuring an SNMP Trap Notification

Configuring an SNMP Trap Notification

In this lab, you will configure WebLogic Server to generate SNMP traps that can In this lab, you will configure WebLogic Server to generate SNMP traps that can be monitored by network monitoring tools (such as HP Openview or IBM Tivoli). be monitored by network monitoring tools (such as HP Openview or IBM Tivoli). Open the admin console and navigate to

Open the admin console and navigate to Diagnostics -> SNMP -> AgentsDiagnostics -> SNMP -> Agents andand create a new server-scoped SNMP agent as follows:

create a new server-scoped SNMP agent as follows: 

 Create a new Server SNMP Agent, name itCreate a new Server SNMP Agent, name it DiagnosticSNMPAgentDiagnosticSNMPAgent 

 Select newly createdSelect newly created DiagnosticSNMPAgentDiagnosticSNMPAgent 

 Configuration->GeneralConfiguration->General tab: SNMP UDP Port:tab: SNMP UDP Port: 161161, Enabled:, Enabled: checkedchecked.. Click

Click SaveSave 

 TargetsTargets tab: settab: set AdminServerAdminServer as a target, click Saveas a target, click Save.. 

 Go toGo to Configuration->Trap Destination,Configuration->Trap Destination, clickclick NewNew Enter

Enter DiagnosticTrapDestinationDiagnosticTrapDestination as a name, Community: public, Host:as a name, Community: public, Host: localhost, Port: 162. Click OK.

localhost, Port: 162. Click OK. 

Now we need to create a new diagnostic notification that uses the SNMP trap Now we need to create a new diagnostic notification that uses the SNMP trap destination.

destination. 

 Navigate to the admin consoleNavigate to the admin console Diagnostics -> Diagnostic Modules ->Diagnostics -> Diagnostic Modules -> DiagnosticLabModule

DiagnosticLabModule page and select thepage and select the Watches and Notification tabWatches and Notification tab 

 Then Select Notifications and click onThen Select Notifications and click on NewNewto create a notification with theto create a notification with the following properties:

following properties: 

 Type: SNMP Trap, Name: LabSNMPNotification, Enabled: checkedType: SNMP Trap, Name: LabSNMPNotification, Enabled: checked Configuring a JMX Notification

Configuring a JMX Notification

In this lab you will configure a JMX notification. In this lab you will configure a JMX notification. Navigate to the admin console

Navigate to the admin console Diagnostics -> Diagnostic Modules ->Diagnostics -> Diagnostic Modules -> DiagnosticLabModule

DiagnosticLabModule page and select thepage and select the Watches and NotificationWatches and Notification tab. Thentab. Then Select

Select NotificationsNotifications and click on New to create a notification with the followingand click on New to create a notification with the following properties: properties: Name: LabJMXNotification Name: LabJMXNotification Type: JMX Type: JMX Enabled: checked Enabled: checked Receiving SNMP/JMX Notifications Receiving SNMP/JMX Notifications

In this lab, you will test the diagnostic watch and notifications configured in the In this lab, you will test the diagnostic watch and notifications configured in the preceding labs.

preceding labs. We have We have already created a already created a watch (watch ( ShoppingWatchShoppingWatch) but we need) but we need to hook

to hook it up it up to the to the newly-created notifications. newly-created notifications. Navigate toNavigate to Diagnostics ->Diagnostics -> Diagnostic Modules -> LabDiagnosticModule -> Watches and Notifications -> Diagnostic Modules -> LabDiagnosticModule -> Watches and Notifications -> Watches

Watches ->-> ShoppingWatch ->NotificationsShoppingWatch ->Notifications and moveand move LabSNMPNotificationLabSNMPNotification andand LabJMXNotification

(29)

To view broadcast JMX notifications you need to run a custom JMX listener To view broadcast JMX notifications you need to run a custom JMX listener class.

class. There is There is one provided in one provided in the %LAB_HOME%/Notifications folder alongthe %LAB_HOME%/Notifications folder along with a simple command script to run it.

with a simple command script to run it. You should correct the file paths in theYou should correct the file paths in the

%LAB_HOME%\Notifications\JMXListener.cmd

%LAB_HOME%\Notifications\JMXListener.cmd There is a also a WindowsThere is a also a Windows shortcut

shortcut in in the the %LAB_HOME%/Shortcuts folder. %LAB_HOME%/Shortcuts folder. Run Run the the JMXListener.JMXListener.

To view SNMP trap notifications, you need to run the WebLogic Server SNMP To view SNMP trap notifications, you need to run the WebLogic Server SNMP commandline utility: j

commandline utility: java weblogic.diagnostics.snmp.cmdline.Managerava weblogic.diagnostics.snmp.cmdline.Manager. . There There isis a simple command script to do this in the %LAB_HOME/Notifications folder.

a simple command script to do this in the %LAB_HOME/Notifications folder. YouYou

should correct the file paths in the

should correct the file paths in the

%LAB_HOME%\Notifications\SNMPListener.cmd

%LAB_HOME%\Notifications\SNMPListener.cmd There is also another shortcutThere is also another shortcut in the DiagnosticLab/Shortcuts folder.

in the DiagnosticLab/Shortcuts folder.

Start three new browser windows (clear private data to ensure servlet sessions Start three new browser windows (clear private data to ensure servlet sessions are not shared) and run ShoppingCart:

are not shared) and run ShoppingCart: http://localhost:7001/ShoppingCarthttp://localhost:7001/ShoppingCart. Use. Use the admin console (Deployments -> Shopping -> Monitoring -> Sessions) to the admin console (Deployments -> Shopping -> Monitoring -> Sessions) to check that there are at least three sessions active:

check that there are at least three sessions active:

Wait a short time for the Watch to be evaluated and you should then see the Wait a short time for the Watch to be evaluated and you should then see the Watch notifications via JMX, SNMP

(30)

References

Related documents

Review Specifications Review Test Cases Translator Developer Reviewer Tester End Client Partner Review Design Review Code. High end custom software development

• Northern Arizona Regional Behavioral Health Authority,* Flagstaff: AZ Council of Human Services Providers, Phoenix; Arizona State Hospital; Child &amp; Family Support Services

Comparing the control (before enhancement) and the blood marks after each enhancement technique showed that the ageing, substrate (figure 5) and technique had a

Moreover (and notwithstanding the abovementioned question of whether gamma power increases re flect true oscillatory changes versus multi-unit spiking), evidence has accumulated in

Advances in control systems brought about by microprocessor based instrumentation permit shared functions such as display, control and signal lines. Therefore, the symbology

The Survey of Artists’ and Creative Individuals’ Space Needs &amp; Preferences (artist survey) was designed for artists and others working in the arts, cultural and creative

Although the Homeland Security Act of 2002 and the National Infrastructure Protection Plan (NIPP) call for DHS to integrate CI vulnerability assessments to identify priorities,

These putative pathways suggest that hook neurons could either activate the forward command interneurons (Pathway 1 in Fig. 4.1A) to counteract the backward pathway activity