Important This documentation space contains information about PATROL Agents when deployed in a TrueSight Operations Management environment. If you are a BMC Helix Operations Management user, see PATROL Agent 21.02 for BMC Helix Operations Management.

PSL pre-discovery programming capsule


Use a PSL pre-discovery script to determine whether the proper environment exists for application discovery to proceed. After pre-discovery sets the active variable to a value of two (2), application discovery is executed.

Typical PSL pre-discovery algorithms

The following table lists typical pre-discovery algorithms.

Typical pre-discovery algorithms

Sample PSL pre-discovery algorithms

The following sample pre-discovery algorithms are provided:

Testing the existence of a specific computer class

The following pre-discovery script tests the existence of the Windows computer class using the following logic:

  • If NT is not the computer class, the PATROL built-in variable active is assigned a value of zero (0) and no PSL discovery occurs.
  • If NT is the computer class, the PATROL built-in variable active is assigned a value of two (2), and PSL discovery proceeds.
Code block
# The NT Computer Class operating must exist!
if (get("/appType") != "NT") {
set("active", 0);
} else {
set("active", 2);
}

Testing the existence of a specific file

The following pre-discovery script tests the existence of a specific file using the following logic:

  • If the file some_file exists, PSL discovery proceeds (active = 2).
  • If the file some_file does not exist, no PSL discovery occurs (active = 0).
  • Use this technique only if the monitored application always has a file in a specific location; otherwise, avoid this technique.
Code block
if (file("path/some_file")) {
   set("active", 2);
} else {
   set("active", 0);
}

PSL pre-discovery programming requirements

You must include the following items in each PSL pre-discovery script:

  • The PSL set() function arguments to trigger execution of PSL discovery if the appropriate conditions exist:
    set("active",2);
  • If the results are affirmative, the PATROL Agent runs the discovery script.
  • The PSL set() function arguments to prevent execution of PSL discovery if the appropriate conditions do not exist and will not exist:
    set("active",0);
  • If you have a condition where an application may not exist at the time of pre-discovery, but may exist later, use the following:
    set("active",1);
    This will temporarily prevent the execution of the discovery script, and execute the pre-discovery script again.

PSL pre-discovery programming guidelines

It is recommended to always test the operating system type to determine if the application class should be activated on the monitored system. 
You can perform platform detection using the PSL function get("/appType") with the global /appType PATROL Agent namespace variable as an argument, which may have the following values:

  • <unix_type> for a UNIX operating system
  • NT for the Windows operating system
  • MVS for the OS/390 operating system

Alternatively, you can control whether a specific application class is loaded on specific platforms using the application class General property tab option: Allow On and Deny To.

Common PSL functions used in PSL pre-discovery

The following table lists PSL functions that are often used in pre-discovery scripts. For more information about these PSL functions, see the PATROL Script Language Reference Manual

 Common pre-discovery functions

 Common variables used in PSL pre-discovery

The following table lists common PATROL Agent namespace variables that are often used in pre-discovery scripts.

 Common pre-discovery variables

 Proto type PSL pre-discovery script

The following pre-discovery script tests to make certain that the operating system is a UNIX platform--not Windows, OS/2

Code block
ctup = get("/appType")
if(!index("!NT,!OS2!,"!".ctup."!")){
set("active", 2);}
else {
set("active", 0);
}

If the operating system is not Windows, OS/2, the pre-discovery script assumes that it is a UNIX platform and proceeds with discovery, and if the operating system is Windows, OS/2, the application class is disabled.

 

Tip: For faster searching, add an asterisk to the end of your partial query. Example: cert*