Go to All Forums

Using REST API to produce Availability SLA report

There doesn't seem to be any way to use REST API calls to produce Availability SLA report similar to the GUI method (containing daily Availability history and business hours). Is there a way to produce and export these reports using automation?

I am using /reports/availability_summary/{monitor_id}?period=7

Additionally, JSON output from that call is flawed - it contains duplicate items ('totaldowntime' and 'TotalDownTime'), which conflict when used with Powershell:

ConvertFrom-Json : Cannot convert the JSON string because a dictionary that was converted from the string contains the duplicated keys 'totaldowntime' and 'TotalDownTime'.

Like (3) Reply
Replies (3)

I hope you mean /reports/sla_reports/availability?period={report_period_constants}. We will look into the issue because of case sensitiveness of attribute name. Until then, as a workaround, you can do text replacement for one of those keys in response before using ConvertFrom-Json.

Like (0) Reply

That's what I'm doing for now, thank you.

 

What about my main question, about using API for producing an overall report like attached report produced using the web interface?


Attachments
report.png
Size: 89.4 KB
Like (0) Reply

Sorry, there is no JSON based api for that page.

As you have mentioned "reports/availability_summary/{monitor_id}?period=7" api is the closest one available. You can use charts node in the response to get similar data.

For SLA success/failure information you can use "/reports/sla_reports/availability?period={report_period_constants}"

Like (0) Reply

Was this post helpful?