したがって、Roman がアドバイスしたように、SCOM には 2 つの DB があります。運用およびデータ ウェアハウス。パフォーマンス データを収集する MP は、収集したデータを DB のいずれかまたは両方に明示的に保存する必要があります。通常、適切に設計された MP からデータが両方の DB に保存されることを期待します。DB 間の主な違いは、運用 DB はほぼ「リアルタイム」のデータ (10 ~ 20 分間隔) を格納するのに対し、DW DB は時間単位および日単位の集計データを保持することです。
ここから、両方の DB の例をいくつか紹介します。
運用データベース:
このクエリは、特定の Windows コンピューターの使用可能なすべてのオブジェクト名、それらのインスタンス、および対応するカウンターを一覧表示しますが、他のクラスのクエリを変更することもできます。
select pc.*
from PerformanceCounterView pc
join TypedManagedEntity tme on tme.TypedManagedEntityId = pc.ManagedEntityId
join BaseManagedEntity bme on tme.BaseManagedEntityId = bme.BaseManagedEntityId
where (bme.TopLevelHostEntityId = (select BaseManagedEntityId from BaseManagedEntity where FullName = 'Microsoft.Windows.Computer:'+@ServerName))
order by ObjectName, CounterName, InstanceName
次に、 を取得PerformanceSourceInternalId
したら、次のクエリを実行して実際のデータを抽出できます。
declare @TZOffset as int = DATEDIFF(MINUTE,GETUTCDATE(),GETDATE())
SELECT SampleValue, DATEADD(MINUTE,@TZOffset,TimeSampled) as TS
FROM PerformanceDataAllView
where (PerformanceSourceInternalId = @SrcID)
and (TimeSampled > DATEADD(MINUTE,-@TZOffset,@Start))
and (TimeSampled < DATEADD(MINUTE,-@TZOffset,@End))
注: 両方の DB のすべてのタイム スタンプは UTC であるため、最後のクエリはそれらを現地時間に変換します。
データ ウェアハウス データベース:
DECLARE @StartDateSubParam as datetime
DECLARE @CurrentServerSubParam as int
SET @StartDateSubParam = '2016-01-01'
SET @CurrentServerSubParam =(select mecn.ManagedEntityRowId from vManagedEntity mecn where (mecn.Path is null) and (mecn.FullName like 'Microsoft.Windows.Computer:yourServer.Domain.com'))
select me.[Path] as ServerName,
me.ManagedEntityRowId as ManagedEntityID,
AverageValue,
MaxValue,
MinValue,
perfdata.StandardDeviation,
perfdata.[DateTime] as SampleDay
from Perf.vPerfHourly perfdata
join vPerformanceRuleInstance pri on perfdata.PerformanceRuleInstanceRowId = pri.PerformanceRuleInstanceRowId
join vPerformanceRule pr on pr.RuleRowId = pri.RuleRowId
left join vManagedEntity me on me.ManagedEntityRowId = perfdata.ManagedEntityRowId
where (pr.ObjectName = 'Processor Information') and (pr.CounterName = '% Processor Time')
and (perfdata.[DateTime] > @StartDateSubParam )
and (me.TopLevelHostManagedEntityRowId = @CurrentServerSubParam)
そのクエリは、Windows 2008 R2+ を搭載した Windows コンピューターのプロセッサ パフォーマンスを選択します (以前の Windows バージョンのプロセッサ情報 -> プロセッサを変更します)。名前を他の使用可能なカウンターに変更したり、時間ごとまたは日ごとの集計にvPerfHourly
またはを使用したりすることもできます。vPerfDaily
よろしくお願いします。