SWQL examples for new widgets
This topic applies to all SolarWinds Platform (self-hosted) products.
Starting with Orion Platform 2020.2, you can use SWQL to define what you want to see in your widgets on modern dashboards.
The SWQL code depends on the widget type.
To use the code to define the data model for a widget
-
Add the widget on a dashboard.
-
In Data model, select Hand edit a SWQL query and paste the example.
-
Complete the widget configuration and click Save Changes.
KPI Widgets
Number of all events
SELECT COUNT(EventID) as value FROM Orion.Events
Number of monitored nodes
SELECT COUNT(NodeID) as value FROM Orion.Nodes
Number of monitored nodes that are up
SELECT Count (Status) as value FROM Orion.Nodes WHERE (Status = 1)
Number of monitored nodes in the critical status
SELECT Count (Status) as value FROM Orion.Nodes WHERE (Status = 14)
Number of monitored nodes in the warning status
SELECT Count (Status) as value FROM Orion.Nodes WHERE (Status = 3)
Number of monitored nodes in unknown status
SELECT Count (Status) as value FROM Orion.Nodes WHERE (Status = 0)
Proportional widgets
Nodes grouped by their status
SELECT COUNT(NodeID) as value, Status as status FROM Orion.Nodes GROUP BY status ORDER BY value DESC
Customize node status colors (you can change colors in the code)
SELECT COUNT(1) as value, Status,
CASE WHEN Status = 1 THEN 'status_up' WHEN Status =14 THEN 'status_down' WHEN Status =3 THEN 'status_warning' ELSE 'status_unknown' END as icon,
CASE WHEN Status = 1 THEN 'green' WHEN Status =14 THEN 'red' WHEN Status = 3 THEN 'yellow' ELSE 'gray'
END as color
FROM Orion.Nodes GROUP BY status ORDER BY value DESC
Table widgets
Display 25 latest events
SELECT TOP 25 COUNT(e.EventID) as value, t.Name as type
FROM Orion.Events e JOIN Orion.EventTypes t ON e.EventType = t.EventType
GROUP BY type ORDER BY value DESC
See all display options for nodes
SELECT NodeId as id, DisplayName as NodeName, Status as NodeStatus, VendorIcon as NodeVendor, DetailsUrl as NodeUrl FROM Orion.Nodes