Chapter 6. Autonomic Management Engine and resource models 225
򐂰 quit
Exits SARA.
6.4 How to debug a resource model
Depending on what needs to be debugged, several approaches can be used.
The following sections provide an example of how to debug the Resource Model
Builder using the Simple Agent Reference Application (SARA). With the
Resource Model Builder, you can check the JavaScript and invoke a JavaScript
debugger, but it is not possible to test the ILT classes. With SARA, it is also
possible to use the JavaScript debugger with the ILT classes implementation.
6.4.1 Debugging JavaScript
The Resource Model Builder can be used together with Microsoft Script
Debugger to debug the JavaScript. Resource models with custom ILT classes
cannot be debugged with the Resource Model Builder, because the Resource
Model Builder cannot be configured to find the ILT classes; therefore, only the
JavaScript not relying on data from ILT classes can be debugged with the
Resource Model Builder.
To debug the JavaScript, perform the following steps:
1. The trace is configured from the Preferences window. From the menu, select
Window Preferences. In the Preferences window, select Tivoli
Management Resource Model Builder, as shown in Figure 6-16 on
page 226.
226 Problem Determination Using Self-Managing Autonomic Technology
Figure 6-16 Resource Model Builder Preferences
2. Select logging level 4 - Most detailed logging information and Log to
standard output stream. This will show the most information in the
JavaScript console.
3. Now, restart the Resource Model Builder for the settings to take effect.
4. The JavaScript can be debugged with debugging tools, such as Microsoft
Script Debugger. The Microsoft Script Debugger can be downloaded from
Microsoft for free from the following Web site:
http://microsoft.com/downloads/details.aspx?FamilyId=2F465BE0-94FD-4569-B3C
4-DFFDF19CCD99&displaylang=en
5. To execute the JavaScript, go to the Source tab of the JRM file and click the
Run Script icon. If a debugger is installed, it will open; otherwise, the
JavaScript will run as it would be run in an Autonomic Management Engine.
Note: During the writing of this book, running the JavaScript with the Run
Script icon has only been found useful for a syntax check of the JavaScript.
Chapter 6. Autonomic Management Engine and resource models 227
6.4.2 Debugging CIM classes with SARA
Here, we show how to run SARA inside the Resource Model Builder as a Java
application in its own project. The following steps describe how to configure a
project for running SARA:
1. Open the Java perspective.
1. Create a Java project for SARA, for example, SARA runtime.
2. Copy the config directory from AME_HOME\sara\config to the SARA Runtime
project.
3. From the menu, select Run Debug. A window opens similar to the one
shown in Figure 6-17.
Figure 6-17 Debug window
4. Create a new Java application by selecting Java Application and clicking
New. Configure the Java Application as follows:
–Main tab
Name SARA Runtime
228 Problem Determination Using Self-Managing Autonomic Technology
Main class com.ibm.amw.sara.cli.RMEShell
Arguments tab
VM aguments -Ddb2j.stream.error.file="${workspace_loc:SARA
Runtime}\\logs\\db2j.log"
-Ddb2j.stream.error.logSeverityLevel=3000
-Ddb2j.infolog.append=true
-DARCH=w32-ix86
-Djava.endorsed.dirs="C:\PROGRA~1\IBM\AUTONO~1
\AUTONO~1\\lib\\endorsed"
Working directory ${workspace_loc:SARA Runtime}
Classpath tab
directory
C:\Program Files\IBM\AutonomicComputingToolkit
\AutonomicManagementEngine\lib
SARA Runtime\config
JAR files All JAR files in the directory
C:\Program Files\IBM\AutonomicComputingToolkit\A
utonomicManagementEngine\lib
and
C:\Program Files\IBM\AutonomicComputingToolkit\A
utonomicManagementEngine\lib\endorsed
Source tab
The CIM projects source folder DiskSpaceCIM\src
Environment tab
PATH ${workspace_loc:SARA
Runtime}\work\rmbundles\customscripts;${works
pace_loc:SARA
Runtime}\work\rmbundles\lib;${workspace_loc:S
ARA Runtime}\config
5. Click Debug to start SARA with debug for the first time.
6. In the console, enter the startrme command and press Enter. This will create
the directory logs and work under the SARA Runtime project.
7. To install the resource model, use the instrmtype command, for example:
instrmtype "<fullPath>\MyStorage.zip" -replacefiles
Where <fullPath> is the full path to the MyStorage.zip package. This
package is presented in Chapter 8, “Problem Determination scenario one” on
page 259.
Chapter 6. Autonomic Management Engine and resource models 229
8. To create an instance of the resource model, use the mkrminstance
command. For example, to create an instance named MS1, use:
mkrminstance MS1 MyStorage
9. To start the instance, use the startrminstance command, for example:
startrminstance MS1
The file SARA Runtime\logs\trace.log will contain all the trace information, both
from the JavaScript and the ILT class.
Now, if a breakpoint is placed in the ILT class, the Resource Model Builder will
switch to the Debug perspective where it will be possible to step through the
code.
For a description of the commands that can be used in the SARA command-line
interface, see 6.3, “Simple Agent Reference Application (SARA)” on page 222.

Get Problem Determination Using Self-Managing Autonomic Technology now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.