Creating or modifying a custom command


Custom commands allow you to perform many functions from within the TrueSight Server Automation Console that might otherwise require you to launch a command line interface like Network Shell or other external applications. Use this procedure to create or modify a custom command. After creating a custom command, you can use the Servers folder to execute the command on a remote server or the local host.

To create or modify a custom command

  1. Select Configuration > Custom Commands View. The Custom Commands view opens. With this view you can create new custom commands or edit, delete, or share existing commands.
  2. Do one of the following:
    • To modify an existing custom command, select the command and click Open Custom Command. The Custom Command Editor opens. Proceed to the next step.
    • To create a new custom command, click New Custom Command . The Add Custom Command wizard opens and displays the Custom Command Template Selection panel. This panel lists and describes each type of custom command you can create.
      • Select the row describing the type of custom command you want to create and click Next.
      • The Custom Command Editor panel appears. The options available on this panel vary, depending on the type of command you are creating.
  3. For Name, enter a name that identifies the custom command.
  4. For Command, enter the command that is executed on a server.
     TrueSight Server Automation provides the following macros that can be used in conjunction with custom commands. When you create a custom command that includes a macro, the macro represents information that you provide when you actually run the custom command.

    Macro

    Information Provided

    %h

    The names of selected servers on which the command should run.

    %p

    The full path to the selected files or directories on which the command should run. This path does not include the server name. For example, a path might read /c/winnt rather than //host1/c/winnt.

    %f

    Selected files or directories on which the command should run, excluding the path to those files or directories. For example, winnt rather than /c/winnt.

    For example, you can use the %h macro to automatically apply a command to one or more servers. The command telnet %h starts a telnet session on any server you designate when you execute the command. Using the %h macro, you can also execute commands against multiple servers from the command line. For example, agentinfo %h generates agent information for every server that you specify when you execute the command. Using Command Options (described below), you can run the command once against many servers or run the command repeatedly, once for each specified server. 

    Note

    When running a Network Shell script as a custom command, always explicitly launch Network Shell using syntax such as nsh <scriptname>. If you do not, the script may execute using a local shell, such as the Windows cmd.exe shell, rather than Network Shell.

  5. Under Command Associations, specify what the custom command can run against. You can select Server Groups, Servers, Directories, Files, or any combination of those choices. If the OS you select in the next step is Unknown, you are not able to browse directories or files. In that context, selecting Directories or Files in this step has no effect.
  6. Under Operating Systems, do one of the following:
    • Select All Operating Systems if the custom command should apply to all OSs. Selecting this option includes unknown OSs.
    • Select Selected Operating Systems and check the OSs for which this command is appropriate. Checking Unknown (no agent installed) lets you run this custom command on a server that does not have an RSCD agent installed. The Unknown check box is only available if you have selected a command type of Local, Local GUI, or Local tabular.
  7. For tabular output only: Under Format Options, choose any of the following formatting options:
    • Check Use table headers if the first row of output should be treated as sortable table headers. If you clear this option, columns use enumerated headers (that is, 1, 2, 3, and so forth).
    • Check Use string delimiter if a delimiter encloses string fields in the command's output. Specify the delimiter by entering it in the Delimiter field.
    • For Separator, select the character used to separate data fields in the command's output. The following is a sample row of command output that uses " as a string delimiter and a comma as a separator: 

      {{"text1",1,2,"text2"}}

       
      Note that only string values are enclosed in the string delimiter, which allows the output table to do numerical sorting on numeric fields and text sorting on string fields. The string delimiter is not displayed in the output table.
      Output using the string delimiter can contain the separator character. For example, if a comma is the separator and a field value is Hello, Dolly, that value is broken into two fields unless the entire field is enclosed with string delimiters ("Hello, Dolly").

  8. Under Command Options, check any of the options that are appropriate. The available command options vary depending on the type of program, script, or application you are defining.
  9. Click Next or click the Permissions tab. The Permissions panel appears.
    The Permissions panel is an access control list granting roles access to this custom command. Access to all objects, including the sharing of objects between roles, is controlled through ACLs.
  10. Define an access control list (ACL) for the custom command. For more information about defining an ACL, see Defining permissions for a system object.
  11. Depending on whether you are creating or modifying a custom command, click Finish or OK.

 

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