PSL Script

The PSL Script Monitor is intended for advanced users with solid experience in PSL (PATROL Script Language).

The PSL Script Monitor provides you with the full flexibility of executing a PSL script on the PATROL Agent, to perform advanced operations that may not be supported with Monitoring Studio X Monitors.

Typically, the PSL script must output its result with the print() and printf() functions. The output of the script is captured by Monitoring Studio X and you can parse it with String Searches, Numeric Value Extractions, etc.

Example:

# Detect the path to the utility
if (file("/opt/IBM/smcli/bin/smcli")) {
  command = "/opt/IBM/smcli/bin/smcli";
} else {
  command = "/opt/DELL/SMCli/bin/smcli";
}

# Execute command to get the list of arrays
commandOutput = system(command." -H %{HOSTNAME} -U %{USERNAME} -P %{PASSWORD} -listArrays");

# Extract the list of Array IDs
arrayList = ntharg(grep("^ID:", commandOutput), 2);

# For each array, execute the command to get its details
foreach array (arrayList) {
  print("=== ARRAY ID: ".array."\n");
  print(system(command." -H %{HOSTNAME} -U %{USERNAME} -P %{PASSWORD} -ID ".array." -getDetails");
  print("\n\n");
}

In the case of a simple PSL statement, there is no need to use the print() or printf() functions, as in the below example:

get("/totalPslProcsOnRunq")

As the PSL Script Monitor is executed locally on the PATROL Agent (it cannot be executed on the remote monitored system, as there is no PATROL Agent there), it supports the %{HOSTNAME}, %{USERNAME} and %{PASSWORD} macros, which will be replaced at run-time. The %{USERNAME} and %{PASSWORD} macros will be replaced with the username and password of the selected credentials. Also, the %{PASSWORD_PSLENCRYPT} macro will be will be replaced with encrypted password using PSL encrypt() function which can be used in popen() or execute() functions in the PSL Script.

Once the PSL Script Monitor is properly configured, Monitoring Studio X provides the execution time, the result (the printed output), and the status of the script.

Refer to the table below to know how to configure the PSL Script Monitor:

Property Description
PSL Command or Script PSL command or script to be executed. PSL commands are executed on the local host, where the PATROL Agent is running.
Timeout After Time in seconds after which the PSL command will be stopped (Default: 30 seconds). If the query times out, the Status parameter of the Studio PSL Command will be set to 2 (Failed) and an alarm will be triggered.
Display Name Name to identify the PSL Monitor instance in TrueSight Operations Management.
Internal ID ID to be used to store the PSL Monitor configuration in the PATROL Agent configuration. This Internal ID is automatically generated based on the Display Name provided but can be edited if needed.
Collect Schedule How often new data is collected. A new collect can be performed from once every second, to once in a day. By default, the collect schedule is set to 2 minutes.

At this time, you can run the Dry Run feature to simulate the execution of this Monitor on a specific host and therefore verify that the output is conform to the expected result.

Refer to:

No results.