Question

I need to get a weekly report of my applications uptime.

The metric is available on the "SLA Report" screen (http://awesomescreenshot.com/0f02fsy34e) but i can't find a way to get it programatically.

Other SLA metrics are available using the API : http://docs.newrelic.com/docs/features/sla-report-examples#metrics

Was it helpful?

Solution 2

Even though there was no direct api request for getting uptime from newrelic we can give the nrql queries inside curl. curl -X POST -H "Accept: application/xml" -H "X-Query-Key: your_query_api_key" -d "nrql=SELECT+percentage(count(*)%2c+WHERE+result+%3d+'SUCCESS')+FROM+SyntheticCheck+SINCE+1+week+ago+WHERE+monitorName+%3d+'your+monitor+name'+FACET+dateOf(timestamp)" "https://insights-api.newrelic.com/v1/accounts/your_account_id/query"

The above curl will give uptime percentages distributed by Days of week. If you don't know how to url encode your nrql query please try this http://string-functions.com/urlencode.aspx. Hope this helps.

OTHER TIPS

The uptime information is not considered a metric so is not available via the REST API. If you like you may contact support.newrelic.com to request this as a new feature.

mm. I figured out that the following gives a csv formatted text content and could be useful for extracting data (monthly), but it's not going ask you for credentials on the tool / command line you use. (Beware). Since i export the monthly metrics from my machine, it's simple for me to make it work, and it really gives me much more flexibility.

https://rpm.newrelic.com/optimize/sla_report/run?account_id=<account_id>&application_id=<app_id>&format=csv&interval=months

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top