Skip to content

Commit d12311c

Browse files
committed
self-service observability demo file
1 parent 403d570 commit d12311c

File tree

10 files changed

+226
-0
lines changed

10 files changed

+226
-0
lines changed
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
#!/bin/bash
2+
set -x
3+
terraform init
4+
terraform apply -auto-approve
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
#!/bin/bash
2+
set -x
3+
terraform apply -auto-approve
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
#!/bin/bash
2+
set -x
3+
cp tf_files/03_updated_title.tf main.tf
4+
terraform apply -auto-approve
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
#!/bin/bash
2+
set -x
3+
cp tf_files/04_add_detector.tf main.tf
4+
terraform apply -auto-approve
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
#!/bin/bash
2+
terraform destroy --auto-approve
3+
rm terraform.tfstate
4+
rm terraform.tfstate.backup
5+
rm .terraform.lock.hcl
6+
cp tf_files/01_initial.tf main.tf
Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
variable "signalfx_key" {
2+
type = string
3+
}
4+
5+
variable "api_url" {
6+
type = string
7+
}
8+
9+
terraform {
10+
required_providers {
11+
signalfx = {
12+
source = "splunk-terraform/signalfx"
13+
version = "9.1.1"
14+
}
15+
}
16+
}
17+
18+
provider "signalfx" {
19+
auth_token = var.signalfx_key
20+
api_url = var.api_url
21+
}
22+
23+
resource "signalfx_time_chart" "mychart0" {
24+
name = "CPU Utilization"
25+
description = "Very cool CPU chart"
26+
27+
program_text = <<-EOF
28+
A=data("cpu.utilization").publish()
29+
EOF
30+
}
31+
32+
resource "signalfx_dashboard_group" "mydashgroup0" {
33+
name = "OAC Demo Dashboard Group"
34+
}
35+
36+
resource "signalfx_dashboard" "mydashboard0" {
37+
name = "OAC Demo Dashboard"
38+
dashboard_group = signalfx_dashboard_group.mydashgroup0.id
39+
40+
chart {
41+
chart_id = signalfx_time_chart.mychart0.id
42+
width = 12
43+
height = 1
44+
row = 0
45+
}
46+
}
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
signalfx_key="REPLACEME"
2+
api_url="https://api.us1.signalfx.com"
Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
variable "signalfx_key" {
2+
type = string
3+
}
4+
5+
variable "api_url" {
6+
type = string
7+
}
8+
9+
terraform {
10+
required_providers {
11+
signalfx = {
12+
source = "splunk-terraform/signalfx"
13+
version = "9.1.1"
14+
}
15+
}
16+
}
17+
18+
provider "signalfx" {
19+
auth_token = var.signalfx_key
20+
api_url = var.api_url
21+
}
22+
23+
resource "signalfx_time_chart" "mychart0" {
24+
name = "CPU Utilization"
25+
description = "Very cool CPU chart"
26+
27+
program_text = <<-EOF
28+
A=data("cpu.utilization").publish()
29+
EOF
30+
}
31+
32+
resource "signalfx_dashboard_group" "mydashgroup0" {
33+
name = "OAC Demo Dashboard Group"
34+
}
35+
36+
resource "signalfx_dashboard" "mydashboard0" {
37+
name = "OAC Demo Dashboard"
38+
dashboard_group = signalfx_dashboard_group.mydashgroup0.id
39+
40+
chart {
41+
chart_id = signalfx_time_chart.mychart0.id
42+
width = 12
43+
height = 1
44+
row = 0
45+
}
46+
}
Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
variable "signalfx_key" {
2+
type = string
3+
}
4+
5+
variable "api_url" {
6+
type = string
7+
}
8+
9+
terraform {
10+
required_providers {
11+
signalfx = {
12+
source = "splunk-terraform/signalfx"
13+
version = "9.1.1"
14+
}
15+
}
16+
}
17+
18+
provider "signalfx" {
19+
auth_token = var.signalfx_key
20+
api_url = var.api_url
21+
}
22+
23+
resource "signalfx_time_chart" "mychart0" {
24+
name = "CPU Utilization - Updated"
25+
description = "Very cool CPU chart"
26+
27+
program_text = <<-EOF
28+
A=data("cpu.utilization").publish()
29+
EOF
30+
}
31+
32+
resource "signalfx_dashboard_group" "mydashgroup0" {
33+
name = "OAC Demo Dashboard Group"
34+
}
35+
36+
resource "signalfx_dashboard" "mydashboard0" {
37+
name = "OAC Demo Dashboard"
38+
dashboard_group = signalfx_dashboard_group.mydashgroup0.id
39+
40+
chart {
41+
chart_id = signalfx_time_chart.mychart0.id
42+
width = 12
43+
height = 1
44+
row = 0
45+
}
46+
}
Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
variable "signalfx_key" {
2+
type = string
3+
}
4+
5+
variable "api_url" {
6+
type = string
7+
}
8+
9+
terraform {
10+
required_providers {
11+
signalfx = {
12+
source = "splunk-terraform/signalfx"
13+
version = "9.1.1"
14+
}
15+
}
16+
}
17+
18+
provider "signalfx" {
19+
auth_token = var.signalfx_key
20+
api_url = var.api_url
21+
}
22+
23+
resource "signalfx_detector" "cpu_detector" {
24+
name = "OAC - CPU over 90% for 1 minute"
25+
description = ""
26+
max_delay = 30
27+
tags = ["prod"]
28+
29+
program_text = <<-EOF
30+
signal = data('cpu.utilization').publish()
31+
detect(when(signal > 90, '1m')).publish('CPU over 90% for 1 min')
32+
EOF
33+
rule {
34+
description = "CPU over 90% for 1 min"
35+
severity = "Critical"
36+
detect_label = "CPU over 90% for 1 min"
37+
notifications = ["Email,[email protected]"]
38+
}
39+
}
40+
41+
resource "signalfx_time_chart" "mychart0" {
42+
name = "CPU Utilization"
43+
description = "Very cool CPU chart"
44+
45+
program_text = <<-EOF
46+
A=data("cpu.utilization").publish()
47+
B = alerts(detector_id="${signalfx_detector.cpu_detector.id}").publish(label="B");
48+
EOF
49+
}
50+
51+
resource "signalfx_dashboard_group" "mydashgroup0" {
52+
name = "OAC Demo Dashboard Group"
53+
}
54+
55+
resource "signalfx_dashboard" "mydashboard0" {
56+
name = "OAC Demo Dashboard"
57+
dashboard_group = signalfx_dashboard_group.mydashgroup0.id
58+
59+
chart {
60+
chart_id = signalfx_time_chart.mychart0.id
61+
width = 12
62+
height = 1
63+
row = 0
64+
}
65+
}

0 commit comments

Comments
 (0)