Hi,
I am apologizing in advance if my post is not on the right channel/thread.
I'm a beginner at SWQL and have no knowledge of SQL. I just want to create a modern dashboard with Downtime, Uptime, and Total hours down. I've been reading articles here in the forum but what I collected were in parts and I don't know how to combine them in a single SWQL query.
Please below SWQL queries:
========================================================================
--Im able to get Uptime and used filter custom properties
SELECT
n.Caption,
n.DetailsUrl,
n.Status,
n.CustomProperties.Manage_Customer_CPE AS CustomProperties_Manage_Customer_CPE,
AddHour(+8,n.LastBoot) as Last_Boot,=
FROM Orion.Nodes n
WHERE (Status LIKE '%2%' AND n.CustomProperties.Manage_Customer_CPE LIKE '%Yes%')
========================================================================
-- I want to extract HoursDown and Downtime from below and add it to the above SWQL.
SELECT
Nodes.Caption AS NodeName, Nodes.DetailsUrl AS [_LinkFor_NodeName],
'/Orion/images/StatusIcons/Small-' + StatusIcon AS [_IconFor_NodeName],
HOURDIFF(T1.DownTime, GetDate()) AS HoursDown,
T1.DownTime
FROM (SELECT MAX(EventTime) AS DownTime,
NetObjectID,
NetworkNode
FROM Orion.Events
WHERE (EventType = 1)
AND (NetObjectType = 'N')
GROUP BY NetObjectID, NetworkNode)
AS T1 INNER JOIN Orion.Nodes
ON T1.NetworkNode = Nodes.NodeID
WHERE Nodes.Status = '2'
ORDER BY HoursDown ASC,
Nodes.Caption,
T1.DownTime ASC,
Nodes.NodeID