Good afternoon,
I'm trying to (re)build a node availability report. One of the more recent updates changed the structure of some tables and broke what I used to use.
Here's what I used to use weekly, modified from another user's post on thwack:
SELECT MAX(Application) AS Application, MAX(AppInstance) AS AppInstance, MAX(PrimaryFunction) AS PrimaryFunction, MAX(Caption) AS Caption, SUM(OutageDurationInMinutes) AS SumOutageDurationInMinutes FROM (
SELECT Nodes.Caption, Nodes.Application, Nodes.AppInstance, Nodes.PrimaryFunction, Nodes.NodeID, StartTime.Message, StartTime.EventTime AS DownEventTime,
(
SELECT TOP 1 EventTime
FROM Events AS EndTimeTable
where EndTimeTable.EventTime >= StartTime.EventTime
AND EndTimeTable.EventType = 5
AND EndTimeTable.NetObjectType = 'N'
AND EndTimeTable.NetworkNode = StartTime.NetworkNode
AND EventTime IS NOT NULL
ORDER BY EndTimeTable.EventTime
) AS UpEventTime,
DATEDIFF(Mi, StartTime.EventTime,(
SELECT TOP 1 EventTime FROM Events AS Endtime
where EndTime.EventTime > StartTime.EventTime AND EndTime.EventType = 5 AND EndTime.NetObjectType = 'N'
AND EndTime.NetworkNode = StartTime.NetworkNode ORDER BY EndTime.EventTime)
) AS OutageDurationInMinutes
FROM Events StartTime
INNER JOIN Nodes ON StartTime.NetworkNode = Nodes.NodeID
WHERE (StartTime.EventType = 1)
AND Nodes.ReportGroup LIKE '%Avail%'
) AS UpTimeTable
where outageDurationInMinutes IS NOT NULL
---AND datepart(day, DownEventTime) >= 0
---AND datepart(day, UpEventTime) >= 0
---AND datepart(day, DownEventTime) <= 7
---AND datepart(day, UpEventTime) <= 7
AND DATEDIFF(day, DownEventTime,GETDATE()) <= 7
AND DATEDIFF(day, UpEventTime,GETDATE()) <= 7
GROUP BY NodeID
ORDER BY Caption ASC
How would I do it now? What tables contain the information I'm looking for at this point?
Thanks!