• No se han encontrado resultados

Duration: 40 minutes Skills Learned

At the end of this practice, you should be able to:

• Setup an existing JMS queue for diagnostic notifications

• Create a system diagnostic module

• Configure metric collectors for several MBean types

• Trigger notifications under various MBean watch conditions

• Access diagnostic archives and inspect recorded metrics Overview

Patients have reported intermittent problems with the MedRec application. Before contacting the development team and starting to troubleshoot, however, the IT group would like to get more insight into the server and application. The WebLogic Diagnostics Framework (WLDF) allows you to collect and record server and application metrics over time for later analysis. WLDF also supports watch conditions that can trigger notifications, such as posting a JMS message or sending an SNMP trap.

In this practice, you configure a new system-wide WLDF module along with several metric collectors (harvesters), watches, and notifications. The diagnostic configuration is shown in the following diagram:

Instructions

1. Create a JMS queue for diagnostic notifications.

a. Copy the following file to <LAB_WORK>/client:

<CURRENT_LAB>/resources/runclients.sh Overwrite any previous version of the file.

b. Launch a Lab Framework command shell, if not already open.

c. Navigate to <CURRENT_LAB>/resources and execute the createWLDFQueue.py WLST script.

d. Access the admin console.

e. From the Domain Structure panel, select Services > Messaging > JMS Modules.

f. Select the MedRec-jms module.

Oracle University and Sentra inversiones y servicios LTDA use only

g. Confirm that a new queue is available named WLDFNotificationQueue. Note its JNDI Name:

2. Create a system diagnostic module.

a. Lock the console.

b. From the Domain Structure panel, select Diagnostics > Diagnostic Modules.

c. Click New.

d. Name the module MedRecDiagnostics and click OK.

e. Edit the new module.

f. Click the Targets tab.

g. Select MedRecSvr1 and click Save.

3. Define a metric collector (harvester).

a. Click the Configuration > Collected Metrics tab.

b. Set the Sampling Period to 30000 (30 seconds) and click Save.

c. Click the New button.

d. Click Next.

Note: Since this diagnostic module is targeted to a managed server, only the Server Runtime MBeans apply.

e. From the select box, select the weblogic.management.runtime.

JDBCConnectionPoolRuntimeMBean option. Click Next.

f. Move the following attributes from the Available column to the Chosen column:

ActiveConnectionsCurrentCount CurrCapacity

LeakedConnectionCount Click Next.

g. Note the available values for Collected Instances, but make no selection. Click Finish.

Note: If you do not identify specific MBean instances, WLDF collects the selected attributes from all available instances.

h. Click New once again.

i. Repeat this process to define the following additional metric:

Field Value

MBean Server Location ServerRuntime

MBean Type weblogic.management.runtime.

WebAppComponentRuntimeMBean

Oracle University and Sentra inversiones y servicios LTDA use only

Collected Attributes OpenSessionsCurrentCount Collected Instances Select the option that contains the text:

Name=MedRecSvr1/medrec, ServerRuntime=MedRecSvr1 4. Create a diagnostic JMS notification.

a. Click the Configuration > Watches and Notifications tab.

b. Click the Notifications tab at the bottom of the screen.

c. Click New.

d. For the Type field, select the JMS Message option. Click Next.

e. Enter JMSNotification as the Notification Name, and click Next.

f. Enter the following values:

Field Value

JMS Destination JNDI Name com.medrec.jms.WLDFNotificationQueu e

Connection Factory JNDI Name

weblogic.jms.XAConnectionFactory

Click Finish.

Tip: Be sure you type these values exactly as shown.

5. Create diagnostic watches.

a. Click the Watches tab at the bottom of the screen. Then click New.

b. Enter JDBCWatch for the Watch Name, and confirm that the Watch Type is Collected Metrics. Click Next.

c. Click the Add Expressions button.

d. Click Next.

e. Select the same JDBCConnectionPoolRuntimeMBean that is being collected and click Next.

f. Click Next to watch all instances of this MBean.

g. Enter the following values:

Field Value

Oracle University and Sentra inversiones y servicios LTDA use only

h. Click Next.

i. Select the Use a Manual Reset Alarm option and click Next.

j. Move the JMSNotification option from the Available column to the Chosen column.

Click Finish.

k. Repeat this process to configure a second watch for the Web application metric being collected:

Field Value

Watch Name SessionWatch

Watch Type Collected Metrics

MBean Server Location ServerRuntime

MBean Type weblogic.management.runtime.

WebAppComponentRuntimeMBean Instance Select the option that contains the text:

Name=MedRecSvr1/medrec, ServerRuntime=MedRecSvr1 Message Attribute OpenSessionsCurrentCount

Operator >

Value 10

Config Watch Alarm Use a manual reset alarm

Chosen JMSNotification

l. Activate your changes.

6. Trigger WLDF notifications.

a. From a Lab Framework prompt, execute <LAB_WORK>/client/runclients.sh.

Note: The test clients require a few minutes to finish. Recall that the metric collector is running every 30 seconds.

b. From the administration console, return to the MedRec-jms JMS module.

Tip: Remember that you can return to a prior screen by using the breadcrumb trail at the top of the console.

c. Click the WLDFNotificationQueue.

d. Click the Monitoring tab.

e. Confirm that at least one message has been added to the queue.

Tip: If there are no current messages try running the test client again.

f. Locate the shell running MedRecSvr1. Confirm that the watch notification was also written to the server log. For example:

Oracle University and Sentra inversiones y servicios LTDA use only

<Notice> <Diagnostics> ... <Watch 'SessionWatch' with severity 'Notice' on server 'MedRecSvr1' has triggered ...

Within the message, find the collected value of either the JDBC or session MBean metric.

g. Return to the console and Lock it.

h. Navigate to your MedRecDiagnostics module.

i. Update the module’s configuration and disable the metric collector.

Tip: From the Configuration > Collected Metrics tab, uncheck Enabled.

j. Similarly, disable the watch and notification component of the module.

k. Activate your changes.

7. Browse collected metrics by using the admin console.

a. From the Domain Structure panel, select Diagnostics > Log Files.

b. Locate and select the HarvestedDataArchive log file for the MedRecSvr1 server.

Click View.

c. Click the Customize this table link.

d. For Time Interval, select Last 15 Minute(s).

e. Under Column Display, update the Chosen column to contain only these fields:

Date Attribute Value

f. For Number of rows displayed per page, select 100. Click Apply.

g. Browse the harvester entries. Verify that the four MBean attributes are being collected approximately every 30 seconds.

h. Click Customize this table again.

i. For WLDF Query Expression, enter the following:

ATTRNAME = 'CurrCapacity' Click Apply.

Tip: Be sure to use single quotes.

j. Confirm that now only this attribute is displayed.

k. Update the WLDF Query Expression again and replace it with the following:

TYPE LIKE '%WebAppComponentRuntimeMBean' Tip: Be sure to use single quotes.

l. Confirm that now only the OpenSessionsCurrentCount attribute is displayed.

Oracle University and Sentra inversiones y servicios LTDA use only

Solution Instructions

1. If the <LAB_WORK>/domains/MedRecDomain location does not yet exist, follow the Solution Instructions for the “Developing a Custom Monitoring Script” practice.

2. Launch the Lab Framework command shell by executing the file

<STUDENT>/bin/prompt.sh.

3. Change the current directory to <CURRENT_LAB>.

4. Execute the following:

ant setup_solution The Lab Framework:

− Makes a backup copy of your current work

− Creates a JMS queue to receive WLDF notifications

− Creates a diagnostic module

− Creates metric collectors for two MBean types

− Creates a diagnostic notification

− Creates a diagnostic watch

Note that all solution WLDF components will be disabled by default.

Oracle University and Sentra inversiones y servicios LTDA use only