I am trying to create a SWQL query which shows the Server availability and downtime date, start and end time and error message why it was down.
I have created below query to get 30 days but I need downtime date, start time and downtime end time in the report as well.
Select N.Caption, N.IP_Address, N.NodeID, Avg(RT.Availability) As AvgAvailability, RT.ObservationTimestamp, CP.<Custom Property Name>, E.Message
FROM Orion.Nodes as N
Inner Join Orion.ResponseTime as RT ON N.NodeID = RT.NodeID
Left Join Orion.NodesCustomProperties as CP ON N.NodeID = CP.NodeID
Inner Join Orion.Events as E ON N.NodeID = E.NetObjectID
Where N.nodeID = 'XXXX'
AND RT.ObservationTimestamp >= DATETRUNC('Month',(ADDMONTH(-1, GETUTCDATE())))
AND RT.ObservationTimestamp < DATETRUNC('Month', GETUTCDATE())
GROUP BY N.Caption, N.IP_Address, Availability, N.NodeID, RT.ObservationTimestamp, CP. .<Custom Property Name>, E.Message