Your data. Anywhere you go.

New Relic for iOS or Android


Download on the App Store    Android App on Google play


New Relic Insights App for iOS


Download on the App Store


Learn more

Close icon

Recreate weekly SLA report via API

api

#1

I am trying to recreate the weekly SLA report displayed under application -> reports -> SLA -> weekly. This is also the same report sent in the weekly email. I am using the API explorer and the suggestions on this page SLA Example to get the correct curl commands to run. In doing so, I am unable to get the same values as displayed on the website or in the email. They are close, but not close enough. I think it might be the to and from values I am choosing. The weekly SLA reports end on Sundays and we are located in Portland, OR. What would the appropriate to and from values for the week ending 3/23/14?

The closest I have come to getting the correct values uses:
from: 2014-03-17T00:00:00+00:00
to: 2014-03-24T00:00:00+00:00

I thought subtracting 7 hours from each would work because we are in UTC-7 currently, but that made the value even further apart from the expected. Any help would be appreciated.

My second question deals with uptime. Uptime is currently also reported in our weekly SLA, but I am unable to find any documentation on how to get it from the API? If it is even possible.

Thanks,

Mike


#2

Hi Mike,

Could you share the curl command you are using? Please leave the API key out of the command, but I would like to see what data you are querying.

As for the Uptime, this is a calculated number based on the availability monitor, and is not something that is currently retrievable from the API.


#3

Thanks for the quick response Steven,

I am only using the API explorer at this point (wanted to get the correct values before implementing it in python), but here is the curl command it produced for the first metric of the SLA (requests):

curl -X GET ‘https://api.newrelic.com/v2/applications/APPCODE/metrics/data.json
-H ‘X-Api-Key:ourKey’ -i
-d ‘names[]=HttpDispatcher&values[]=call_count&from=2014-03-17T00:00:00+00:00&to=2014-03-24T00:00:00+00:00&summarize=true’

The New Relic created SLA has this value returned as 7.93 million while the API explorer returns 7919626. I also had a slight variation in the second metric (Resp. Time) 106ms vs 107ms. The closeness led me to believe I was just off in the times I was using.

Bummer to hear that Uptime isn’t possible via the API.

Thanks,

Mike


#4

There is a possibility that a time slice of data is missing if you start exactly on the hour. You can try the ‘from’ time at something just before the hour. Perhaps 2014-03-16T23:59:00+00:00

Would it be okay with you if we open a support ticket for you so we can address the specific application and time periods?

Also bear in mind that we are looking at data that is often averaged and some round-off will have occurred so obtaining an exact match may not be possible.


#5

Thanks REngland for the response,

Unfortunately it turns out the Uptime is a requirement for my SLA creation so my issues with the time and values is no longer an issue. Thanks all for your time.

Mike


#6

Has the Uptime metric been added yet? I’m also looking to automate an SLA report.


#7

Hey @daviddesloovere - while this doesn’t help your specific request to automate your own SLA report, would a Synthetics SLA report meet your needs?

https://docs.newrelic.com/docs/synthetics/new-relic-synthetics/pages/synthetics-sla-report-aggregate-monitor-metrics

While we do have our Synthetics Rest API:

https://docs.newrelic.com/docs/apis/synthetics-rest-api

…we don’t have the ability to query metrics. For this, I’ve opened a new feature request on your behalf. This will be passed onto our product management team for review.

Thanks for helping us improve!


#8

It’s great that those Synthetics SLA reports can be shared. Something that should definitely be added to the APM reports too.
But turns out I need reports that only span the business hours. So I’ll have to use the API for that anyway.


#9

Hi,

Is there any update on this topic?
Is it possible to get the metrics programmatically for Synthetic Monitoring to create SLA reports?

Thanks


#10

Hi,

Just want to check if there was an update to this topic. Is it possible now to get the ‘uptime’ metric through REST API or get SLA reports including the ‘uptime’ metric through Rest API. I have seen multiple posts regarding this and each say that this Feature Request is pending. It will be great if you can share an update on this.

Thanks,