A parameter collection script is a script used to collect parameters from the software. This script is forwarded to the server and runs on it. Information about the parameters collected from the software is output to files such as the parameter information XML file (parameterinfo.xml). This file is transferred to an admin server.
A parameter collection script is composed of multiple files. Note that the names of Windows batch files and Linux shell scripts are fixed. These files are described below.
Discovery script
The discovery script is always the first script to be called.
This script is named discover.cmd (if a batch file) or discover.sh (if a shell script). This script must output information about the parameters collected from the software to the parameter information XML file (parameterinfo.xml). Other processes can be created for each different software product.
File attachments
Any file can be used from the discovery script. The file and the discovery script will be forwarded to the server.
If a file attachment includes a shell script, configure execution privileges within the discovery script of the shell script.
The discovery script outputs information about parameters collected from the software to a file. A description of this file is shown below.
Collected parameter information XML file
XML file containing information about collected parameters. This file has the fixed name parameterinfo.xml.
File attachment for collected parameters
Any file can be used for parameter information. This file is handled as an attachment.
Discovery script format (batch files) [Windows]
Create the discovery script for batch files (discover.cmd) using the format below.
The -dir option must specified as the first argument (%1), and the directory to which the parameter information should be output must be specified as the second argument (%2). Information about the parameters collected in this directory is output to the parameter information XML file (parameterinfo.xml) and to the file attachment. The parameter information XML file must be output. However, depending on the specifications of the parameter collection definition, the file attachment might not always be output correctly. The script returns 0 if successful, or another value otherwise. The standard output and standard error output are directed to the agent log.
@echo off setlocal @rem Process to collect parameters from software <Processing for each software product> <Process to output parameter information to directory specified as %2 > @rem Return results (normal) if ERRORLEVEL 1 goto ERROR_END endlocal exit /B 0 @rem Return results (error) : ERROR_END echo ERROR0002 Parameter collecting failed. 1>&2 endlocal exit /B 1
Discovery script format (shell scripts) [Linux]
Create the discovery script for shell scripts (discover.sh) using the format shown below.
The -dir option must be specified as the first argument ($1), and the directory to which the parameter information should be output must be specified as the second argument ($2). Information about the parameters collected in this directory is output to the parameter information XML file (parameterinfo.xml) and to the file attachment. Output is not required when there is no file attachment. The script returns 0 if successful, or another value otherwise. The standard output and standard error output are directed to the agent log.
#!/bin/sh # Process to collect parameters from software <Processing for each software product> <Process to output parameter information to directory specified as $2 > # Return results if [ $? = "0" ]; then # Returns normal exit 0 else # Returns an error echo "ERROR0002 Parameter collecting failed." 1>&2 exit 1 fi
Output directory for discovery script
When using the discovery script to output parameter information, output using the directory format shown below. A parameter information XML file must be created. Only create a file attachment if required.
+ <Output directory> + Collected parameter information XML file (parameterinfo.xml) + File attachment for collected parameters
Parameter information XML file format
Create the discovery script so that the parameters collected by this script are output to the parameter information XML file. In this parameter information XML file, specify values for the tags of the keys and values in the parameters. For other tags, specify any value, or omit altogether.
Tag for which value is specified
parameters
Tag to be omitted
description
Tag for which any value is specified
name
An example of the parameter information XML file output is shown below.
<?xml version="1.0" encoding="UTF-8"?> <parameterInfo version="3.0"> <name><parm info name></name> <parameters> <parameter> <key><parm key></key> <value><parm val></value> </parameter> ... </parameters> </parameterInfo>
For examples of parameter information XML files, refer to "4.1.4 Parameter Settings Scripts".
Note
Commands that cannot be used with a script
Do not execute the following commands from a script, because this will cause the script to enter standby status on the business server, and its processing will not complete:
Commands that require interaction [Windows/Linux]
Commands for which a window opens during execution [Windows]
AT commands [Windows]
Shell scripts created using PowerShell [Windows]
Commands running in full-screen mode [Linux]
Parameter collection scripts
Order of execution
The parameter collection scripts do not operate in any particular order.
Discovery scripts
Execution privileges
Must be executed by an Administrator in Windows.
Must be executed by a superuser in Linux.
Current directory
The current directory is the path in which the discovery script files are stored.
Execution privileges [Linux]
Configured automatically during execution.
Line feed
In Windows, use CR+LF.
In Linux, use LF.
Byte order mark (BOM) [Linux]
Do not include the UTF-8 byte order mark (BOM) in shell scripts.
File attachments
Execution privileges [Linux]
If a file attachment includes a shell script, configure execution privileges within the discovery script of the shell script.