SAP Landscape Management 3.0, Enterprise Edition

Configuring SAP Host Agent Registered Scripts

SAP Host Agent executes your own scripts within SAP Landscape Management on all managed hosts with a registered configuration file. This configuration file defines the operations available on the given host in a certain location.

Prerequisites

For each definition, you have created the script in which you want to implement the actual logic. The scripts normally run under root, on UNIX you can specify the user.

You have configured the host (host name) within SAP Landscape Management, or provided one of the following:

  • Logical port called HOSTAGENT_ <host name: case sensitive>_shared

  • HTTP destination called HOSTAGENT_ <host name: case sensitive>_ws

Context

Your scripts are referenced from the configuration files and can be placed anywhere. The communication channel between SAP Host Agent and the script are stdout and stdin.



Components of custom scripts that are called as custom operations or custom hooks

Procedure

  1. On your managed host, create subfolder operations.d/ in the SAP Host Agents exe/ folder.
  2. To describe how to execute your script and which parameters it needs to work, create a configuration file that defines the operations as follows. Parameters are expanded during runtime to the current values of the context of SAP Host Agent.

    Keyword

    Entry

    Description

    Name:

    If required, specify one specific host where you want to execute the operation as follows:

    Name of the operation.

    Command:

    If required, specify modifiers for the parameters as follows:

    Missing optional parameters will be passed as empty strings.

    Your script must be executable (x-flag on UNIX).

    You may need to specify the interpreter, for example /bin/bash for bash or /cscript/Nologo for vbscripts Windows.

    To use a variable in an operation, you have to specify it as $[VARIABLE_NAME]. Define a variable in the operation description using the following format: The key of the argument to be resolved has to be identical to the defined value (case sensitive). In some case the resolved value is built using the environment (modifier #env), or the profile parameter (modifier #sapparam).
    Parameter Modifier

    Modifier

    Description

    required

    Parameter value must be specified in order to execute this operation.

    sapparam

    Retrieves parameter value from the host_profile

    env

    Retrieves parameter value from the environment.

    input

    Parameter value is passed using stdin.

    tolower

    Converts parameter values to lower case.

    toupper

    Converts parameter values to upper case.

    enum

    Fixed list of allowed parameter values.

    int

    Parameter value must be an integer value.

  3. Optional: Specify the following options for each command:

    Keyword

    Entry

    Description

    Mode:

    sync

    Executes the script in synchronous mode.

    Operation is finished when the script exits.

    async

    Executes the script in asynchronous mode.

    Needed if no response of the operation is expected, for example restart host agent or reboot host.

    Operation is finished as soon as the script is started.

    No output is visible in the SAP Landscape Management log.

    Description:

    <Description>

    A verbal description of this command.

    Username:

    <VARIABLE_NAME>

    This command is only available on UNIX.

    This command is executed in the context of the specified user.

    ResultConverter:

    flat

    No special handling is done.

    hook

    At the beginning of each line, your script marks the following:

    • Errors with [ERROR]:

    • Warnings with [WARNING]:

    • Results with [RESULT]:

    • Progress of long running operations with [PROGRESS]:<percentage>% or [PROGRESS]:<actual value>/<maximum value>

    The markers are not shown within SAP Landscape Management. If the custom operation is marked for synchronous execution, the results are shown within a dialog box.

    sapcontrol

    Only useful if sapcontrol commands are executed.

    Workdir:

    <Path to your working directory>

    Path to the working directory for your executable script.

    Plattform:

    Windows

    Make this command only available on the specified platform.

    If an operation does not contain any command for the current platform, it will not be available on that host at all.

    UNIX

  4. The command is executed in the context of root or local system account. All output to stdout will be shown in the log-view of SAP Landscape Management.
  5. UNIX:

    For security reasons, the root user must own the configuration file. To change the ownership and permissions of the configuration file, use the following commands:

    Command

    Description

    chown root:root <your configuration file>

    Change ownership of the configuration file

    chmod 755 <your configuration file>

    Change permissions of the configuration file

  6. Store the configuration file in the created operations.d subfolder.
  7. Ensure that the configuration file and the script are available on all resources, where the corresponding custom operations, custom hooks, or custom notification should be executable.

Results

You can now provide the implementation definitions in SAP Landscape Management.

SAP Landscape Management validates that SAP Host Agent scripts of all possible custom operations and custom hooks are available on the corresponding hosts, during the validation runs of the instances which run on the host, as well as for the host itself.