SAP Host Control
Global Variable sapHostControl
Global variable sapHostControl is an instance of SAPHostControlHost.
Use this variable directly in your scripts, for example:
const result = sapHostControl.loginWith(...);
See SAPHostControlHost for the full API.
Class OperationResult
An operation result object that is returned to the caller, either from the result of executing a synchronous operation or querying the result of an asynchronous operation with the operation ID provided.
operationID
operationID: string
The ID of the operation that can be used to query if it has finished (async operations) or obtain more information about its processing.
Type: string
Since: 23.3
results
results: ResponseMessage[]
An array of ResponseMessages that form the response of the operation.
Type: ResponseMessage[]
Since: 23.3
Class ResponseMessage
A wrapper object that contains the key and value mapping entry of the
SAP Host Control API operation executions' response.
key
key: string
The key of the record. This property will contain different values depending on the operation configuration.
A standard operation will consist of only the following:
LogMsg/TimeStampMessage timestampLogMsg/SeverityOne of the following: Info, Warning or ErrorLogMsg/SourceMessage componentLogMsg/TextMessage text<empty>Simple line of output of the command itselfdescriptionDescription field of the operation configurationexitcodeExit code of the command
For more information see the SAP Host Control API documentation from SAP.
Type: string
Since: 23.3
value
value: string
The value corresponding to the key in this object.
Type: string
Since: 23.3
Class SAPHostControlHost
The global variable sapHostControl provides easy access to the SOAP based SAP Host Control API that SAP offers to the SAP Host Control monitoring agent on SAP systems. Use this API with SAP Control credentials (or the default credentials) to enhance automations or checks.
cancelOperation
cancelOperation(operationID: string): OperationResult
Cancels a previously started asynchronous operation synchronously and HARD, see executeOperation(..).
Since: 23.3
Parameters
operationID(string) - operationID, as returned inexecuteOperation(..)
Returns: OperationResult - an operation result; normally this call will throw an exception, so don't expect to get this object
executeOperation
executeOperation(operation: string): OperationResult
Executes a SAP Host Control operation synchronously and returns the result.
Since: 23.3
Parameters
operation(string) - the name of the operation
Returns: OperationResult - the result of the operation
executeOperation
executeOperation(operation: string, arguments: object, timeout: number): OperationResult
Executes a SAP Host Control operation with complete control over the timeout and parameters in use.
Since: 23.3
Parameters
operation(string) - name of the operationarguments(object) - operation argumentstimeout(number) - timeout; -1 does a synchronous call, > 0 async with timeout, 0 async w/o timeout
Returns: OperationResult - operation response object
executeOperationAsync
executeOperationAsync(operation: string): OperationResult
Executes a SAP Host Control operation asynchronously, use isOperationFinished(..) and getOperationResults(..)
to handle fetching the results.
Since: 23.3
Parameters
operation(string) - the name of the operation
Returns: OperationResult - operation response object
getOperationResults
getOperationResults(operationID: string): OperationResult
Gets the results of an asynchronous operation previously started by executeOperation(..). It will also return
results when the operation is still running.
To make sure operation has finished call isOperationFinished(..)
Since: 23.3
Parameters
operationID(string) - operationID, as returned inexecuteOperation(..)
Returns: OperationResult - results of an operation
getSAPHostControlURL
getSAPHostControlURL(): string
The URL used to connect to the SAP Host Control API
Since: 23.3
Returns: string - the URL used to connect to the SAP Host Control API with
See Also: SAPHostControlURL
isOperationFinished
isOperationFinished(operationID: string): boolean
Query whether a given operation has finished or not. This is used with asynchronous operations to determine whether to query the results of the operation yet.
Since: 23.3
Parameters
operationID(string) - an operation id returned by executeOperation
Returns: boolean - true iff the operation has finished
loginWith
loginWith(credentials: any): SAPHostControlHost
Create an SAPHostControl object using specific credentials in case default Avantra monitoring
SAP Host Control credentials are not appropriate. The returned object has the same methods available as
the global object sapHostControl.
If wrong credentials are used there will be exceptions when using the sapControl API. This method does not validate the credentials.
Use the monitoredSystem global object to read credentials for use with this method.
For example:
const creds = monitoredSystem.getCredential("namespace.name")
const sapHostControlAPI = creds != null ? sapHostControl.loginWith(creds) : sapControl
// use sapHostControlAPI in the same way you would use sapHostControl, e.g.
const pingResults = sapHostControlAPI.executeOperation("SAPHostAgent.Ping")
// Check ping results...
Since: 23.3
Parameters
credentials(any) - SAP Control type credentials to connect to the SAP Host Control API with
Returns: SAPHostControlHost - an SAPHostControl object that will call the API with the specified credentials
SAPHostControlURL
readonly SAPHostControlURL: string
The URL used to connect to the SAP Host Control API
Accessors
Type: string
Modifiers: readonly
Since: 23.3