Welcome to MSDN Blogs Sign in | Join | Help

Listing all the performance collection rules in a management group

Performance monitors will look at at performance counter value and change state when a particular condition is detected. However if you want to collect performance counters for viewing in the console or reporting, you need to create a performance collection rule. 

Here is sample script I put together to show what performance rules are present, and some details about each rule as as collection frequency, the perf conter name, and where the data is written.

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"

 

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.

Published Tuesday, August 07, 2007 2:33 AM by Boris Yanushpolsky
Filed under:

Comment Notification

If you would like to receive an email when updates are made to this post, please register here

Subscribe to this post's comments using RSS

Comments

# MSDN Blog Postings &raquo; Similar script but for perf collection rules

# re: Listing all the performance collection rules in a management group

Sunday, October 14, 2007 11:28 AM by William Gregoire

For a Powershell newbie...how would I run this from the command line?

# re: Listing all the performance collection rules in a management group

Thursday, October 18, 2007 11:48 AM by Daniele Muscetta

For any new COLLECTION RULE you create, do you get it automatically written to BOTH the OpsDB AND the datawarehouse ?

# re: Listing all the performance collection rules in a management group

Thursday, October 18, 2007 12:54 PM by Zied

Thanks,

Good JOB...

Can i have more Scripts? Please...

Ciao

# re: Listing all the performance collection rules in a management group

Monday, April 21, 2008 7:22 AM by Igor

Hi Boris!

Thanks for this blog. I have a question.

Is it possible to get collected performance data using the Operation Manager SDK or it is possible to get them only just by querying Operation Manager DB directly?

# re: Listing all the performance collection rules in a management group

Thursday, May 21, 2009 3:43 PM by Sylvain Groulx

Hi,

Same question again. How can I optain the performance data from MOM? Is the actual SDK providing with such feature?

Thank you

# re: Listing all the performance collection rules in a management group

Sunday, May 24, 2009 11:25 AM by Boris Yanushpolsky

You can definitely get the data using the SDK. I suggest you check out the MSDN docs:

http://msdn.microsoft.com/en-us/library/microsoft.enterprisemanagement.managementgroup.getmonitoringperformancedata.aspx

Leave a Comment

(required) 
required 
(required) 

  
Enter Code Here: Required
 
Page view tracker