Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add uptime check #4

Merged
merged 10 commits into from
Nov 5, 2019
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 25 additions & 0 deletions monitoring_alerts.tf
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,31 @@ resource "google_monitoring_notification_channel" "slack_alert" {
}
}

resource "google_monitoring_uptime_check_config" "http" {
display_name = "${var.uptime_check_host}"
timeout = "5s"
period = "60s"

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I had to add project = "${var.stackdriver_workspace}" for this to work.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed. Mine worked as my project id is the same as my stackdriver workspace.

http_check {
path = "/status"
port = 443
use_ssl = true
}

monitored_resource {
type = "uptime_url"

labels = {
project_id = "${var.project_id}"
host = "${var.uptime_check_host}"
}
}

content_matchers {
content = "OK"
}
}

resource "google_monitoring_alert_policy" "alert_500_errors_eq" {
count = "${var.stackdriver_workspace == "" ? 0 : 1}"
project = "${var.stackdriver_workspace}"
Expand Down
4 changes: 4 additions & 0 deletions variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -35,3 +35,7 @@ variable "project_team" {
description = "The team this project belongs to, for billing and reporting purposes, etc"
default = "eq"
}

variable "uptime_check_host" {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should add this to terraform.tfvars.example since it is mandatory.

description = "The host to use for the uptime check (without protocol) e.g. eq.census.gov.uk"
}