PATROL menus

This topic provides information about how PATROL menus. A PATROL menu allows you to perform routine functions such as: to start or stop a database or to manage and monitor your application. In the object-oriented PATROL environment, PATROL KM menu items represent methods that act upon your PATROL application instances. The following topics are discussed here:

Each pop-up menu for a PATROL object contains a number of standard commands that perform a function or retrieve data. As a PATROL developer, you can build PATROL KM menu items, including cascading sub-menus, for each PATROL object (locally) or for your entire environment (globally), with commands that apply to your specific needs.

Menu commands can be any of the following:

  • Used for an object or group of objects
  • Initiated by the PATROL Console
  • Run by either the account for the PATROL Agent, the PATROL Console, or the monitored application's account

How PATROL menus work

A PATROL KM menu item executes on the PATROL Agent and not on the PATROL Console. When the user choose a menu item, the PATROL Console sends that menu item's corresponding script to the PATROL Agent and the PATROL Agent executes it. 
All menu items run within the context of a PATROL instance. For example, a menu script selected from the /FILESYSTEM/root instance runs within the context of that instance on the PATROL Agent. This is most important when PSL scripts interact with the PATROL Agent namespace. 

For example, 

get("name"); is equivalent to get("/FILESYSTEM/root/name"); 

when it is executed on the root filesystem. 

When you create a menu item for an application class, the new menu item appears in the pull-down menu for each instance of that application class. When you pull the menu down and click the menu item, the PATROL Agent performs the following actions:

  • Reads the text that was typed into the Command field of the command definition.
  • Accesses the command type definition to determine how the script will be executed.
  • If the command type is PSL, the PATROL Agent compiles and executes the script in the built-in PSL interpreter.
  • If the command type is OS, creates an OS shell process to execute the script as a process belonging to the object from which it was called.

 Why create a menu

Create menus in the PATROL KM for the following:

  • Perform application management and system administration tasks
  • Enable or disable the monitoring of a particular application class o obtain information about an application or the OS environment
  • Execute generic OS commands, such as the following:
    • Perform backups
    • List processes running on the system
    • Kill processes

Determining what kinds of menu items to build

Menu items can be either commands or tasks.

Command

Use a command when the menu item consists of commands that apply either to all computer instances or to all computer instances for a particular OS type. Unlike tasks, the command cannot be stopped or restarted before it has completed.

Task

Use a task when the menu item consists of the following:

  • Long-running commands
  • Commands that generate a large amount of output and need a dedicated window for output display
  • Non-PSL scripts that require user input during execution

A task is similar to a command except that it runs in background mode and is represented by an icon that can be controlled using a pop-up menu. By contrast, tasks produce a task icon (that appears as a checkered flag) and you can see their results in the task window.

PATROL object menu types

The following table discusses menu items built for the following PATROL objects.

PATROL object menu types

PATROL object

Usage

Location

One computer instance

  • These menu items would be part of a PATROL operating system KM or part of the PATROL Console. If they are part of an operating system KM, menu items may not be available for other computers, depending on whether you apply the commands locally to a computer or globally to all computers of the selected computer class.
  • These menu items are primarily for setup and configuration.

Computer instance shortcut menu

One application instance

  • These menu items are part of the PATROL KM to which the application instance belongs but may not be available for all instances, depending on whether you apply the commands only to an instance or to all instances of the selected application class.
  • PATROL menus can be defined at the application class level. The menu items defined at the class level will appear on the pull-down menu of every instance of that application class. For this reason, it is important to remember that the menu items you create should be generic enough to be executed on any instance that might be created in that class.

Application instance shortcut menu

More than one computer or application instance of a class

These menu items are part of the PATROL computer KM to which the computer instances belong.

PATROL Console menu bar's Commands sub-menu

Controlling access to menu items

Sometimes it is appropriate to restrict access by PATROL Operator Console users to certain KM menu items, such as KM administrative functions and system configuration options. PATROL does not provide the ability to selectively remove or inactivate a menu item. So you must code the command script for a restricted menu item to test for the PATROL Console type and terminate without execution if the requesting user is a PATROL Operator Console user. 

You can test PATROL Console type using the PSL con sole_type() function. The following example shows one technique for limiting menu item execution:

if(console_type() != 1){
  response("Error", -1, "h=500, w=500",
  [R_LABEL, "Only a Developer Console can use this"]);
  exit;
}

For more information on the PSL response() function, see the PATROL Script Language Reference Manual.

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

Comments