User-defined Test Templates

User-defined test templates allow you create a set of tests, alert rules, dashboards, and labels from a single template configuration file that you define. The ThousandEyes platform supports many monitoring scenarios and third-party applications, such as Microsoft 365, Webex, and others using a predefined set of certified templates. You may, however, have additional needs that are not covered. You can use user-defined test templates to support monitoring use cases that the ThousandEyes platform doesn't currently offer through its certified offerings. For more information about test templates, see Test Templates.

Permissions

When you create a test template, all users within your organization can have the option to select it when deploying a new test template. To grant access to users in your organization, enable the View Test Templates permission for each user. Users will also need the "Edit Tests" permission to deploy the templates. For more information about test template permissions, see ThousandEyes Developer Reference: Test Templates.

Creating a User-defined Template with the ThousandEyes API

If this is your first time using the ThousandEyes API, see Thousand Eyes Developer Reference: Overview to get started. For an overview of the ThousandEyes TestTemplates API, see ThousandEyes Developer Reference: Test Templates.

Using createTestTemplate

To create a new test template, use the createTestTemplate endpoint (https://api.thousandeyes.com/v7/tests/templates). To review the API specification for createTestTemplate, see ThousandEyes Developer Reference: Test Templates: createTestTemplate.

Assets

Test templates currently support configuring labels, tests, alert rules, and dashboards. Each of these assets is configured using a schema you can specify in your configuration file. The API documentation for each type of asset is listed in the table below. Examples of each asset's configuration are in the next section, Example Schemas.
The table below lists where you can find a reference to the schema for each type of asset:
Asset Type
Schema Reference Link
Labels
Tests
Alert Rules
Dashboards
You can also reference the id of another type of asset within each schema you define for each asset. For example, to assign an alert rule asset to a test asset, you can reference the id of a test you are already defining in the configuration file for the template you are creating. Because the ThousandEyes platform creates each test template asset type in a specific order, an asset can only reference other assets that are created before it.
The order the ThousandEyes platform creates test template assets is:
  1. 1.
    Labels
  2. 2.
    Tests
  3. 3.
    Alert Rules
  4. 4.
    Dashboards
The following table illustrates which assets of a different type each asset can reference:
Asset Type
Can Reference
Labels
none
Tests
Labels
Alert Rules
Labels, Tests
Dashboards
Lables, Tests, Alert Rules

Example Schema

The test template schema below describes a straightforward Slack monitor that includes an HTTP server, API test, and DNS test. The target is automatically determined from the Slack tenant name, and the DNS test will automatically determine the name servers.
For more details on each field in the schema below, see the Schemas subsection of ThousandEyes Developer Reference: Test Templates.
{
"name": "Slack",
"description": "Template for creating a set of tests to monitor Slack; will monitor your Slack vanity URL (<tenant>.slack.com), Slack DNS servers, and the Slack API (api.slack.com).",
"summary": "A template for monitoring your `<tenant>.slack.com` instance and \`api.slack.com\`; includes Network, DNS, and Web tests",
"icon": "slack",
"isBuiltIn": false,
"certificationLevel": "User",
"userInputs": {
"tenant": {
"name": "Slack Tenant Name",
"title": "",
"description": "Your Slack tenant name; will be used to determine target as <tenant>.slack.com",
"type": "string"
},
"agents": {
"name": "Which agents should we run tests from?",
"title": "",
"type": "any"
}
},
"tests": {
"apiTest": {
"interval": "60",
"type": "http-server",
"url": "https://api.slack.com",
"testName": "{{name}} - {{userInputs.tenant}} - API",
"agents": "{{userInputs.agents}}"
},
"tenantTest": {
"httpInterval": "60",
"interval": "60",
"type": "page-load",
"url": "https://{{userInputs.tenant}}.slack.com",
"testName": "{{name}} - {{userInputs.tenant}} - Web",
"agents": "{{userInputs.agents}}"
},
"dnsTest": {
"domain": "{{userInputs.tenant}}.slack.com A",
"interval": "60",
"type": "dns-server",
"dnsServers": \[\],
"testName": "{{name}} - {{userInputs.tenant}} - DNS",
"agents": "{{userInputs.agents}}"
}
},
"labels": {},
"tags": {},
"alertRules": {},
"dashboards": {}
}