Can we run a single Synthetic API monitor on multiple environments?

I have an API scripted monitor to run against one of our internal environments.
I was wondering if there’s a way to re-use the same script against another environment. The difference between the environments would be the URL to hit, and the test account credentials.
It would be great if we can have a list of environments and credentials listed in once centralized source and the monitors read from there and run against the entire list.

Thank you

Hi @Karthikeyan.Margam - Simple answer, yes :grin:

You can create a test which loops through the environments changing the endpoint and authentication credentials for each iteration through the loop.

You need to be careful though as you could have the test fail if any of the environment checks fail unless you code for this and handle failures at the end of the script. Also the script must complete execution within 180 seconds which is a non-configurable New Relic hard limit for synthetic tests.

Alternatively, look to create the script off line using tag replacement and use the synthetics API to create or update the monitors.

1 Like

Welcome to the Community @Karthikeyan.Margam - Let us know if the incomparable @stefan_garnham got you pointed in the right direction. We’d love to see any script you come up with (with any personal/account ID information withheld of course!).

@Karthikeyan.Margam: As a third alternative, you can store the reusable portion of your script in a Github gist, and use the technique described below to download and run it:

1 Like