Skip to main content

Creating Pingdom checks

Overview

Pingdom is a global performance and availability monitor for your web application. The aim of this document is to provide you with the necessary information to create Pingom checks via the cloud-platform-environments pipeline, and then send failing checks to a Slack channel of your choosing.

Prerequisites

This guide assumes the following:

Create a Pingdom check

Add the below 2 files in in the resources directory of your namespace in your cloud-platform-environments repository. You can define the conditions of your check using the resources outlined in the Terraform community provider. Here’s a working example of a basic check.

  1. Add the below code to the required_providers block in versions.tf

        pingdom = {
          source  = "russellcardullo/pingdom"
          version = "1.1.3"
        }
    

    A working example of versions.tf with pingdom included will look like this.

    terraform {
      required_version = ">= 0.13"
      required_providers {
        aws = {
          source = "hashicorp/aws"
        }
        kubernetes = {
          source = "hashicorp/kubernetes"
        }
        pingdom = {
          source  = "russellcardullo/pingdom"
          version = "1.1.3"
        }
      }
    }
    
  2. Add a pingdom.tf file

    provider "pingdom" {
    }
    
    resource "pingdom_check" "claim-criminal-injuries-compensation-uat" {
      type                     = "http"
      name                     = "cica - uat - cloud-platform - claim"
      host                     = "uat.claim-criminal-injuries-compensation.service.justice.gov.uk"
      resolution               = 1
      notifywhenbackup         = true
      sendnotificationwhendown = 6
      notifyagainevery         = 0
      url                      = "/"
      encryption               = true
      port                     = 443
      tags                     = "businessunit_platforms,application_prometheus,component_healthcheck,isproduction_true,environment_uat,infrastructuresupport_platforms"
      probefilters             = "region:EU"
    }
    
    

Note: You’ll need to include the provider "pingdom" and terraform blocks either in this file or in a main.tf file.

You can define the conditions of your check using the resources outlined in the Terraform community provider.

Here’s a working example of a basic check.

This basic check simply checks that the host/url (in this case; uat.claim-criminal-injuries-compensation.service.justice.gov.uk) returns a 200 every minute (resolution = 1 minute). When six (sendnotificationwhendown = 6) consecutive checks fail it triggers an alarm.

This page explains all the attributes used in the check.

All resources, including Pingdom checks must be tagged and adhere to the technical guidance outlined here. Ensure your check has appropriate tags before submitting a pull request.

Once reviewed and merged to main, the pipeline will create your check in the MoJ Pingdom account.

Adding Slack notification

You can enable the option to send a failing alert to Slack via a webhook by simply adding Pingdom integration id. You need administrator permissions to manage the mojdt Pingdom Slack webhook and then Pingdom to create the integration id.

The Cloud Platform team can do this on your behalf. Create a ticket requesting a Pingdom integration id with the following information:

  • team name
  • application name
  • slack channel

The team will provide you with an integration id, following the steps outlined here.

You can now add integrationids to your pingdom.tf. Appending the example above, your check will now appear as follows (assuming you were given 1000 as the integration id):

provider "pingdom" {
}

resource "pingdom_check" "claim-criminal-injuries-compensation-uat" {
  type                     = "http"
  name                     = "cica - uat - cloud-platform - claim"
  host                     = "uat.claim-criminal-injuries-compensation.service.justice.gov.uk"
  resolution               = 1
  notifywhenbackup         = true
  sendnotificationwhendown = 6
  notifyagainevery         = 0
  url                      = "/"
  encryption               = true
  port                     = 443
  tags                     = "businessunit_platforms,application_prometheus,component_healthcheck,isproduction_true,environment_uat,infrastructuresupport_platforms"
  probefilters             = "region:EU"
  integrationids           = [1000]
}
This page was last reviewed on 7 June 2021. It needs to be reviewed again on 7 September 2021 .
This page was set to be reviewed before 7 September 2021. This might mean the content is out of date.