mardi 14 avril 2009

Listing all the performance collection rules in a management group

function GetPerfCounterName ([String] $configuration)
{

$config = [xml] ("" + $configuration + "")

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

}

function GetFrequency ([String] $configuration)
{

$config = [xml] ("" + $configuration + "")

$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"

The write action column contains information about where the perf counter is written.

WriteToDB or CollectionPerformanceData - write to the operational DB

WriteToDW or CollectPerfDataWarehouse - write to the data warehouse

WC - This is used to storing baseline data for a perf counter into the operational DB.

In order to run this script, you will need to open the OpsMgr Command Shell and then just paste in the script.

Aucun commentaire:

Enregistrer un commentaire