A Singapore Government Agency Website

Monitoring SaaS services using synthetics

In your application ecosystem, your upstream or downstream services might include cloud-hosted or off-the-shelf Software as a Service (SaaS) applications. You may need to monitor the SaaS products in your ecosystem to determine their system health and capture SaaS statuses for processing or reporting.

There are 2 methods of monitoring SaaS services by leveraging StackOps’ Elasticsearch synthetic monitors:

  1. HTTP Ping synthetic monitor
  2. Advanced multi-step synthetic monitor with Playwright script - Use this if HTTP Ping is not feasible, i.e. response format is not JSON or you need more complex operations to check status.

Prerequisites

You will need:

Identify the health data of the SaaS service

In this example, we will be using Elastic as the SaaS service we want to monitor. For this example, the health page for Elastic is https://status.elastic.co/.

  1. Access the health page of the SaaS service and ensure that there are API endpoints to retrieve data from. For Elastic, the API endpoint is https://status.elastic.co/api/v2/summary.json, which returns a JSON object containing all statuses of Elasticsearch services components and their respective regions. E.g. of SaaS health data

  2. Identify the data you wish to monitor for this SaaS service. In this example, we are interested in all the components related to AWS Singapore (ap-southeast-1). E.g. for AWS Singapore

    In JSON format, the data related to AWS Singapore (ap-southeast-1) will look like: JSON E.g. of SaaS health data

    {"id":"spy7rch22kg0","name":"Elasticsearch connectivity: AWS ap-southeast-1","status":"operational","created_at":"2013-12-18T10:24:59.729Z","updated_at":"2023-07-22T22:59:12.783Z","position":11,"description":null,"showcase":true,"start_date":null,"group_id":"dl8pdyf9hpc3","page_id":"8wpbdv4sl8gv","group":false,"only_show_if_degraded":false}
  3. Look for keywords within the data that will help you identify the relevant component and status. In this example, our keywords are Elasticsearch connectivity: AWS ap-southeast-1 and "status":"operational". Using these keywords, we can create a unique search to easily filter and find the data we need.

Set up HTTP Ping synthetic monitor

  1. From the Kibana of the Elasticsearch cluster with the deployed Elastic Agent (see Prerequisites), go to Observability > Synthetics. Click Create Monitor. Create monitor
  2. Select HTTP Ping and fill in the details accordingly, i.e. URL, monitor name, and select the private Elastic Agent stated in the prerequisites. Create Ping monitor details
  3. Specify additional details like frequency of running the test, timeout in seconds, enable retest on failure, enable TLS alerts etc. Select Advanced options to view more settings. Create Ping monitor more settings
  4. In the Response checks section, locate the Response body contains field and enter the previously mentioned unique keywords: "name":"Elasticsearch connectivity: AWS ap-southeast-1","status":"operational"
  5. Select Run test to test the synthetic monitor. If there are no issues, proceed to Create monitor. Create Ping monitor response check

Advanced multi-step synthetic monitor with Playwright script

If HTTP Ping is not feasible (i.e. response format is not JSON or you need more complex operations to check status), you can create a multi-step synthetic monitor to do health check on your SaaS service.

  1. From the Kibana of the Elasticsearch cluster with the deployed Elastic Agent (see Prerequisites), go to Observability > Synthetics. Click Create Monitor. Create monitor
  2. Select Multistep and fill in the details accordingly, i.e. monitor name, select the private Elastic Agent stated in the prerequisites, and frequency of running the test. Create monitor
  3. In the Add a script section, you can either use the Elastic Synthetics Recorder to generate and upload a script or create your own Playwright script with the Script editor. Assertions can be helpful if you need to verify that your statuses contain a specific text or status. Refer to the Playwright documentation on assertions for more details. Create monitor
  4. Select Run test to test the synthetic monitor. If there are no issues, proceed to Create monitor.
Chat with me!
Bot Launcher