Page tree

This video demonstrates how to validate the output of a script.

 https://youtu.be/xGqZVgz0xq0

With the consideration that you can create your scripts using a standard command line tool, the KM provides a command line interface based tool for validating the script output. You can use the tool by running the script from the command line on a system targeted for script execution (or similar), while the output is captured into a file (using standard output redirection ‘>’). The output validation tool is used while taking the newly created file as command line argument.

The PATROL_HOME environment argument must be defined at the command line where the validation tool is used. BMC recommends that users source the standard patrolrc.sh (located in the Patrol3 folder) before using the tool. JAVA_HOME environment argument should also be defined and must refer to the main folder of a locally installed JRE or JDK (for example: /usr/local/jre1.8.0_25 or C:\Program Files\Java\jdk8.0_45)

The tool is installed at:

%PATROL_HOME%\TRO\Conf\Scripts\ScriptOutput (Windows) 

$PATROL_HOME/../TRO/Conf/Scripts/ScriptOutput (Linux/UNIX)

Note

The ValidateScript.sh tool validates the output of the script after the execution. It does not validate the text of the script.

To use the tool:

  1. Run the ValidateScript.sh (UNIX) or ValidateScript.bat (Windows) as per your operating system.
  2. Enter -? for information about the using the tool


[Usage]

        ./validateScript.sh [-i] <Script output sample file>

[Info]

         Script output validation tool will verify if the script output text is valid and can be process by the monitoring system in order to create the monitor types and parameters and populate them in your presentation server.

[Info]

         Validation tool can start with one of the following options:

  • <Script output sample file> : Provide the name of the file that contains the script output as an argument
  • [-i] : For interactive mode, the Cli will guide you with some leading questions before the validation starts

Example 1 (valid script output):

The following script ouput is located at test.txt on C:\Program Files (x86)\BMC Software\Patrol3\TRO\Conf\Scripts\ScriptFileTransfer\Devices\clm-aus-013799\test.txt location. 

Interfaces=Ethernet1,Err=12,Out=12

Interfaces=Ethernet2,Err=45,Out=15

Interfaces=Ethernet3,Err=12,Out=12

Interfaces=Ethernet4,Err=45,Out=15

To validate this script output, run the tool and enter the path to the script output file. In this case, the path is:

C:\Program Files (x86)\BMC Software\Patrol3\TRO\Conf\Scripts\ScriptOutput>ValidateScript.bat "C:\Program Files (x86)\BMC Software\Patrol3\TRO\Conf\Scripts\ScriptFileTransfer\Devices\clm-aus-013799\test.txt"

Note

Ensure that a path with blank spaces is wrapped with double quotation marks ("C:\Program Files (x86)\BMC Software\Patrol3\TRO\Conf\Scripts\ScriptFileTransfer\Devices\clm-aus-013799\test.txt").

The result is displayed as below:

Script output is valid.

Monitor types and parameters are created in the operations console as follows:

        |+|Interfaces

           |+|Ethernet1

              |-|Err : 12

              |-|Out : 12

           |+|Ethernet2

              |-|Err : 45

              |-|Out : 15

           |+|Ethernet3

              |-|Err : 12

              |-|Out : 12

           |+|Ethernet4

              |-|Err : 45

              |-|Out : 15

Example 2 (Invalid script output):

This is an example for an invalid script output. Here the parameter in the second line does not have the same metadata across all the lines. 

Interfaces=Ethernet1,Err=12,Out=12

Interfaces=Ethernet2,Err2=45,Out=15

Interfaces=Ethernet3,Err=12,Out=12

Interfaces=Ethernet4,Err=45,Out=15

The result is displayed as below:

Script output is invalid.

====================

Error: The provided output sample include data on multiple instances. Inconsistency was found in regard to monitor type and parameter names. The KM require that all lines provide the same set of monitor type as well as the number and names of the parameters.

line [Interfaces=Ethernet2,Err2=45,Out=15]

at line [2]