CheckInstanceTestBuilder - Scoped
-
- UpdatedJan 30, 2025
- 4 minutes to read
- Yokohama
- API reference
The CheckInstanceTestBuilder script include provides methods that enable building test check requests on check instances.
This script include requires the Agent Client Collector Framework (sn_agent) store application and is provided within the sn_agent
namespace. For more information, refer to Agent Client Collector.
For the REST API solution, refer to Agent Client Collector API.
- Set the check instance to test
- Set the configuration item to run the test against
- Credential sys_id
- Credential alias id
- Credential name
CheckInstanceTestBuilder - CheckInstanceTestBuilder()
Creates an CheckInstanceTestBuilder instance.
Name | Type | Description |
---|---|---|
None |
Example
The following example shows how to initialize CheckInstanceTestBuilder.
CheckInstanceTestBuilder - build()
Builds the test check request with the arguments set.
Name | Type | Description |
---|---|---|
None |
Properties | Description |
---|---|
Object | JSON object with two attributes – the test result record ID and an error. If the build is successful, the test result ID returns and error is null. If an error occurs during the build, the test result ID is null and the error displays. |
Example
The following example shows how build a test check request:
CheckInstanceTestBuilder - withCheckId(String checkId)
Sets the sys_id of the check definition to test.
Name | Type | Description |
---|---|---|
checkId | String | Sys_id of the check definition listed in the Check Definitions [sn_agent_check_def] table. |
Type | Description |
---|---|
CheckInstanceTestBuilder | The builder instance the method was invoked for. |
Example
The following example shows how create a test check.
CheckInstanceTestBuilder - withCiId(String ciId)
Sets the sys_id of the configuration item to run the test against.
Name | Type | Description |
---|---|---|
ciId | String | Sys_id of a CMDB Configuration Item. |
Type | Description |
---|---|
CheckInstanceTestBuilder | The builder instance the method was invoked for. |
Example
The following example shows how to create a test check request with
CheckInstanceTestBuilder - withCredentialsAliasId(String credentialsAliasId)
Sets the credentials alias sys_id to use during the test.
Name | Type | Description |
---|---|---|
credentialsAliasId | String | Sys_id of a credentials alias record. |
Type | Description |
---|---|
CheckInstanceTestBuilder | The builder instance the method was invoked for. |
Example
The following example shows how create a test check and set the credentials alias ID.
CheckInstanceTestBuilder - withCredentialsAliasName(String credentialsAliasName)
Sets the credentials alias name to use during the test. If the given value matches the name of multiple credentials aliases records, then one of them is chosen randomly.
Name | Type | Description |
---|---|---|
credentialsAliasName | String | Name of a credentials alias. |
Type | Description |
---|---|
CheckInstanceTestBuilder | The builder instance the method was invoked for. |
Example
The following example shows how create a test check and set the credentials alias name.
CheckInstanceTestBuilder - withCredentialsId(String credentialsId)
Sets the credentials sys_id to use during the test.
Name | Type | Description |
---|---|---|
credentialsId | String | Sys_id of a credentials record. |
Type | Description |
---|---|
CheckInstanceTestBuilder | The builder instance the method was invoked for. |
Example
The following example shows how create a test check and set the credentials ID.
CheckInstanceTestBuilder - withCredentialsName(String credentialsName)
Sets the credentials name to use during the test. If the given value is the name of several credentials records, then one of them is chosen randomly.
Name | Type | Description |
---|---|---|
credentialsName | String | Name of the credentials record. |
Type | Description |
---|---|
CheckInstanceTestBuilder | The builder instance the method was invoked for. |
Example
The following example shows how create a test check and set the credentials name.
CheckInstanceTestBuilder - withProxyAgentId(String agentId)
Sets the agent to run the test. Allowed only in case the tested check instance and policy are proxy.
Name | Type | Description |
---|---|---|
agentId | String | Unique ID of an agent proxy to run this check. This value is listed in the Agent ID column of the Agent Client Collectors [sn_agent_cmdb_ci_agent] table. |
Type | Description |
---|---|
CheckInstanceTestBuilder | The builder instance the method was invoked for. |
Example
The following example shows how create a test check and set the proxy agent ID.
On this page
- CheckInstanceTestBuilder - CheckInstanceTestBuilder()
- CheckInstanceTestBuilder - build()
- CheckInstanceTestBuilder - withCheckId(String checkId)
- CheckInstanceTestBuilder - withCiId(String ciId)
- CheckInstanceTestBuilder - withCredentialsAliasId(String credentialsAliasId)
- CheckInstanceTestBuilder - withCredentialsAliasName(String credentialsAliasName)
- CheckInstanceTestBuilder - withCredentialsId(String credentialsId)
- CheckInstanceTestBuilder - withCredentialsName(String credentialsName)
- CheckInstanceTestBuilder - withProxyAgentId(String agentId)