I have a component that is collecting the terminal service active sessions for well lover a 1000 nodes. I want to display the sum of these in a custom chart so I can see the historical Sum of all active sessions for all nodes.
I've tried this but that rounds to the hour and I'd like to get to at least a half hour granularity.
SELECT Comp.Name,
SUM(Stat.AvgStatisticData) AS SumUsers,
DateTrunc('hour', Stat.ObservationTimestamp) As TimeRound
FROM Orion.APM.StatisticsUsage AS Stat
INNER JOIN Orion.APM.Component AS Comp ON Stat.ComponentID = Comp.ComponentID
INNER JOIN Orion.APM.Application AS APP ON Comp.ApplicationID = APP.ApplicationID
WHERE
APP.ApplicationID IN (SELECT ApplicationID FROM Orion.APM.Application WHERE DisplayName = 'Collab - CommonComponents' OR DisplayName = 'VDI - CommonComponents') AND
Comp.ComponentID IN (SELECT ComponentID FROM Orion.APM.Component WHERE Name = 'PERF: Terminal Services\Active Sessions' OR Name = 'PERF: Terminal Services\Inactive Sessions')
GROUP BY
APP.DisplayName, Comp.Name,
DateTrunc('hour', Stat.ObservationTimestamp)
Is there a better way to chart the SUM of a stat for multiple nodes, and if so how can I group the time in an increment finer than one hour?