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 for BMC Helix Operations Management 24.3.01.

Creating a menu command


This section describes how to create a menu command using the PATROL Developer Console for Windows and UNIX. 

Menu command properties

The menu command properties are divided into the following groups:

  • General
  • Command
  • Security
  • Environment
  • Icon

The following table describes the menu command properties. 
Menu command properties 

Property

Required/Optional

Default

Description

General properties

Command Name

Required

None

The name that the PATROL product uses to manage the command and it is the title of the command as it appears on 
the pop-up menu. There are no restrictions on command name length; the menu expands to accommodate the name 
but the input field width is limited to 30 characters. Capitalizing the first letter of a command is standard and spaces are allowed.

Command or Task

 

Command

Click Command to create a menu to execute as a command. Click Task to create a menu command that is a task. 
For more information, see Creating-Menus.

Task Options

 

None

If you specify that the command is executed as a task the following options are available:

  • Show Timer displays the time that it takes for the menu command to run
  • Popup Output Windows opens a task output window on task completion
  • Task is Interactive requires user interaction, such as entering information, before the task executes

Availability

Required

ALWAYS_AVAILABLE

Availability indicates when the command is enabled on the object's command menu. A command can be available:

  • ALWAYS_AVAILABLE; The menu command is always enabled, regardless of associated object's status.
  • AVAILABLE_ONLINE ; The menu command is enabled only when the associated object is online.
  • AVAILABLE_OFFLINE; The menu command is enabled only when the associated object is offline.

Command properties

Computer Class

Required

ALL_COMPUTERS

The computer class against which the menu command is to be executed. Choose ALL_COMPUTERS to execute the same 
menu command syntax on every computer. If you need to define a different command syntax for each computer type, select 
the computer type and then define the appropriate syntax for that platform. In this way, you define the appropriate platform/command pair.

Command Type

Required

OS

Choose the language used to write the command script from the list of installed command types.

Command

Required

None

Click the Command button to access the Command Text Editor window to define the menu command procedure.

Save in KM or Save in File

Required

Save in KM

Click Save in KM to save the parameter command as part of the PATROL KM file. Click Save to File to save the parameter 
command in a separate file in the PATROL PSL directory. Selecting this option allows the file to be referenced by other parameters, 
commands, etc. However, this technique is difficult to manage and many PATROL KM problems can result from selecting this technique.

Security properties

Security Type

Required

SECURITY_INHERIT

Choose the appropriate Security Type for the menu command:

  • SECURITY_INHERIT --The menu command is executed using the PATROL Console login user name and password set for 
    the computer or application at the instance level, or, if not defined at that level, at the computer or application class level.
  • SECURITY_PROMPT --Before the menu command is executed, the user is prompted to supply a valid user name and password 
    on whose authority, the menu command is executed.
  • SECURITY_THIS --The menu command is executed under the authority of the user name and password typed in the associated 
    fields. Setting up command security is described in more detail in Specifying-parameter-security.

User Name

Conditional

None

If the Security Type SECURITY_THIS is selected, type the user name of the account under whose authority the menu 
command is to be executed.

Password

Conditional

None

If the Security Type SECURITY_THIS is selected, type the password of the account under whose authority the command is to be executed.

Environment properties

Name

Optional

None

The name of the environment variable.

Value

Optional

None

The value assigned to the environment variable. To change an existing environment variable, choose the variable from the 
Name/Value list and make the changes in the Name and Value text boxes

Icon properties

Select OK Icon for Task

Required

Default standard PATROL task icon

Type the file name for the OK Icon to be used for the menu command task.

Select Attention Icon for Task

Required

Default standard PATROL task icon

Type the file name for the Attention (Not OK) Icon to be used for the menu command task.

Adding a menu command on Windows

In this task, you add a menu command to an application class.

To create a menu command for an application class

  1. In the KM tree, choose the application class you want to add the new command to.
  2. Expand the Global folder view.
  3. Expand the Commands folder view.
  4. Right-click the Menu Commands folder and then choose New from the shortcut menu as shown in the following figure. 

    New Menu Command selection from the KM Tree 
    new_menu_command_selection_from_KM_tree.gif

    The Command Properties dialog box appears, as shown in the following figure.

    Command Properties dialog box, General tab 
    command_property_dialog_general_tab.gif
  5. Select the appropriate values for the Command Properties General tab. 
  6. Click the Command tab on the Command Properties dialog box as shown in the following figure.

    Command Properties dialog box, Command tab 
    command_property_dialog_command_tab.gif
  7. Select the appropriate options for the Computer Class and the Command Type properties that appear on the Command tab. 
  8. Type the commands the Command text box.
  9. Click Apply to save the changes to the PATROL KM.
  10. Click the Security tab on the Command Properties dialog box as shown in the following figure. 

    Command Properties dialog box, Security tab 
    command_property_dialog_security_tab.gif
  11. Define appropriate options that appear on the Security tab.
  12. Click Apply to save the changes to the PATROL KM.
  13. Click the Environment tab on the Command Properties dialog box as shown in the following figure. 

    Command Properties dialog box, Environment tab 
    command_property_dialog_environment_tab.gif
  14. Select, add, or modify the appropriate options that appear on the Environment tab.
    • To add an environment variable, type it name and its value in the Name and Value text boxes.
    • To change an existing environment variable, choose the variable from the Name/Value list and make the changes in the Name and Value text boxes.
  15. Click Apply to save the changes to the PATROL KM.
  16. For Recovery Action Tasks only, click the Icons tab on the Commands Properties dialog box as shown in the following figure. 

    Command Properties dialog box, Icons tab 
    command_property_dialog_icons_tab.gif
  17. Select, add, or modify the appropriate options that appear on the Icons tab.
  18. Click Apply to save the changes to the PATROL KM.
  19. When commands are created, they appear in the KM Tree. The following figure shows the KM Tree after the Help sub-menu, About command, and Refresh Parameters command were added.

 New menu commands on the KM Tree 
new_menu_commands_on_KM_tree.gif

Adding a menu command on UNIX

In this task, you create a menu command to an application class.

To create a menu command for an application class

  1. In the PATROL Main Console window, choose Attributes > Application Classes from the menu bar. The List of Application Classes window appears as in the following figure. 

    List of Application Classes window
    list_of_application_classes_window.gif
  2. Select the application class to which you want to add the new menu item.
  3. Choose Attributes > Commands > Menu Commands from the List of Applications Classes menu bar.
    The List of Menu Commands window displays as shown in the following figure. 

    List of Menu Commands window

    list_of_menu_commands_window.gif
    The window lists the menu commands currently available in the object's menu, either for the selected object instance (at the local level) or for all objects of that PATROL class (at the global level).
  4. Choose Edit > Add to add a new menu item to the application object's menu. The Menu Commands dialog box is displayed as shown in the following figure. 

    Menu Commands dialog box
    devbasic3310-126.gif
    You ca n select the command format to be either a Command, a Task, or a Sub-Menu Header. The Command Definition dialog box that appears depends on the command format that you select. The dialog box displays the fields required for the selected format. 
    The dialog box fields are described in Menu command properties .
  5. Click the Command button next to the text field on the Menu Commands dialog box. The Command text edit window appears as shown in the following figure. 

    Command Text Editor window

    command_text_editor_window.gif
    This window will have different menu options and functions depending on the type of command you are entering. Click Help for more information about the window.
  6. Choose one of the following options to create the command:
    • To manually enter the command procedure, type the command string for the command in the window's editing area.
    • To load an existing file that contains a procedure, choose File > Load from the Command window menu bar. You can load previously saved scripts into existing commands and save the combined text as a new file. The saved command text is available for new commands.
  7. Save your command text by, selecting File > Save from the Command window menu bar.
    If you are not using PSL for your command type, the Editor exit dialog box appears, as shown in the following figure, prompting you to save the command text in either the KM or a separate file. 
    If you are using PSL for your command type, the command will be compiled at this time, and the PSL Compiler message displays, as shown in the following figure. 

    PSL Compiler message

    psl_compiler_message_checking_syntax.gif
    When the PSL compiler is finished, the PSL compiler displays one of the following compilation messages:
    • Success indicates that you PSL command had no syntax errors.
    • Warning indicates that your PSL command had no errors that would prevent it from executing, but there is a potential problem.
    • Failure indicates that the PSL script had errors that would prevent it from executing. The following figure shows a successful PSL compiler message. 

      PSL Compiler Success message

      psl_compiler_message_success.gif
      When you click OK on the PSL Compiler Success message or save a non PSL command, the Editor exit dialog box appears, as shown in the following figure, prompting you to save the command text in either the KM or a separate file. 

      Editor Exit dialog box
      psl_pre-discovery_editor_dialog_save.gif
  8. Save the command text in either the KM or a separate file by clicking the appropriate choice.
  9. Click OK to save dialog box changes and exit the dialog box when finished. The List of Menu Items window appears. The new menu item appears in the list and its command definition has been saved in the PATROL KM file.
  10. Choose File > Exit to exit the List of Menu Commands window. Access the object's menu and notice that the menu has been updated to include the new item. Execute the menu option to test it.

KM Output-about menu command

The following figure shows sample output created by the PATROL Developer Console when you add an about menu command. 

KM Output-about menu command 

devbasic3310-131.gif

KM output-refresh parameters menu command

The following figure shows sample output created by the PATROL Developer Console when you add a menu command to refresh parameters. 

KM output-refresh parameters menu command 

devbasic3310-132.gif

 

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