-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
278 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
3 changes: 3 additions & 0 deletions
3
terraform/examples/icmp-ping/.terraform/plugins/darwin_amd64/lock.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
{ | ||
"circonus": "fd0c440cd2a97f9933e1371172770328ea7373758029c4571aa345539882739a" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
// Circonus Enterprise Collectors (aka Brokers) | ||
|
||
### Broker ID is found on the broker page by viewing the broker API object (the cid), | ||
### so you will need to change 2512 to an enterprise broker in your account. | ||
data "circonus_collector" "home_broker" { | ||
id = "/broker/2512" | ||
} | ||
|
||
// Circonus Public Collectors (aka Brokers) | ||
data "circonus_collector" "ashburn" { | ||
id = "/broker/1" | ||
} | ||
|
||
data "circonus_collector" "san_jose" { | ||
id = "/broker/2" | ||
} | ||
|
||
data "circonus_collector" "amsterdam" { | ||
id = "/broker/3" | ||
} | ||
|
||
data "circonus_collector" "munich" { | ||
id = "/broker/4" | ||
} | ||
|
||
data "circonus_collector" "nagano" { | ||
id = "/broker/6" | ||
} | ||
|
||
data "circonus_collector" "composite" { | ||
id = "/broker/206" | ||
} | ||
|
||
data "circonus_collector" "chicago" { | ||
id = "/broker/275" | ||
} | ||
|
||
data "circonus_collector" "singapore" { | ||
id = "/broker/276" | ||
} | ||
|
||
data "circonus_collector" "london" { | ||
id = "/broker/32" | ||
} | ||
|
||
data "circonus_collector" "httptrap" { | ||
id = "/broker/35" | ||
} | ||
|
||
data "circonus_collector" "caql" { | ||
id = "/broker/1490" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,138 @@ | ||
|
||
/* You can specify an Enterprise Collector by using the following instead: | ||
id = "${var.collectors_enterprise[0]}" | ||
*/ | ||
resource "circonus_check" "icmp_ping" { | ||
collector { | ||
id = "/broker/2512" | ||
} | ||
|
||
name = "ICMP Latency from Public Collector" | ||
notes = <<EOF | ||
This check measures the network latency between a Collector and a target host. | ||
EOF | ||
|
||
icmp_ping { | ||
count = 1 | ||
} | ||
|
||
target = "${var.ping_target}" | ||
|
||
/*target = "${var.ping_target}"*/ | ||
|
||
period = "60s" | ||
|
||
metric { | ||
name = "${circonus_metric.icmp_minimum.name}" | ||
tags = ["${circonus_metric.icmp_minimum.tags}"] | ||
type = "${circonus_metric.icmp_minimum.type}" | ||
unit = "${circonus_metric.icmp_minimum.unit}" | ||
active = true | ||
} | ||
metric { | ||
name = "${circonus_metric.icmp_available.name}" | ||
tags = ["${circonus_metric.icmp_available.tags}"] | ||
type = "${circonus_metric.icmp_available.type}" | ||
unit = "${circonus_metric.icmp_available.unit}" | ||
active = true | ||
} | ||
metric { | ||
name = "${circonus_metric.icmp_average.name}" | ||
tags = ["${circonus_metric.icmp_average.tags}"] | ||
type = "${circonus_metric.icmp_average.type}" | ||
unit = "${circonus_metric.icmp_average.unit}" | ||
active = true | ||
} | ||
metric { | ||
name = "${circonus_metric.icmp_count.name}" | ||
tags = ["${circonus_metric.icmp_count.tags}"] | ||
type = "${circonus_metric.icmp_count.type}" | ||
unit = "${circonus_metric.icmp_count.unit}" | ||
active = true | ||
} | ||
metric { | ||
name = "${circonus_metric.icmp_maximum.name}" | ||
tags = ["${circonus_metric.icmp_maximum.tags}"] | ||
type = "${circonus_metric.icmp_maximum.type}" | ||
unit = "${circonus_metric.icmp_maximum.unit}" | ||
active = true | ||
} | ||
|
||
tags = [ "${var.ping_tags}" ] | ||
} | ||
|
||
resource "circonus_metric" "icmp_minimum" { | ||
name = "minimum" | ||
type = "numeric" | ||
unit = "seconds" | ||
tags = [ "${var.ping_tags}" ] | ||
} | ||
resource "circonus_metric" "icmp_available" { | ||
name = "available" | ||
type = "numeric" | ||
unit = "null" | ||
tags = [ "${var.ping_tags}" ] | ||
} | ||
resource "circonus_metric" "icmp_average" { | ||
name = "average" | ||
type = "numeric" | ||
unit = "seconds" | ||
tags = [ "${var.ping_tags}" ] | ||
} | ||
resource "circonus_metric" "icmp_count" { | ||
name = "count" | ||
type = "numeric" | ||
unit = "null" | ||
tags = [ "${var.ping_tags}" ] | ||
} | ||
resource "circonus_metric" "icmp_maximum" { | ||
name = "maximum" | ||
type = "numeric" | ||
unit = "seconds" | ||
tags = [ "${var.ping_tags}" ] | ||
} | ||
|
||
/* | ||
The following are 2 graphs which are samples you can customize, duplicate, or throw away. | ||
*/ | ||
resource "circonus_graph" "icmp_ping" { | ||
name = "Ping Latency to ${var.ping_target} from Ashburn, VA Broker" | ||
description = "The minimum and maximum ping time between ${var.ping_target} and Ashburn, VA Broker" | ||
line_style = "stepped" | ||
|
||
metric { | ||
check = "${circonus_check.icmp_ping.checks[0]}" | ||
metric_name = "minimum" | ||
metric_type = "numeric" | ||
axis = "left" | ||
color = "#17b6d6" | ||
name = "Ping Minimum Latency" | ||
} | ||
metric { | ||
check = "${circonus_check.icmp_ping.checks[0]}" | ||
metric_name = "maximum" | ||
metric_type = "numeric" | ||
axis = "left" | ||
color = "#17b6d6" | ||
name = "Ping Maximum Latency" | ||
} | ||
|
||
tags = [ "${var.ping_tags}" ] | ||
} | ||
|
||
resource "circonus_graph" "icmp_ping_roundtrip" { | ||
name = "Ping Roundtrip to ${var.ping_target} from Ashburn, VA Broker" | ||
description = "The round trip ping time between ${var.ping_target} and Ashburn, VA Broker" | ||
line_style = "stepped" | ||
|
||
metric { | ||
check = "${circonus_check.icmp_ping.checks[0]}" | ||
metric_name = "average" | ||
metric_type = "numeric" | ||
axis = "left" | ||
color = "#17b6d6" | ||
name = "Ping Roundtrip Time" | ||
} | ||
|
||
tags = [ "${var.ping_tags}" ] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,83 @@ | ||
|
||
### replace vynjo with your account name. | ||
variable "account_name" { | ||
description = "The name of the Circonus Account to use" | ||
default = "Vynjo" | ||
} | ||
variable "circonus_account_name" { | ||
description = "The name of the Circonus Account" | ||
default = "vynjo" | ||
} | ||
|
||
### Replace with your API Token, either account level or user level tokens work. | ||
variable "circonus_api_token" { | ||
default = "9598206a-25fb-c279-f37d-asdfasdfadsf" | ||
} | ||
|
||
variable "circonus_api_url" { | ||
default = "https://api.circonus.com/v2" | ||
} | ||
|
||
variable "check_name" { | ||
default = "ICMP_Ping" | ||
} | ||
|
||
variable "environment" { | ||
description = "Specify the environment (e.g. prod, staging, etc)" | ||
type = "string" | ||
default = "testing" | ||
} | ||
|
||
variable "check_notes" { | ||
default = "A check to ping times." | ||
} | ||
|
||
variable "target" { | ||
default = "api.circonus.com" | ||
} | ||
|
||
### To find the team ID, you will need to create a slack contact group, then find the equvilant of | ||
### \"team\":\"T7E3X6R0S\", replacing T7E3X6R0S with your team id | ||
variable "alert_slack_team_id" { | ||
description = "The ID of the Slack Team" | ||
default = "T7E3X6R0S" | ||
} | ||
|
||
### Change circonus-alerts to the channel, in your team, where you want alerts to show up | ||
variable "alert_slack_channel_name" { | ||
description = "The name of the Slack channel to notify (within the Slack Team)" | ||
default = "#circonus-alerts" | ||
} | ||
|
||
### (same) Change circonus-alerts to the channel, in your team, where you want alerts to show up | ||
variable "alert_slack_escalate_channel_name" { | ||
description = <<EOF | ||
The name of the Slack channel to notify (within the Slack Team) when an escalation needs to occur. | ||
EOF | ||
default = "#circonus-alerts" | ||
} | ||
|
||
provider "circonus" { | ||
key = "${var.circonus_api_token}" | ||
api_url = "${var.circonus_api_url}" | ||
} | ||
|
||
variable "ping_tags" { | ||
type = "list" | ||
default = [ | ||
"app:circonus", | ||
"author:terraform", | ||
"resource:network", | ||
] | ||
} | ||
|
||
variable "ping_target" { | ||
default = "www.google.com" | ||
} | ||
# variable "collectors_enterprise" { | ||
# default = "${data.circonus_collector.home_broker.id}" | ||
# } | ||
# | ||
# variable "collectors_public" { | ||
# default = ["${data.circonus_collector.ashburn.id}", "${data.circonus_collector.chicago.id}"] | ||
# } |