Custom SWQL Query for Temperature

Hi Guys,

I have created the following SWQL, but really would like to Colour code the STATUS Columns, but im not familiar with the CASE commands, can anyone help?

n.Caption AS [Node Name],
n.DetailsUrl AS [_LinkFor_Node Name],
'/Orion/images/StatusIcons/Small-' + n.StatusIcon as [_IconFor_Node Name],
Name AS [Sensor Name],
OriginalStatus AS [Status],

FROM Orion.HardwareHealth.HardwareItem hi

JOIN Orion.Nodes AS n ON n.nodeID = hi.nodeID
JOIN Orion.HardwareHealth.HardwareInfoBase AS hib ON hib.ParentObjectID = hi.NodeID
JOIN Orion.HardwareHealth.HardwareCategoryStatus AS hcs ON hcs.HardwareInfoID = hi.HardwareInfoID

AND hi.Status > '1'
AND hi.HardwareCategoryID='4'
AND hcs.HardwareCategoryName='Temperature'
AND NOT hi.UniqueName LIKE 'HardwareSensor%'


Please let me know asap as this has me stumpled.... Disappointed

Parents Reply
  • Not trying to convince you one way or the other... but I do think it's worth noting that is an old thread and not really necessary to go to that length I don't believe. There's fully supported methods to do what's mentioned in that thread.

    I'm not sure when SolarWinds implemented the ability to "Allow HTML Tags" in columns of reports / custom tables but it's there now in the latest versions.

    A simple example...

    Go to your view, add the "Custom Table" widget, edit it and select a SWQL datasource (could be done in SQL as well).

    Here's an example SWQL query to use:

          CONCAT('<a href="https://localhost"', n.DetailsUrl, '>', n.Caption, '</a>') AS [Node]
        ,CASE WHEN n.ResponseTime < 5 THEN CONCAT('<p style="color:blue">', TOSTRING(n.ResponseTime), '</p')
            ELSE CONCAT('<p style="color:red;font-weight:bold">', TOSTRING(n.ResponseTime), '</p') 
         END AS [Latency]
    FROM Orion.Nodes AS n

    Add the columns in and make sure you "Allow HTML Tags" on the columns that have them.

    End result:

    So in the end... multiple ways to skin that cat as they say lol.

No Data