count(case when abc.DaValue >= 90 then abc.DaValue end) 'MemoryAbove90%'
FROM(
select TOP 100 PERCENT
vManagedEntity.Path as Server
,vPerformanceRule.ObjectName
,vPerformanceRule.CounterName
,AVG(vPerfRaw.SampleValue) AS DaValue
from Perf.vPerfRaw
join vPerformanceRuleInstance on vPerformanceRuleInstance.PerformanceRuleInstanceRowid = vPerfRaw.PerformanceRuleInstanceRowid
join vPerformanceRule on vPerformanceRule.RuleRowId = vPerformanceRuleInstance.RuleRowId
join vManagedEntity on vManagedEntity.ManagedEntityRowid = vPerfRaw.ManagedEntityRowId
where vPerfRaw.Datetime > DATEADD(minute, -10, GETUTCDATE())
and vPerformanceRule.ObjectName = 'Memory'
and vPerformanceRule.CounterName = 'PercentMemoryUsed'
GROUP BY Path, ObjectName, CounterName, Name
Order by DaValue DESC)
as abc
This gives me Total Servers collected from, and Total Servers found to have AVG collections over 90% for Memory Util.
My KPI states that I must only display the number of servers that are above 90%, for more than 10minutes.
The problem with this is that when i run it over a 10 minute period, I get collections for about 40% of my managed servers only.
I want to know if anyone has a better way of collecting the perf data over a 10 minute period ?
What i was thinking of doing is running this query with time interval on 11 minutes, populating a temp table with the data, running the query again with time interval on 1 minute ago, and comparing the results. IF it finds a match, I know that the server has been over 90% memory util for 10 minutes - then i can count it ? Its probably not entirely accurate, but Im out of ideas. From here, i want to export the Values for Total Servers and TotalServersAbove90% into Excel, and build a guage off it that will reflect a % of Servers within SLA -Memory Util.
Im not entirely familiar with SCOM collection intervals, IF I run the query for the last 1 minute - It seems to skip alot of servers and only returns data from about 50, is that because its not cycling on those at that moment ? In which case my idea below wont work.