Create monitors in the Synthetics app

edit

Create monitors in the Synthetics app

edit

You can create synthetic monitors directly in the Synthetics app in Kibana.

Diagram showing which pieces of software are used to configure monitors

This is one of two approaches you can use to set up a synthetic monitor.

Prerequisites

edit

You must be signed into Kibana as a user with at least synthetics write permissions, and Monitor Management must be enabled by an administrator as described in Setup role.

You should decide where you want to run the monitors before getting started. You can run monitors on one or both of the following:

  • Elastic’s global managed testing infrastructure: With Elastic’s global managed testing infrastructure, you can create and run monitors in multiple locations without having to manage your own infrastructure. Elastic takes care of software updates and capacity planning for you.
  • Private Locations: Private Locations allow you to run monitors from your own premises. To use Private Locations you must create a Private Location before continuing. For step-by-step instructions, refer to Monitor resources on private networks.

Executing synthetic tests on Elastic’s global managed testing infrastructure incurs an additional charge. Tests are charged under one of two new billing dimensions depending on the monitor type. For browser monitor usage, there is a fee per test run. For lightweight monitor usage, there is a fee per region in which you run any monitors regardless of the number of test runs. For more details, refer to full details and current pricing.

If you are setting up Synthetics for a deployment configured with traffic filters, connections into Elasticsearch are restricted and results will not be able to be written back into Elasticsearch unless granted. For more details, refer to Use Synthetics with traffic filters.

Add a lightweight monitor

edit

To use the Synthetics app to add a lightweight monitor:

  1. Go to Synthetics in Kibana.
  2. Click Create monitor.
  3. Set the monitor type to HTTP Ping, TCP Ping, or ICMP Ping.
  4. In Locations, select one or more locations.

    If you don’t see any locations listed, refer to the troubleshooting guide for guidance.

  5. Set the Frequency, and configure the monitor as needed.
  6. Click Advanced options to see more ways to configure your monitor.
  7. (Optional) Click Run test to verify that the test is valid.
  8. Click Create monitor.

    Synthetics Create monitor UI

If you’ve added a Private Location, you’ll see your new Private Location in the list of Locations.

Screenshot of Monitor locations options including a Private Location

Add a browser monitor

edit

You can also create a browser monitor in the Synthetics app using an Inline script.

An inline script contains a single journey that you manage individually. Inline scripts can be quick to set up, but can also be more difficult to manage. Each browser monitor configured using an inline script can contain only one journey, which must be maintained directly in Kibana.

If you depend on external packages, have your journeys next to your code repository, or want to embed and manage more than one journey from a single monitor configuration, use project monitors instead.

To use the Synthetics app to add a browser monitor:

  1. Click Create monitor.
  2. Set the monitor type to Multistep.
  3. In Locations, select one or more locations.

    If you don’t see any locations listed, refer to the troubleshooting guide for guidance.

  4. Set the Frequency.
  5. Add steps to the Script editor code block directly. The journey keyword isn’t required, and variables like page and params will be part of your script’s scope. You cannot import any dependencies when using inline browser monitors.

    Configure a synthetic monitor using an inline script in Elastic Fleet

    Alternatively, you can use the Script recorder option. You can use the Elastic Synthetics Recorder to interact with a web page, export journey code that reflects all the actions you took, and upload the results to Synthetics app. For more information, refer to Use the Synthetics Recorder.

  6. Click Advanced options to see more ways to configure your monitor.

    • Use Data options to add context to the data coming from your monitors.
    • Use the Synthetics agent options to provide fine-tuned configuration for the synthetics agent. Read more about available options in Use the CLI.
  7. (Optional) Click Run test to verify that the test is valid.
  8. Click Create monitor.

View in Kibana

edit

When a monitor is created or updated, the first run might not occur immediately, but the time it takes for the first run to occur will be less than the monitor’s configured frequency. For example, if you create a monitor and configure it to run every 10 minutes, the first run will occur within 10 minutes of being created. After the first run, the monitor will begin running regularly based on the configured frequency. You can run a manual test if you want to see the results more quickly.

Navigate to the Synthetics app in Kibana, where you can see screenshots of each run, set up alerts in case of test failures, and more.

If a test does fail (shown as down in the Synthetics app), you’ll be able to view the step script that failed, any errors, and a stack trace. For more information, refer to Analyze data from synthetic monitors.

Next steps

edit

Learn more about: