This discussion has been locked. The information referenced herein may be inaccurate due to age, software updates, or external references.
You can no longer post new replies to this discussion. If you have a similar question you can start a new discussion in this forum.

Struggling!! I need a basic report showing the output of a SQL query.

I'm struggling here...

All I need is a report showing the output of a SQL query. The output will have 3 columns and can have anywhere from 0 rows to 100+ rows. Report will run once a day. I cannot figure out for the life of me how to create a report with this. Please someone help!!

  • Why don't you give us some more details. What do you want to see in the report? The numbers of columns and rows isn't enough to let me help. 

  • If you're talking about the SAM SQL User Experience Monitor, then it only supports 2 values and won't do what you're asking:

    • Statistic - the first cell (first row/column of data) returned by the query - this must be a number
    • Message - the cell in the second column / first row returned by the query - optional, can be text

    If you're talking about a SQL query pulling data from the SolarWinds database, then you'll need to provide more information.

  •  Sure, and thanks! First off, the query IS NOT being run against the Orion DB. It would be run against a different DB on a SQL server not associated to Orion other than it being added as a node in Orion.

    Below is an example of the output the query may return. It could have more rows or it could have no rows at all. I have a team that wants this query executed daily. The ideal situation is no count of events (no rows), but they want to know if there are events because that means problems. The query I have can also take a bit of time to execute; sometimes it can take an hour. They would like to see the output, if there is any. I considered using SAM SQL User Experience Monitor for this but I don't think it would do exactly what I need, and I'm not sure how to rework the query to make it friendly for SAM SQL UEM component.

    Max Eventtime                     Interactionid                       CountofEvents
    -----------------------                 ----------------                        -------
    2022-05-06 19:37:19.000    0H10H731VHHNQR3A      2,196,288
    2022-05-06 19:37:16.000    0H10H731VHHNQVTT      4,760,762
    2022-05-04 14:03:58.000    0H10H431A7J01VRP        12,994,475

  • So @shuth reviewed the SQL UEM pretty well, but I guess I am not sure why this data needs to be in Orion. I do have data that might be useful to Orion users in other systems, and at that point I make a link out to it. (Things like the CMDB and its reports, our packet capture and analysis tool, things in vCenter, etc.) If you need to alert on it, you like can make a SQL query that fits the UEM format. 

    If the data you have is just a SQL db, and you need a place to create a report from a query, I am not sure Orion is right. I would be looking at SRSS or PowerBI or even a PowerShell script to run nightly and build an export. 

    That's not to say that you can't do it, Orion is pretty flexible and did some great things in this series: (+) Prerequisites - Forum - Server & Application Monitor (SAM) - THWACK ( 

    There he sets up a secondary database and uses it to achieve things that were challenges at the time. Personally, I would find a tool meant to meet the need I have, and not push Orion to far outside its intended use. 

  • I was thinking the same, it probably would be served better using a different tool. Perhaps run a powershell script via Windows task scheduler, have the script massage the data in any manner you wish and save it as a .csv or even as a .html into your Orion Web directory and display it as a Custom HTML resource. That I have done before. 

  • I looked at how we set it up and here you go

    A powershell script runs daily as a scheduled task. The script uses the Invoke-Sqlcmd -Query to get the data. Once retrieved it is manipulated in powershell then written out like this:

    Out-File -FilePath 'C:\inetpub\SolarWinds\Orion\MyOrionData.txt' 

    Then we set up a Custom HTML resource with the code below to read the above file. Not pretty but it works fine. 


    <embed src="MyOrionData.txt" width="575" height="100">


    In our case we were just looking for nodes that did not get synced between system A and system B so a text output was all we needed, and it didn't need to look pretty. You could add whatever formatting you need to the HTML to make it look better.