Skip to content

Commit

Permalink
feat(mirrors,get) monitor http to https enforced redirection and use …
Browse files Browse the repository at this point in the history
…the same pattern for get and mirrors (#88)
  • Loading branch information
dduportal authored May 27, 2022
1 parent 7010833 commit f0b41d9
Show file tree
Hide file tree
Showing 4 changed files with 94 additions and 8 deletions.
32 changes: 28 additions & 4 deletions synthetics_get.tf
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,35 @@ resource "datadog_synthetics_test" "get_jenkins_io" {
"production"
]

device_ids = [
"laptop_large",
"tablet",
"mobile_small"
status = "live"
}

resource "datadog_synthetics_test" "get_jenkins_io_enforced_https" {
type = "api"
request_definition {
method = "GET"
url = "http://get.jenkins.io"
}
assertion {
type = "statusCode"
operator = "is"
target = "308"
}
assertion {
type = "header"
property = "location"
operator = "is"
target = "https://get.jenkins.io"
}
locations = ["aws:eu-central-1"]
options_list {
tick_every = 900
}
name = "get.jenkins.io-enforced-http"
message = "Notify @pagerduty"
tags = [
"jenkins.io",
"production"
]

status = "live"
Expand Down
66 changes: 64 additions & 2 deletions synthetics_mirrors.tf
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ resource "datadog_synthetics_test" "mirrors_jenkins_io" {
type = "api"
request_definition {
method = "GET"
url = "https://mirrors.jenkins.io"
url = "https://mirrors.jenkins.io/debian/jenkins_2.251_all.deb?mirrorlist"
}
assertion {
type = "statusCode"
Expand All @@ -23,11 +23,42 @@ resource "datadog_synthetics_test" "mirrors_jenkins_io" {
status = "live"
}

resource "datadog_synthetics_test" "mirrors_jenkins_io_enforced_https" {
type = "api"
request_definition {
method = "GET"
url = "http://mirrors.jenkins.io"
}
assertion {
type = "statusCode"
operator = "is"
target = "308"
}
assertion {
type = "header"
property = "location"
operator = "is"
target = "https://mirrors.jenkins.io"
}
locations = ["aws:eu-central-1"]
options_list {
tick_every = 900
}
name = "mirrors.jenkins.io-enforced-http"
message = "Notify @pagerduty"
tags = [
"jenkins.io",
"production"
]

status = "live"
}

resource "datadog_synthetics_test" "mirrors_jenkinsci_org" {
type = "api"
request_definition {
method = "GET"
url = "https://mirrors.jenkins-ci.org"
url = "https://mirrors.jenkins-ci.org/debian/jenkins_2.251_all.deb?mirrorlist"
}
assertion {
type = "statusCode"
Expand All @@ -47,3 +78,34 @@ resource "datadog_synthetics_test" "mirrors_jenkinsci_org" {

status = "live"
}

resource "datadog_synthetics_test" "mirrors_jenkinsci_org_enforced_https" {
type = "api"
request_definition {
method = "GET"
url = "http://mirrors.jenkins-ci.org"
}
assertion {
type = "statusCode"
operator = "is"
target = "308"
}
assertion {
type = "header"
property = "location"
operator = "is"
target = "https://mirrors.jenkins-ci.org"
}
locations = ["aws:eu-central-1"]
options_list {
tick_every = 900
}
name = "mirrors.jenkins-ci.org-enforced-http"
message = "Notify @pagerduty"
tags = [
"jenkins-ci.org",
"production"
]

status = "live"
}
2 changes: 1 addition & 1 deletion synthetics_wiki.tf
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ resource "datadog_synthetics_test" "wikijenkins_ciorg" {
operator = "is"
target = "200"
}

locations = ["aws:eu-central-1"]
# Can't work at the moment according datadog message
# Synthetics is only available for the Datadog US site.
Expand Down

0 comments on commit f0b41d9

Please sign in to comment.