Skip to main content

The DfE technical guidance and its content is intended for internal use by the DfE community.

Back to Monitoring

StatusCake

Statuscake is a cloud based tool used to constantly monitor the availability of websites and alert when they are not present.

Access to the DfE account

Use the StatusCake form, choose Request account access and enter your email address. This will give you access to the DFEStatusCake subaccount and you will be able to see all checks in DfE, modify contact groups and integrations. Checks can’t be created manually, it is only allowed via an API key.

Request API key

Each service or service area (shared key) can request an API key to create the checks via automation. Use the StatusCake form, choose Request API key. Enter the team’s email address and the name of the service or service area.

Contact Group

Create a contact group for each team manually using the statuscake GUI.

Alerts

It is possible to have a number of emails and mobile numbers for alerts when a site is unavailble.

Integration

It is possible for a Slack message to be raised. You will need a Slack Webhook, which can be provided on request by Digital tools.

Delivery

It is recommended to use Terraform. Example configuration below.

tfvars file

"alerts": {                                     # Several different checks per environment can be configured
  "publish": {
    "website_name": "publish-teacher-training-prod",                                    # Name of the service and environment
    "website_url": "https://www.publish-teacher-training-courses.service.gov.uk/ping",  # Simple healtheck page with no dependency
    "check_rate": 60,
    "contact_group":  [555000]
  },
}

tf configuration

provider "statuscake" {
  api_token = local.infra_secrets.STATUSCAKE_PASSWORD
}

terraform {
  required_version = "1.2.3"
  required_providers {
    statuscake = {
      source  = "StatusCakeDev/statuscake"
      version = "2.0.3"
    }
  }

variable alerts {
  type = map
  default = {}
}

resource "statuscake_uptime_check" "alert" {
  for_each = var.alerts

  name           = each.value.website_name
  check_interval = each.value.check_rate
  confirmation   = 2                            # Set to 2 to eliminate false alarms
  trigger_rate   = 0                            # Set to 0 to alert immediately
  regions        = ["london", "dublin"]         # Check locations
  contact_groups = each.value.contact_group

  http_check {
    follow_redirects = true
    timeout          = 40
    request_method   = "HTTP"
    status_codes = [
      "204",
      "205",
      "206",
      "303",
      "400",
      "401",
      "403",
      "404",
      "405",
      "406",
      "408",
      "410",
      "413",
      "444",
      "429",
      "494",
      "495",
      "496",
      "499",
      "500",
      "501",
      "502",
      "503",
      "504",
      "505",
      "506",
      "507",
      "508",
      "509",
      "510",
      "511",
      "521",
      "522",
      "523",
      "524",
      "520",
      "598",
      "599"
    ]
  }

  monitored_resource {
    address = each.value.website_url
  }
}