Child pages
  • Agent scripts

This is the documentation of the release 2.1 of automaIT. The documentation of the latest stable release can be found at AUTOMAIT.

Skip to end of metadata
Go to start of metadata

Agent scripts are called during host initialization and are used to collect information about the underlying operating system of the remote agent. As default, information about the OS name, its version and the system architecture is collected by internal Java functions. Customized agent scripts can be created and used to change the stored OS information of a host.

OS information collected by agent scripts may be accessed using system substitutions (:[sys.OSName], :[sys.OSVersion], and :[sys.OSArch]). Host searches may use "sys.OSName", "sys.OSVersion", and "sys.OSArch" as criteria.

Create custom agent script

Custom agent scripts can be created within the web interface. The link to do so can be found in the "Administration" area.

The agent script is called up to three times during host initialization (once per OS property) while the environment variable NP_OSINFORMATION is set each time to the requested value (NAME, VERSION or ARCHITECTURE). So it's possible to create one script for each information and return one fixed value. Nevertheless it's recommended to create one script collecting the needed information regarding to the set environment variable. The returned resp. output value must have a length between 1 and 512 chars, it will be assigned to the corresponding operating system property (Name, Version, Architecture).

The following code can be an example to create an own script. Please note that this example is Linux specific.

agent script example

# The agent script is used during host initialization to collect information about the operating system on the remote host.
# While calling the script for each property, the environment variable NP_OSINFORMATION is set to NAME, VERSION or ARCHITECTURE according to which value is actually requested.

UNAMEBIN=$(whereis -b uname | awk '{ print $2 }')

if [ ! -x $UNAMEBIN ]
    echo "Host properties can not be determined. No uname found." 1>&2
    exit 1

        uname -s
        uname -r
        uname -i
        echo "Environment variable NP_OSINFORMATION was not set correctly." 1>&2
        exit 1

Please note

 If the script returns an error code which is not 0 or produces no output, an error will be thrown and the host won't be initialized.

  • No labels