SWQL examples for new widgets
This topic applies to all Orion Platform products.
Starting with Orion Platform 2020.2, you can use SWQL to define what you want to see in your widgets on modern dashboards.
See the THWACK post on modern dashboards for an overview of the feature.
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.
The scripts are not supported under any SolarWinds support program or service. The scripts are provided AS IS without warranty of any kind. SolarWinds further disclaims all warranties including, without limitation, any implied warranties of merchantability or of fitness for a particular purpose. The risk arising out of the use or performance of the scripts and documentation stays with you. In no event shall SolarWinds or anyone else involved in the creation, production, or delivery of the scripts be liable for any damages whatsoever (including, without limitation, damages for loss of business profits, business interruption, loss of business information, or other pecuniary loss) arising out of the use of or inability to use the scripts or documentation.
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)
Nodes grouped by their status
SELECT COUNT(NodeID) as value, Status as status FROM Orion.Nodes GROUP BY status ORDER BY value DESC
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
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