eG Administration
 

Generating a test of Script/Batch File Test type using Integration Console

The Generate tab will be enabled once all the measurements of a test of Script/Batch File Test type have been specified. In this page, do the following to generate the test:

  • Specify the Path of script/batch File associated with the test. Multiple script / batch file paths can also be specified, but remember to separate each entry using a comma.

  • If the script files are present in a remote location, then you can upload them to the eG manager, by clicking on the Choose button adjacent to the Path of script/batch File text box. This will invoke a FILE UPLOAD pop-up window using which you can Browse for the files and specify their location. Finally, click on the Upload button in the FILE UPLOAD pop-up window, to upload the script/batch files in the remote location to the eG manager. However, if the files have already been uploaded to the eG manager, then this procedure can be dispensed with. Instead, just specify the location of the files against the Path of script/batch File text box.

    Note:

    While associating a test with multiple script / batch files, make sure that the “main” script that needs to be executed is specified last. Otherwise, no measures will be reported by eG Enterprise.

    Any script used for a script/batch File test should provide one or more lines of output. Entries in a line are separated by whitespaces (space or tab). The first entry of a line should be “NONE”, if the test is not descriptor-based. Alternatively, if a test is descriptor-based, it can have multiple lines of output, with the first entry of each line being the descriptor. In case of scripts other than VB/powershell scripts, the descriptor and its corresponding measures are separated by whitespaces (space or tab), as shown below:

    Output of a (non-VB/non-powershell) script for a descriptor-based test

    DESC 1 Value 1 Value 2...Value N
    DESC 2 Value 1 Value 2...Value N
    .
    .
    .
    DESC N Value 1 Value 2...Value N

    In case of VB/powershell scripts on the other hand, the descriptor and its corresponding measures are separated by “:”, as shown below:

    Output of a VB/powershell script for a descriptor-based test

    DESC 1:Value 1:Value 2:…:Value N
    DESC 2:Value 1:Value 2:…:Value N
    .
    .
    .
    DESC N:Value 1:Value 2:…:Value N

    If a test is not descriptor-based, then the script should report only one line of output. The first entry of this line should be “NONE”.

    Output of a VB/powershell script for a non-descriptor-based test

    NONE Value 1 Value 2 ..... Value N

    Output of a VB/powershell script for a non-descriptor-based test

    NONE:Value 1:Value 2:...:Value N

    A script on linux would look like this:

    #!/bin/sh
    df -k | grep "/" | awk ‘{print $6 "     " $5 -1}’

    The above examples showed a test that did not take any arguments. To offer more flexibility in script execution, the Integration Console allows a user to specify multiple arguments for a script/batch file test. When the script/batch file is executed each time, the test’s arguments are passed to the script/batch file. Note that the arguments are typically passed to a script with a hyphen (i.e., ‘-’) preceding them. Each argument is expected to be followed by its value (e.g., −argument1 <argument1Val> −argument2 <argument2Val>). The script/batch file has to parse the arguments that are passed to it at the time of invocation and perform the appropriate functions. The following example provides an illustration of how a script can parse the arguments provided to it:

    #!/bin/sh
    # This is an example of a simple script that processes its arguments.
    # This script takes two arguments and outputs the values of the arguments. out1=“”;
    out2=“”;
    #out1 and out2 are output variables
    while [ $# -ge 1 ]
    do
    case $1 in
    -argument1) shift; out1=$1;; # if the current argument is argument1
    -argument2) shift; out2=$1;; # if the current argument is argument2
    esac
    shift;
    done
    echo “NONE $out1 $out2”

  • Select the Load file check box if:

    • The specified script/batch file has been modified, or

    • The measures are being associated with the script/batch file for the very first time

    If the script/batch file has changed, then selecting the Load file check box will ensure that when the test runs, the agent downloads the revised version of the file from the manager, and executes the same. This in turn ensures that the changes take effect. While associating the script/batch file with the test for the first time, it is mandatory to select this check box, as doing so enables the agent to download the file along with the measurements during test execution.

  • Finally, click the Generate button to generate the test.