# Dec 1st, 2020: \[EN\] Synthetics: Finding problems before they happen

**URL:** https://discuss.elastic.co/t/dec-1st-2020-en-synthetics-finding-problems-before-they-happen/254953
**Category:** Advent Calendar
**Created:** [December 1, 2020, 8:00am UTC](https://discuss.elastic.co/t/dec-1st-2020-en-synthetics-finding-problems-before-they-happen/254953 "2020-12-01T08:00:00Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![Ahil\_PonArul](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/ahil_ponarul/32/45836_2.png) [@Ahil\_PonArul](https://discuss.elastic.co/u/Ahil_PonArul)
#### Post date: [December 1, 2020, 8:00am UTC](https://discuss.elastic.co/t/dec-1st-2020-en-synthetics-finding-problems-before-they-happen/254953/1 "2020-12-01T08:00:00Z")

</div>

# Synthetics: Proactive Problem Detection

Elastic is excited to introduce Synthetic monitoring to our Uptime solution. This allows for more advanced uptime checks beyond basic pings. Combined with our new User Experience UI it also enables proactive problem detection.

 ![](https://us1.discourse-cdn.com/elastic/original/3X/3/0/305f542618aed80774bd18afab2d4ec1c6fd988d.jpeg)

This is a step by step example of how to set Synthetics up, as well as integrate it with APM. The application in this example, and instructions on how to instrument with APM it can be found in this [blog](https://www.elastic.co/blog/how-to-instrument-a-polyglot-microservices-application-with-elastic-apm).

## Install Heartbeat

[Download and install](https://www.elastic.co/guide/en/beats/heartbeat/7.10/heartbeat-installation-configuration.html) Heartbeat. Or if you prefer, pull and prepare the [Docker image](https://www.elastic.co/guide/en/beats/heartbeat/current/running-on-docker.html).

## Create a monitor

Heartbeat uses monitors to pull data, so first we must create an http monitor and specify its check. This check is a basic login check to ensure our service’s authentication mechanism is working correctly. Note that the `service_name` must be the same as the APM service name setting to ensure correlation between APM and Uptime. More details can be found [here](https://www.elastic.co/guide/en/beats/heartbeat/7.10/monitor-http-options.html#monitor-http-check).

```auto
- type: http
  id: synthetics-test
  name: tutc-synth
  service_name: todos-api
  schedule: '@every 5s'
  urls: ["http://frontend:8080/login"]
  check.request:
  method: POST
  headers:
    'Content-Type': 'application/json'
  body:
    '{"username":"test","password":"user"}'
  check.response:
    status: [200]

```

## Start Heartbeat

In my case I used the below command, but [yours](https://www.elastic.co/guide/en/beats/heartbeat/current/heartbeat-installation-configuration.html) might be different.

```auto

docker run -d --name=heartbeat --user=heartbeat --network=my_network --volume="$(pwd)/heartbeat.yml:/usr/share/heartbeat/heartbeat.yml:ro" docker.elastic.co/beats/heartbeat:7.10.0 --strict.perms=false -e

```

## Check Uptime

Check the Uptime UI to see if your services are showing up.

 ![](https://us1.discourse-cdn.com/elastic/original/3X/5/2/5286aa20ad8910556c7b80861b2d8fa139a423b0.png)

## Check APM Integration

Click on the down arrow at the end of the status monitor entry to navigate to the APM UI.

![APM](https://us1.discourse-cdn.com/elastic/original/3X/5/6/5671f169f1c8ddb73e071f99631b03a8a4f18b8b.gif)

## Create an Alert

We want to know if our authentication mechanism fails before customers start reporting login issues. Luckily we can create an alert directly from our Uptime UI.

 ![](https://us1.discourse-cdn.com/elastic/original/3X/8/0/800b1d59c16aeed9a7fc712e7800e32121901dc9.png)

Select `Create alert`

 ![](https://us1.discourse-cdn.com/elastic/original/3X/9/b/9bcd8bba2eca1577cff25a10751e4f6fc6bb9aea.png)

Select `Monitor status alert`

Give your alert a name, and be sure to specify which monitor the alert should be searching for

 ![](https://us1.discourse-cdn.com/elastic/original/3X/e/2/e2db9c328f7a4efb218c8cb97a5d65af13aca93d.png)

Specify an action for your alert, in this case we are using the [index action](https://www.elastic.co/guide/en/kibana/7.x/index-action-type.html).

 ![](https://us1.discourse-cdn.com/elastic/original/3X/7/8/7839bec7e2119798be256b2be79ce6b366b2da18.png)

Create the document to index and hit save.

 ![](https://us1.discourse-cdn.com/elastic/original/3X/1/e/1e8c79e6bee26abfe3f6daee0be5409b1cbf70d5.png)

## Conclusion

Congratulations, you have just configured your first Synthetic monitor with Elastic Observability. If you want to try this out today, the fastest way is with a [14 day free trial of Elastic Cloud](https://www.elastic.co/cloud/).

---

<div class="post-metadata">

### Author: ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)
#### Post date: [December 29, 2020, 8:00am UTC](https://discuss.elastic.co/t/dec-1st-2020-en-synthetics-finding-problems-before-they-happen/254953/2 "2020-12-29T08:00:06Z")

</div>

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.
