PREP_PROCESS

Use the PREP_PROCESS script function to create a data sequence based on target system commands. The function uses event jobs to process the commands on a defined host, and returns the output as an internal list (data sequence) that you can use for further processing.

This page includes the following:

Overview

PREP_PROCESS returns a reference to the data sequence. This reference is passed on to :PROCESS... :TERM_PROCESS... :ENDPROCESS. By default, PREP_PROCESS reads a complete line. The script function lets you structure the lines by splitting them into columns.

Tip: Use GET_PROCESS_LINE to access and process particular columns in the returned data sequence.

The script function supports the following OS commands:

The script function also supports the following other types of commands:

Important!

Notes:

Syntax

PREP_PROCESS (Host, EventJob[, Filter], Action [, Column separation]...[, UC_LOGIN=Login object])

Parameters

Defining Actions

The Action parameter lets you assign a value to a script variable in the Event job. The value that you assign to the script variable can be any type of value, including the following:

In the following types of commands, the Action that you define typically supplies the value of script variable &CMD in the Event job:

You can also assign object attribute values to script variables. For more information, see Modifying Object Attributes. When the event job starts, the corresponding Include is processed in the script and supplied with values internally (depending on the EventJob), without the attribute dialog being displayed.

Defining Columns

If you want to split the data sequence lines into columns, specify the Column separation parameter as follows:

COL=Definition1[, Definition2]

Where:

Event Jobs

By default, client 0000 includes the following Event jobs in the PREP_PROCESS folder of the Process Assembly perspective:

You can use the Event jobs as they are, or adjust them for your own event jobs. The names of these event jobs are structured as follows:

EVENT.EventJob

The definition of an event job is given in terms of particular attributes and the general scripting structure.

Processing

When the data sequence returned by PREP_PROCESS is processed, the following internal steps are carried out:

  1. The Event job that you specify in the EventJob parameter is activated. The job name is EVENT.EventJob.
  2. The Event job runs on the Host that you specify.
  3. The job performs the Action that you specify. Line by line, the job redirects the action result to a data sequence.
    Note: If you have defined a Filter, only the lines that comply with the filter are considered.
  4. The data sequence that is generated on the Host is transferred to the Automation Engine for processing. The default name of the file that is transferred from the Host to the Automation Engine is ERRRRRRR.TXT. The following placeholders are used for the variable parts:
  5. Note: The RunID is shown as a converted string, and not as a number. For more information, see RUNNR2ALPHA.

Examples

The following script uses PREP_PROCESS to run a ping command for a given server, and reacts to the output. To simplify the parsing, the script sets a filter to return only the result line.

:SET &HND# = PREP_PROCESS(PSA,wincmd,'loss','cmd=ping www.automic.com','uc_login=login.common')

! For test purposes, use an IP address of a server that does not exist

!:SET &HND# = PREP_PROCESS(PSA,,'loss','cmd=ping 10.0.0.123','uc_login=login.common')

:PROCESS &HND#

:SET &LINE# = GET_PROCESS_LINE(&HND#)

:PRINT &LINE#

:IF STR_FIND(&LINE#,'100% loss') > 0

:PRINT ALARM Webserver is not reachable

! Define necessary actions here

:ENDIF

:ENDPROCESS

If everything is fine, the script just prints the retrieved result line in the activation report:

Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),

If something is wrong and the retrieved results include a line that indicates a 100% loss, the script prints the alarm message in the activation report, and carries out actions that you have defined to remedy such situations.

Packets: Sent = 4, Received = 0, Lost = 4 (100% loss),

ALARM Webserver is not reachable

The following examples show different parameters that you can define for PREP_PROCESS.

See also:

seealso

Script Elements for Data Sequences