PATROL PSL discovery

When discovering more complex application classes or when more sophisticated validation is required, a discovery method called PSL discovery should be used. For this discovery method, use PSL to write scripts that are run by the PATROL Agent to discover application instances.
PSL Discovery can consist of two parts: pre-discovery and discovery. The PATROL Agent first executes pre-discovery. If pre-discovery sets the application class active, the PATROL Agent compiles and executes the discovery script.

How PSL discovery works

On loading a PATROL KM, the PATROL Agent first compiles and executes the PSL pre-discovery script, if it exists. Pre-discovery can detect whether any instances of the application class exist on the monitored machine or whether the appropriate conditions exist for discovery to proceed. 

If pre-discovery finds that any application class instances exist or conditions are appropriate, it sets the state of the application class to active by assigning the value of two (2) to the PATROL Agent namespace active variable. If pre-discovery is not successful, it assigns a value of zero to the active variable. 

In situations for which pre-discovery is not successful, but an application instance might appear on the monitored machine, conditional logic can assign a value of one (1) to the active variable; this re-runs the pre-discovery script every application check cycle until an application instance is detected. 

If the active variable has a value of two (2), the PATROL Agent compiles and executes the PSL discovery script immediately. 

If you do not specify a pre-discovery script, the PSL discovery script is compiled and executed immediately. However, the best practice is to always provide both the scripts, pre-discovery and discovery, even if they contain only "exit;".

 PSL discovery types

PATROL has the following PSL discovery types:

PATROL PSL discovery script types

Type

Definition

Pre-discovery

The process used by the PATROL Agent to determine whether the proper conditions exist for application discovery to proceed.

Discovery

The process used by the PATROL Agent to do the following things:

  • Test whether any instances of the application class exist on the monitored machine
  • Determine the operational status of each detected application instance
  • Create icons for each detected application instance

 About PSL pre-discovery

Pre-discovery is the mechanism to limit unnecessary work load in the PATROL architecture. Applications classes should only be activated on systems where the monitored application resides. 

Pre-discovery should be provided for each PATROL KM. If pre-discovery sets the application active, the PATROL Agent executes the remainder of the PATROL KM. Valid values for the active variable for an application are listed in the following table. 

Valid values for the active variable

If ACTIVE is equal to

Then

0

The application is inactive; neither pre-discovery nor discovery will execute.

1

Pre-discovery executes on PATROL application check cycle. The check cycle has a default of 40 seconds.

2

Discovery executes on PATROL application check cycle.

About PATROL discovery

When the PSL create() function is called (from either discovery or pre-discovery), the PATROL Agent creates an application instance and begins executing the parameters in the scheduled order. 

PSL disco very can provide the following functions for each application class:

  • Discover application instances in which application detection is more complicated than can be handled by simple discovery
  • Create each monitored application instance
  • Determine and set the state of each discovered application instance
  • Check whether previously discovered application instances still exist on the monitored machine and destroy obsolete application instances
  • Define the execution environment for each application class and set PATROL Agent namespace variables
  • Set up validation and error recovery procedures for the discovery process
  • Collect data for any of the application instances during the application discovery process
  • Control synchronization of application discovery in situations in which the existence of one application class depends on the existence of another

The primary intent of discovery is to detect and create application instances and set their states without dependencies on manual setup operations. In most cases, discovery should be able to perform these functions without using utilities that require an application-level user name and password. However, there may be situations that do require an application-level user name and password.

 Comparing PSL pre-discovery and discovery

The following table explains some common practices for the use of pre-discovery and discovery.

When to use each PSL discovery script

Use

To do these things

Pre-discovery

  • Check whether the current operating system is one that supports the application class.
  • Check the PATROL Agent version using the following PSL get("/patrolVersion") function and arguments (optional). Do this to avoid loading a PATROL KM on an incompatible PATROL Agent.
  • Check whether other critical conditions required by the application exist.

Discovery

  • Define the PATROL execution environment for each detected application instance and to set PATROL Agent namespace variables for the parameters and menu commands defined for the application class.
  • Detect and set the current operational status of each instantiated application instance.
  • Create icons for each detected application instance.
  • Destroy any obsolete application instances.

 Debugging PSL pre-discovery and discovery

This section lists effective debugging methods for debugging PSL pre-discovery and discovery.

  • A very effective debugging method is to place conditional debugging logic in the PSL script and to set up a means of activating and deactivating it such as a menu command in the KM.
  • Use the PSL printf() function to view status.

Was this page helpful? Yes No Submitting... Thank you

Comments