How to configure a New Relic alert to post the results every one hour to external endpoint?

Hi ,

I have a NR alert for monitoring the SLO of a product. I am trying to get the execution output of the query every 60 mins webhook-ed into another external endpoints. But I don’t see a way to configure the alerts as cron job, instead I could only use web hook when the alert condition is not met.

How can I configure a NRLQ query to send the execution of the results every 60 mins via web hook to external endpoints?

Hi, @sai.soundararajan: You are correct that New Relic Alerts can only send notifications when an alert incident is opened, closed, or acknowledged. To do what you want, you will have to write a script to execute your query using the query API and post the result to the desired endpoint. You may then execute your script as a cron job.

Hey Phil thanks for the quick response. I see , so where will the script be hosted? meaning can the script be run as a lambda function within NR itself (similar to Synthetics) or the script needs to be run from some instance outside of NR? I really hope there is a provision to run like a one-off lambda script to run in NR itself :slight_smile: ?

You may run the script as a Synthetics API Test. That is the only method New Relic provides to run a script on a schedule.

Thank you @philweber . Just checked NR synthetics test, looks like its mainly intended to run health check scripts as a lambda hosted by NR. Let me see if I can find an example to execute NRLQ query from NR synthetics test . Please do share me an example if you have any.

Thanks again

Let us know how that works out for you in the meantime @sai.soundararajan!

I found an example here: https://github.com/newrelic/quickstarts-synthetics-library/blob/main/library/QueryEventAPI/