Skip to content

Commit 508f0c6

Browse files
synthetics examples
1 parent 0f46c5b commit 508f0c6

File tree

18 files changed

+492
-8
lines changed

18 files changed

+492
-8
lines changed

integration-examples/synthetics-examples/graphql-api/README.md renamed to integration-examples/synthetics-examples/API/graphql-api/README.md

File renamed without changes.

integration-examples/synthetics-examples/graphql-api/synthetics_example_graphql_api_check.tf renamed to integration-examples/synthetics-examples/API/graphql-api/synthetics_example_graphql_api_check.tf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ resource "synthetics_create_api_check_v2" "synthetics_example_graphql_api_check"
44
automatic_retries = 0
55
device_id = 34
66
frequency = 1440
7-
location_ids = ["aws-ca-central-1", "aws-us-east-1", "aws-us-west-1", "aws-us-west-2"]
7+
location_ids = ["aws-us-east-1", "aws-us-west-1"]
88
name = "Canada - Languages - Number of States"
99
scheduling_strategy = "round_robin"
1010
requests {

integration-examples/synthetics-examples/status-page-api/README.md renamed to integration-examples/synthetics-examples/API/status-page-to-metrics-api/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ These metrics include dimensions for description of any impact to status and an
1616
![alt text](image.png)
1717

1818
### Required Splunk Synthetic Global Variables
19-
The following global variables are **REQUIRED** to run the included API test.
19+
The following [global variables](https://docs.splunk.com/observability/en/synthetics/test-config/global-variables.html) are **REQUIRED** to run the included API test.
2020
- `org_ingest_token`: A provisioned INGEST token
2121
![required synthetic variables](synthetic-variables.png)
2222

214 KB
Loading

integration-examples/synthetics-examples/status-page-api/synthetic-variables.png renamed to integration-examples/synthetics-examples/API/status-page-to-metrics-api/synthetic-variables.png

File renamed without changes.

integration-examples/synthetics-examples/status-page-api/synthetics_thirdparty_status_api_check.tf renamed to integration-examples/synthetics-examples/API/status-page-to-metrics-api/synthetics_thirdparty_status_api_check.tf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ resource "synthetics_create_api_check_v2" "synthetics_thirdparty_status_api_chec
44
automatic_retries = 0
55
device_id = 34
66
frequency = 60
7-
location_ids = ["aws-ca-central-1", "aws-us-east-1", "aws-us-west-1", "aws-us-west-2"]
7+
location_ids = ["aws-us-east-1", "aws-us-west-1"]
88
name = "Cloudflare Status API"
99
scheduling_strategy = "round_robin"
1010
requests {
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
# Third-party Status Page API Check to Metric
2+
This example API test calls the OpenAI status endpoint and collects data on ongoing incidents and updates.
3+
This test creates and sends a log event containing that incident data to a Splunk HEC endpoint.
4+
The test and it's configuration are included in this directory:
5+
- [`synthetics_status_to_splunk_hec_api_check.tf`](./synthetics_status_to_splunk_hec_api_check.tf)
6+
- Uses the [Splunk Synthetics Terraform provider](https://registry.terraform.io/providers/splunk/synthetics/latest/docs)
7+
8+
## Synthetic API Test
9+
The synthetic API test will call the OpenAI status page and report any current and ongoing incidents to a Splunk HEC endpoint of your choice. This example is mostly to illustrate ingest arbitrary ingest into Splunk. The test serves a double function of providing external monitoring of the HEC endpoint in question in addition to providing ingest of useful incident data.
10+
11+
12+
### Required Splunk Synthetic Global Variables
13+
The following [global variables](https://docs.splunk.com/observability/en/synthetics/test-config/global-variables.html) are **REQUIRED** to run the included API test.
14+
- `splunk_hec_url`: The url to your hec raw ingest (E.G. `https://hec-inputs-for-my-service.mysplunkinstance.com:443/services/collector/raw`)
15+
- `hec_token`: A provisioned hec token for basic auth (E.G. `Splunk 123412-3123-1234-abcd-1234123412abc`)
16+
Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
# __generated__ by Terraform
2+
# Please review these resources and move them into your main configuration files.
3+
4+
# __generated__ by Terraform from "1552655"
5+
resource "synthetics_create_api_check_v2" "synthetics_status_to_splunk_hec_api_check" {
6+
test {
7+
active = true
8+
automatic_retries = 0
9+
device_id = 34
10+
frequency = 60
11+
location_ids = ["aws-us-east-1", "aws-us-west-1"]
12+
name = "OpenAI Status - To Splunk HEC"
13+
scheduling_strategy = "round_robin"
14+
requests {
15+
configuration {
16+
body = null
17+
headers = {}
18+
name = "Get OpenAI status"
19+
request_method = "GET"
20+
url = "https://status.openai.com/proxy/status.openai.com"
21+
}
22+
validations {
23+
actual = "{{response.code}}"
24+
code = null
25+
comparator = "is_less_than"
26+
expected = "300"
27+
extractor = null
28+
name = "Assert response code is less than 300"
29+
source = null
30+
type = "assert_numeric"
31+
value = null
32+
variable = null
33+
}
34+
validations {
35+
actual = null
36+
code = null
37+
comparator = null
38+
expected = null
39+
extractor = "$.summary.ongoing_incidents[*].updates"
40+
name = "Extract from response body"
41+
source = "{{response.body}}"
42+
type = "extract_json"
43+
value = null
44+
variable = "openai_ongoing_incidents"
45+
}
46+
}
47+
requests {
48+
configuration {
49+
body = "{{custom.openai_ongoing_incidents}}"
50+
headers = {
51+
Authorization = "{{env.hec_token}}"
52+
}
53+
name = "Send to Splunk HEC Ingest"
54+
request_method = "POST"
55+
url = "{{env.splunk_hec_url}}"
56+
}
57+
validations {
58+
actual = "{{response.code}}"
59+
code = null
60+
comparator = "is_less_than"
61+
expected = "300"
62+
extractor = null
63+
name = "Assert response code is less than 300"
64+
source = null
65+
type = "assert_numeric"
66+
value = null
67+
variable = null
68+
}
69+
}
70+
}
71+
}

integration-examples/synthetics-examples/token-expiration-api/README.md renamed to integration-examples/synthetics-examples/API/token-expiration-to-metrics-api/README.md

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
1-
# Token Expiration Detector using Splunk Synthetics
2-
This detector relies on metrics created by a Splunk Synthetics API test. That test and it's configuration are also included in this directory along with the detector as Terraform `.tf` files.
1+
# Token Expiration using Splunk Synthetics API check
2+
This Test queries the `/organization` endpoint of a Splunk Observability organization and retrieves the values of any tokens expiring within the next 30 days or next 7 days and sends metrics for that data to Splunk Observability.
33
- [`synthetics_token_expiration_api_check.tf`](./synthetics_token_expiration_api_check.tf)
4+
This API test includes a detector which relies on metrics created by this test. That test and it's configuration are also included in this directory along with the detector as Terraform `.tf` files.
45
- Uses the [Splunk Synthetics Terraform provider](https://registry.terraform.io/providers/splunk/synthetics/latest/docs)
56
- [`detector_token_expiration.tf`](detector_token_expiration.tf)
67
- Uses the [Signalfx Terraform Provider](https://registry.terraform.io/providers/splunk-terraform/signalfx/latest/docs)
@@ -13,7 +14,7 @@ The synthetic API test will call the [`/organization` endpoint](https://dev.splu
1314
These metrics and dimensions will be sent to your organization's ingest endpoint and will power your detector.
1415

1516
### Required Splunk Synthetic Global Variables
16-
The following global variables are **REQUIRED** to run the included API test.
17+
The following [global variables](https://docs.splunk.com/observability/en/synthetics/test-config/global-variables.html) are **REQUIRED** to run the included API test.
1718
- `org_api_token`: A provisioned API token (Read-only is fine)
1819
- `org_ingest_token`: A provisioned INGEST token
1920
![required synthetic variables](synthetic-variables.png)

integration-examples/synthetics-examples/token-expiration-api/detector_token_expiration.tf renamed to integration-examples/synthetics-examples/API/token-expiration-to-metrics-api/detector_token_expiration.tf

File renamed without changes.

0 commit comments

Comments
 (0)