Skip to content
CA Application Performance Management - 10.0
Documentation powered by DocOps

Sample Scripts

Last update August 13, 2018

This section contains sample scripts that use CLW commands:

You can download the scripts from KB000014477 from the CA Communities:

Note: The scripts are only available with no support.

Download the appropriate ZIP file and follow the instructions to install the scripts:

  1. Extract the appropriate file, scriptsBin.unix.zip or scriptsBin.win.zip into your Enterprise Manager installation. The package will create a bin subdirectory.
  2. Go to the bin subdirectory, and invoke:
    .\configureScriptsEnv.cmd
    or
    ./configureScriptsEnv.sh
  3. This creates the file setIscEnv.cmd or setIscEnv.sh. This file contains all relevant Introscope folder locations from which the other scripts will read.

Transaction Trace Session

This script initiates a Transaction Trace Session for all agents. At run-time, you supply two arguments:

  • Execution threshold value -- The minimum execution time, in seconds, for transactions to be traced.
  • Session duration -- The duration of the Transaction Trace Session, in seconds.

The script stores results in a date-oriented directory structure.

Name

clwTxnTracer

Syntax

clwTxnTracer <threshold> <duration>

where:

threshold is the transaction execution time threshold, in seconds

duration is duration of the session, in seconds

Example

clwTxnTracer 1 600

Causes Transactions Trace Sessions of 600 seconds duration to be run for any transaction that takes longer than 1 second to execute.

Results

The Transaction Trace data is written to a single file, in a directory that corresponds to current date:

<EM_Home>/traces\<year>\<month>\<day>\<agents> _<threshold>secs_for<duration>secs.<start_time>.xml

For example:

C:\introscope\traces\2004\11\11\AllAgents_1secs_for600secs.
14091705.xml

@ECHO OFF
SETLOCAL
TITLE Introscope -- Transaction Tracer Session


REM ****
REM Sets the current working directory with quotes around it
REM This enables this file to execute correctly if it is
REM invoked somewhere other than its location.
REM ****
FOR /f "tokens=1 delims=" %%a in ('cd') DO SET PWD=%%a



REM ****
REM Set the command directory to the command argument itself,
REM namely the full path of this file or the relative path
REM to where the file was invoked.
SET CMD_DIR=%0
REM Now simply strip out the name of this file to get dir
REM !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
REM        Use current filename
SET CMD_DIR=%CMD_DIR:clwTxnTracer.cmd=%
REM !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
REM Strip the quotes
REM add quotes if they're not there
SET CMD_DIR="%CMD_DIR%"
REM if not add quotes, then this statement chokes
SET CMD_DIR=%CMD_DIR:"=%
REM if the current dir wasn't determined, just set it to working dir
IF NOT EXIST "%CMD_DIR%" SET CMD_DIR=.
IF "%CMD_DIR%" == %0 SET CMD_DIR=.
IF "%CMD_DIR%" == "%0" SET CMD_DIR=.



REM ****
REM Now set the home directory for Introscope, and others
IF NOT EXIST "%CMD_DIR%\setIscEnv.cmd" goto noSetEnvFile
call "%CMD_DIR%\setIscEnv.cmd"

SET TT_THRESHOLD_IN_SECS=%1
SET TT_DURATION_IN_SECS=%2
IF "X%TT_THRESHOLD_IN_SECS%" == "X" SET TT_THRESHOLD_IN_SECS=10000
IF "X%TT_DURATION_IN_SECS%" == "X" SET TT_DURATION_IN_SECS=600
IF %TT_THRESHOLD_IN_SECS% LEQ 0 GOTO badArg
IF %TT_DURATION_IN_SECS% LEQ 0 GOTO badArg
SET TT_AGENTS=(.*)

REM Java Settings (e.g. increase Max heap size )
SET JAVA_OPTS=-Xms64m -Xmx512m
SET JAVA_OPTS=%JAVA_OPTS% %CLW_USER_OPT% %CLW_PASSWORD_OPT% %CLW_EM_HOST_OPT% %CLW_EM_PORT_OPT%


SET COMMAND=trace transactions exceeding %TT_THRESHOLD_IN_SECS% seconds in agents matching \"%TT_AGENTS%\" for %TT_DURATION_IN_SECS% seconds

SET AGENT_STR=%TT_AGENTS%
REM Remove the spaces, parentheses
SET AGENT_STR=%AGENT_STR:(=%
SET AGENT_STR=%AGENT_STR:)=%
SET AGENT_STR=%AGENT_STR: =%
if "X%TT_AGENTS%" == "X(.*)" SET AGENT_STR=AllAgents
FOR /f "tokens=1-4 delims=:." %%a in ("%time%") DO SET SECS_STR=%%a%%b%%c%%d
FOR /f "tokens=1-4 delims=/ " %%a in ("%date%") DO SET TRACES_DIR=%ISC_TRACES%\%%d\%%b\%%c


REM Create the traces dir, if not exist
IF NOT EXIST "%TRACES_DIR%" MKDIR "%TRACES_DIR%"
SET TT_FILE=%TRACES_DIR%\%AGENT_STR%_%TT_THRESHOLD_IN_SECS%secs_for%TT_DURATION_IN_SECS%secs.%SECS_STR%.xml

TITLE Introscope -- Transaction Tracer for %TT_DURATION_IN_SECS% secs with threshold %TT_THRESHOLD_IN_SECS% secs
REM send stderr to null b/c there are meaningless disconnect excepts that might be *scary-looking*
ECHO Saving session output to %TT_FILE%
"%ISC_JAVA_HOME%\bin\java" %JAVA_OPTS% -jar "%CLW_JAR%" %COMMAND% > "%TT_FILE%" 2>NUL
goto finish


:badArg
ECHO Arguments should be greater than zero.
ECHO Syntax: $0 "threshold in secs" "duration in secs"
goto finish

:noSetEnvFile
ECHO There is no environment setup file: setIscEnv.cmd
ECHO Please re-run configureWily.cmd in installation directory!
goto finish

:finish
ENDLOCAL

Transaction Trace Session Triggered by Alert

This script initiates a Transaction Trace Session as a result of an Alert being triggered. You use a Shell Command Action to invoke it, passing the Alert message text as an argument.

The script parses the Alert message text for the agent that reported the data that triggered the Alert, and the danger level value that was exceeded, which it uses as the agent and threshold values for the Transaction Trace Session. Session results are stored in a date-oriented directory structure.

Name

alert2TxnTracer

Syntax

For more information on creating shell command actions, see the CA APM Workstation User Guide.

Results

The Transaction Trace data is written to a single file, in a directory that corresponds to current date:

<EM_Home>/traces\<year>\<month>\<day>\<agents> _<threshold>secs_for<duration>secs.<start_time>.xml

For example:

C:\introscope\\traces\2004\11\11\AllAgents_1secs_for600secs.14091705.xml

Was this helpful?

Please log in to post comments.

  1. Norris Graves
    2017-05-22 05:40

    At the top of the page there is a Note. "Note: To access and download these scripts, contact CA Support." If you click on the link it will take you to support.ca.com and not direction to the files.

    I found the files in the following community page "https://communities.ca.com/message/241888660"

    These scripts are from 2004 and should probably be updated. We have seen several cases in support that customer need the scripts.

    If you have any questions please contact Norris Graves or Hal German. Thanks!

    1. Lucie Stehnova
      2017-05-24 04:31

      Hi Norris,

      Thank you for your comment. We are looking into this.

      Thank you

      Lucie