如何顯示效能集合規則

若要顯示效能集合規則,請使用本節中的指令碼。此指令碼可用於大部分監視。它會建立包含下列資料行且可使用 Excel 加以檢視的 .csv 檔案。

 

資料行 說明

WriteAction

包含有關在哪裡寫入效能計數器的資訊

WriteToDB 或 CollectionPerformanceData

寫入 Operations Manager 資料庫

WriteToDW 或 CollectPerfDataWarehouse

寫入資料倉儲

WC

將效能計數器的基準資料儲存至操作資料庫

若要顯示管理群組中的效能集合規則,請執行下列指令碼:

function GetPerfCounterName ([String] $configuration)

{

$config = [xml] ("<config>" + $configuration + "</config>")

return ($config.Config.ObjectName + "\" + $config.Config.CounterName)

}

function GetFrequency ([String] $configuration)

{

$config = [xml] ("<config>" + $configuration + "</config>")

$frequency = $config.Config.Frequency;

if($frequency -eq $null)

{

$frequency = $config.Config.IntervalSeconds;

}

return ($frequency)

}

function GetDisplayName($performanceRule)

{

if($performanceRule.DisplayName -eq $null)

{

return ($performanceRule.Name);

}

else

{

return ($performanceRule.DisplayName);

}

}

function GetWriteActionNames($performanceRule)

{

$writeActions = "";

foreach($writeAction in $performanceRule.WriteActionCollection)

{

$writeActions += " " + $writeAction.Name;

}

return ($writeActions);

}

$perf_collection_rules = get-rule -criteria:"Category='PerformanceCollection'"

$perf_collection_rules | select-object @{name="Type";expression={foreach-object {(Get-MonitoringClass -id:$_.Target.Id).DisplayName}}},@{name="RuleDisplayName";expression={foreach-object {GetDisplayName $_}}} ,@{name="CounterName";expression={foreach-object {GetPerfCounterName $_.DataSourceCollection[0].Configuration}}},@{name="Frequency";expression={foreach-object {GetFrequency $_.DataSourceCollection[0].Configuration}}},@{name="WriteActions";expression={foreach-object {GetWriteActionNames $_}}} | sort Type,RuleDisplayName,CounterName | export-csv "c:\perf_collection_rules.csv"

社群新增項目

顯示: