Standard output and standard error output are stored in the output property. Therefore, the best practice is to set filters on the standard output results to obtain the value you want by using regular expressions in the remote commands.
Example
To obtain the disk ID from the standard output property results, complete the following steps:
- Set a filter on the output property:
diskid:n is the output method as the result of a script
diskid:(.+) is the regular expression to filter the output property
- Create a script to pass the results.
- Use a remote command to set an output filter where:
diskid:(.+) is the output filter
diskid:1 is the standard output string
blank is the value of the output property
Running the script gives the following results:
- diskid:1 is the standard output string
- 1 is the value of the output property
You specify output filters from the Remote Command tab that is accessed from the Copy/Edit Custom Plug-in dialog box.
To set an output filter:
From the Mapping Definition of Output Properties area, select and highlight the line of the output property, then click the edit (pencil) icon. Enter the details in the Edit Output Filter dialog box.
Continue to set environment variables as required.
The cutout by the regular expression is the part grouped by the parentheses. The first group becomes the target of the cutout if multiple groups exist. Here are some examples of cutting out the standard output using a regular expression.
Example of extracting the string from a single line:
Standard output server:sv001 CPU - 89% Memory - 77% Regular expression server:(.*) Result of cutout sv001
Example of extracting the string with multiple lines - 1:
Standard output server:sv001 CPU - 89% Memory - 77% Regular expression server:(?s)(.*) Result of cutout sv001 CPU - 89% Memory - 77%
Example of extracting the string with multiple lines - 2:
Standard output server:sv001 CPU - 89% Memory - 77% Regular expression server:(?s)(.*)\sMemory Result of cutout sv001 CPU - 89%