Top
Systemwalker Operation Manager  Technical Guide
FUJITSU Software

2.9.3 Debugging Systemwalker Scripts

Although Systemwalker scripts can be run without having to be compiled, script errors cannot be detected until the section with the error is executed. To avoid problems with production operations using Systemwalker Operation Manager, scripts need to be tested and debugged after they are created, and any errors need to be removed.

The following kinds of errors may occur when scripts are created.

Trace levels

To make debugging easier, add calls to the trace extension command to the scripts in advance.

An optional trace level can be specified with the trace extension command. For information about how to set up trace levels, refer to the Systemwalker Operation Manager Reference Guide.

Changing the trace level changes which trace information is collected. There are two trace levels. Fujitsu recommends using these trace levels as follows:

Trace level 1: Used to output information during actual operations

With this trace level, information such as startup data and processing results is output as "operation logs."

Detailed information provided when errors are detected is output as "error logs."

Trace level 2: Used to output information during testing and debugging

With this trace level, "route check" information showing how many routes the scripts have executed (process branching points and program startup points) is output.

Detailed information (such as the content of files that have been read and variables in loop processing) is also output as "internal script information".


Testing and debugging procedure

The following procedure is used for testing and debugging Systemwalker scripts.

  1. Script creation process

    Add calls to the trace extension command for debugging the script.

    • Use Level-1 tracing to collect operation logs and error logs.

    • Use Level-2 tracing to collect route check and internal script information.

  2. Testing and debugging process

    1. Execute the script using the test execution command (swotclsh). Note the following points.

      • If there is any processing that cannot (or should not) actually be executed during the test (such as starting an application that cannot or should not be started), comment out the processing or replace the application with a dummy program for the test.

      • Collect and look up route checking traces during the test, and make sure that the script passes through the correct route.

      • Test all routes, including error processing routes, and conditional branches of scripts one by one. (This is because scripts do not detect errors such as typing mistakes with variable names unless the route with the error is actually executed.)

    2. If the script does not run correctly, locate and remove errors by checking the traces that have been collected and the error messages output by "Tcl/Tk" (if errors have occurred).

  3. After job operations have commenced

    Fujitsu recommends always collecting the minimum information required for debugging, as potential problems may appear after operations have commenced. If an error occurs with script behavior, save and investigate the trace information (which is always being collected). If necessary, collect more detailed information by increasing the trace level.