Something we hear quite often is "how can I build custom SLA report in Orion". Everybody who is a bit familiar with Orion knows our web-reporting tools which is the right place to start, however sometimes it requires more than a click & point tweak in reporting.
I'll use this SLA request example: WAN SLA availability by time zone & 7x24 in order to demonstrate one of the ways how to get there.
What you'd need to accomplish this?
- NPM (or any other SolarWinds product)
- Orion SDK - Orion SDK Information
- At least one hour data history for the devices which should appear in your SLA report. In my case, Nodes and business hours.
- 30 minutes of your time
What will be the result:
Our goal is to create daily custom SLA report for Node availability (in %) which shows the device availability only for our business hours - in our case 7AM - 6PM
The result may look like this:
Node SLA Availability SLA Hours
New York 92.33 7am-6pm
Let's get started:
First problem we need to solve is how to "tell" system what are our report business hours. This seems to be a best fit for Orion custom properties. Let's create two custom properties: 1) time_from 2)time_to and assign the values to all nodes.
Go "All Settings" -> "Manage Custom Properties" -> "Add Custom Property" -> Select Nodes and click "next" -> specify property name "time_from" and apply on "reports" -> Select all nodes to assign a property.
Now we need to assign the start rush our time in a bulk operation to all nodes. Select "view/edit values" and set "7" to the field:
Ok, now go and repeat all steps above for "time_to" and value "18" (6PM).
Ready? Good. We have data ready and now it's time to data-mining. For that purpose we're going to use SolarWidns proprietary business logic and data layer represented by SolarWinds Information Service - SWIS. Which has simimar syntax to SQL but gives you much more power to get properties via "." operator (no need to know entire database table structures). In order to tune the final query we will use SWQL Studio tool which is part of SDK you already installed into ProgramFolder (x86)\Orion SDK\
Run the studio and enter the FDQN name of your Orion server (or IP Address), Administrator credentials and from drop-down select "Orion (v3)" which defines version 3 of SWIS.
If the connect is successful you'll see the SWIS database structure on the left hand side:
And again, this is not equal to your SQL server structure, this is the database structure Orion primarily use for viewing data and it's strongly recommended to use over direct SQL access because it provides data consistency, performance optimization and it will guarantee your reports to be working even if database structure is changed during product updates.
Prepare the SWQL query
Not the fun begins and we need to define SWQL query for our data set.
Here is the one I use to get the data for my SLA report:
select n.Caption, sub_query.sla_day, sub_query.sla_availability, n.CustomProperties.time_from, n.CustomProperties.time_to FROM
SELECT avg(Availability) as sla_availability, datetrunc('day',datetime) as sla_day, r.NodeID
FROM Orion.ResponseTime r
where hour(datetime) >= r.Node.customproperties.time_from and hour(datetime)<= r.Node.customproperties.time_to
group by datetrunc('day',datetime), r.NodeID
) as sub_query
inner join Orion.Nodes n ON n.NodeID=sub_query.NodeID
For those who are bit familiar with any SQL type of language it should look familiar. Here is what I've done
First I need to compute average data from Orion.ResponseTime table and I need to apply rush hour limitation defined by custom properties from above. This represents inner query. "Datetrunc" function is able to take a day, hour or month from entire date. I need a day so I can guarantee avaliability for each node is computed for only a given day and then for rush hours time interval. It's easy compare condition.
Second I need to return the results of average node availability for time-segment and apply a table formatting so I will see "Node Caption", day/date, availability and time_from and time_to defining SLA business rush hours.
And the result?
Great, so we can tune our query and add/remove columns or apply additional sorting.
Publish and view in Orion reporting.
Time to take our work and make it available for all Orion users. To do so, go to Orion web console -> reports -> manger reports -> create new report. And we will create new CustomTable based report.
Follow the steps below to accomplish your task where we enter our SWQL query, select the columns for report and apply sorting by date:
8) voila - here comes the final report
We're done. Till now our new report "Node SLA report - business hours" will be available in the list of reports in Orion and you can also schedule the report on daily/weekly basis as you need.
Please be aware our maintenance rolls-off the finest detailed data each month (30 days) and if you run the report after that period you won't be able to see full granular details beyond 30 days time border.
I hope you find this useful and it inspires you to experiment more with SWQL and SWQL studio in order to build the reports you're looking for. SWQL studio will also help you to browse our data structures so you can learn by walking and master your custom report skills in Orion.