Defining the Commands for BACKEND VARA Objects

BACKEND VARA objects execute commands on Operating Systems (Windows or UNIX) and provide the result as values that are shown in columns. You can store the commands for different Operating Systems, system names, and versions in one BACKEND VARA object. When the VARA object is resolved, the correct command of the Agent in question is automatically selected and executed.

You define a BACKEND VARA object on various pages. On the Command page described here you enter the command for Windows or Unix.

To Specify Windows and Unix Commands for BACKEND VARA Objects

  • In OS Name enter the name of the Operating System on which the Agent runs. Use the value that is shown in the Administrationperspective (Agents page, Software column).

    Allowed characters: *

  • In Version enter the version of the Agent as shown in the Administration perspective (Agents page, Software column).

  • Enter the Command. Consider the following:

    • Windows only supports PowerShell commands.
    • You can include PromptSet variables here when using the dynamic reload feature for combo box prompts.
    • When you use PromptSet variables in a dynamic Variable object, the Preview feature returns an error. The reason is that the PromptSet variables do not exist in the BACKEND VARA object. However, the PromptSet variables will be resolved when objects including the PromptSet are executed.
  • In Column format define how the result should be split into columns. Use the following syntax:

    column name:start position(length) [;column name:start position(length)  . . .] 

    Where:

    • Column name = Name of the column, user-defined
    • Start position = Position of the character where the column starts
    • Length = Number of characters that determines the column's size

    Important!

    • Semicolons (;) must only be used between several columns. They are not required at the end of the complete definition.
    • You must define at least one value column (minimum requirement).

    Example:

    process:1(20);pid:25(10)

    This example splits the output of the command into two columns. The process column starts with the first character and has a length of 20 characters. "pid" starts at character 25 and is 10 characters long.

Notes:

  • Windows

    The commands are not batch lines. You must define a specific program to be executed.

    Examples:

    • Listing the directory: cmd /c dir C:\temp
    • Ping: ping localhost -n 10

    The return code is automatically set to 1 if a command results in an error. In this case, if you use the VARA object within a script, the script aborts. To avoid it, you can append & set ERRORLEVEL=0 at the end of the Windows command.

    Example:

    cmd /c dir /b /o:d C:\temp\*.xml & set ERRORLEVEL=0

    This command lists the files of a directory. The return code is always 0, regardless of whether files are found or not. This way you can ensure that the tasks using this VARA object do not abort.

  • Unix

    The user who is specified in the Login object must have the right to execute the corresponding command.

  • Windows and Unix

    In the OS Name and Version columns you can filter for the names (such as a particular UNIX derivative) and OS version. The suitable line for the specified Agent is automatically used when the VARA object is executed. The first entry that matches the OS, OS name, and version of the Agent is used.

  • Linux

    Root rights are required for the chkconfig and runlevel commands.

See also: