ловите perf для группы серверов
DECLARE
@utcOffset int
DECLARE
@start DateTime
SET
@utcOffset = DATEDIFF(Hour, GETDATE(), GETUTCDATE())
SET
@start = DateAdd(MONTH, -1, GETDATE())
-- Varables for Script ----
DECLARE
@ComputerGroup varchar(255) = 'groupname' -- Comptuer group name
DECLARE
@CounterName varchar(255) = '% Processor Time' ---- CounterName
DECLARE
@ObjectName varchar(255) = 'Processor Information' ------- Object name
select distinct Path,
FullName,
ObjectName,
CounterName,
InstanceName,
DateTime,
Path + InstanceName as 'key',
AverageValue As 'y', --- AverageValue, MinValue or MaxValue
-- convert datetime to UTC epoch in milliseconds
convert(bigint,
datediff(s,'1970-01-01',
DATEADD(Hour,
@utcOffset ,
DateTime
)
)
) * 1000 AS 'x'
from Perf.vPerfDaily pvpr
inner join vManagedEntity vme on pvpr.ManagedEntityRowId = vme.ManagedEntityRowId
inner join vPerformanceRuleInstance vpri on pvpr.PerformanceRuleInstanceRowId = vpri.PerformanceRuleInstanceRowId
inner join vPerformanceRule vpr on vpr.RuleRowId = vpri.RuleRowId
WHERE CounterName =
@CounterName AND ObjectName =
@ObjectNameAnd DateTime >
@startAND vme.TopLevelHostManagedEntityRowId in
(
--Get list of objects in a group (pass ManagedEntityRowId for the group as a parameter)
select distinct vme2.ManagedEntityRowId
--,DisplayName = vme2.displayname
from vrelationship r
inner join vManagedEntity vme on vme.ManagedEntityRowId=r.TargetManagedEntityRowId
inner join vManagedEntity vme2 on vme.TopLevelHostManagedEntityRowId=vme2.ManagedEntityRowId
inner join vRelationshipManagementGroup rmg on rmg.RelationshipRowId=r.RelationshipRowId
where SourceManagedEntityRowId=
(
--Get ID for a specific group
select Distinct ManagedEntityRowId from vManagedEntity
inner join vRelationship on vManagedEntity.ManagedEntityRowId=vRelationship.SourceManagedEntityRowId
inner join vRelationshipType on vRelationship.RelationshipTypeRowId=vRelationshipType.RelationshipTypeRowId
inner join vRelationshipManagementGroup on vRelationshipManagementGroup.RelationshipRowId=vRelationship.RelationshipRowId
where (vRelationshipType.RelationshipTypeSystemName='Microsoft.SystemCenter.ComputerGroupContainsComputer'
or vRelationshipType.RelationshipTypeSystemName like '%InstanceGroup%')
and DisplayName=
@ComputerGroupand vRelationshipManagementGroup.ToDateTime is null
)
and rmg.ToDateTime is null
)