As part of creating or modifying a discovery pattern, you can use the Parse command output operation to extract information from the command output and to save the operation result in a variable. You can also save the whole of command output as a variable.

Before you begin

Role required: pd_admin

Navigate to the relevant pattern step:

  1. On the pattern form, select the relevant identification section for Discovery.

    Alternatively, select the relevant identification or connection section for Service Mapping.

  2. Select the relevant pattern step or click Add a step button to add a step.

Basic knowledge of programming is desirable.

Procedure

  1. Select Parse command output from the Operation list.
  2. Specify the command in Set Command Details.
    You can use variables. You can also enter a value from the specific field in a tabular variable as described in Enter values and variables in patterns.

    You can concatenate multiple commands.

    Important: Avoid entering a specific path to a location or file because it can be different on different operating systems. You should use variables for paths.
    To make the Now Platform apply applicative credentials while executing this command, use placeholders for credentials using the following syntax:
    • $$username$$ - for the user name
    • $$password$$ - for the password
    For example, a parsing command for a Microsoft SQL Server uses credential placeholders: "su - " + $userid + " -c '" + $ExecutableDir + "mysql --user=" + "$$username$$" + " --password=" + "$$password$$"
  3. To change the execution mode or credentials, click Advanced and fill in the fields, as appropriate.
    Field Description
    Execute Mode Select the relevant option for running this command:
    • Default (Remote) - on the remote device.
    • Local Script - on the MID Server
    • Windows Service - on the service running on the remote Windows server
    CI Type

    Enter the name of the CI type whose applicative credential you want to use for this step. The system uses applicative credentials for the defined CI type, different from the CI type, which this pattern discovers. For example, while discovering Microsoft SQL Server, you may switch to the Microsoft SQL instance applicative credentials.

    If there is more than one applicative credential for the selected CI type, the system uses applicative credentials according to their Order parameter. For more information about configuring applicative credentials, see Applicative credentials.

  4. To save the whole of the command output as a variable, select NONE from the Define Parsing list and define the variable as described in 7.
  5. Select the parsing strategy from the Define Parsing list.
  6. If working in Debug mode, perform the following steps:
    1. Click Run Command to see the result in the Output pane.
    2. In the Output pane, mark text or symbols that you want a variable to contain.
    3. In the variable name box, enter the name for the new variable, for example 'process_name'.

      Defining a variable name for the string marked in the Output pane
    4. Press Enter.
      The new variable is added in the Variables pane.
  7. If you are not working in Debug Mode, perform the following steps to define the parsing criteria.
    1. In the Variables pane, click Add Variable and enter the name for the new variable.
    2. Click the Advanced icon.

      Displaying the Advanced Variables pane
    3. Click Add Column Label.
    4. Enter the parsing query.
    5. Enter a value for the delimiter.
    6. Enter a value for the position.
  8. Select Use Cache to save the operation results in cache on the MID Server.
    Use cache to optimize discovery and avoid creating unnecessary load on central shared components, such as load balancers. The base system keeps operation results in cache for an hour.
  9. Select Terminate to stop discovery if no results are found.
  10. If in Debug mode, test the step by clicking Test and checking that the operation brings the result you expected.

Example

In this example, the Tibco parser script contained in the $TibcoParser variable runs on the target host. The parsing method is delimited text with the ‘=‘ delimiter. The result of the parsing is the path to the directory containing all configuration files for Tibco Business Works and Tibco Business Works Process. This step creates a temporary variable to hold the result of the parsing.


Parse Command Output operation

What to do next

cmdb-key-value
Discovery also collects cloud tags that are specific to each virtual machine (VM) and saves them to the Key Value [cmdb_key_value] table.