Automating OpsMgr Part 12: Creating Performance Collection Rules

Written by Tao Yang

OpsMgrExntededIntroduction

This is the 12th instalment of the Automating OpsMgr series. Previously on this series:

From now on, I will start concentrating on creating various monitoring workflows (rules, monitors, template instances, etc) using the OpsMgrExtended module. I will dedicate at least 6-7 posts on this topic. Since OpsMgr is a monitoring solution, I am now getting to the core offering of this module – providing ways for OpsMgr professionals to automate the creation of their monitoring requirements. In this post, I will demonstrate a runbook utilising New-OMPerformanceCollectionRule activity from the OpsMgrExtended module, to create performance collection rules in OpsMgr.

Runbook New-PerfCollectionRule

In order to use this runbook, you firstly need to modify line 14 with the name of the SMA connection to your OpsMgr management group:

image

I have also hardcoded few other parameters in the runbook:

image

$MPName is the name of the unsealed MP where the rule is going to be saved to, and $Frequency is the interval in seconds on how often does this perf collection rule need to run. You also need to modify these 2 variables, especially the $MPName – the unsealed MP must exist in your management group already.

This runbook requires the following input parameters:

$RuleName – name of the perf collection rule

$RuleDisplayName – The display name of the perf collection rule

$CounterName – name of the perf counter you need to collect

$ObjectName – name of the object where the counter belongs to (i.e. memory, logical disk, etc.)

$InstanceName (optional) – name of the instance of the counter. if not specified, the rule will collect All Instances.

$ClassName – name of the OpsMgr monitoring class of which the perf collection rule is targeting

$RuleDisabled – Boolean variable (true or false). specify if the rule should be left disabled by default

Runbook execution result:

image

Rule configuration (from the console):

image

image

Accessing Perf data collected by this rule in a Perf view:

SNAGHTMLb5a869e

Conclusion

In this post, I have demonstrated how to use a runbook to create a performance collection rule in OpsMgr. In the next post, I will demonstrate how to create a 2-state performance monitor.

2 comments on “Automating OpsMgr Part 12: Creating Performance Collection Rules

  1. Pingback: NeWay Technologies – Weekly Newsletter #159 – August 6, 2015 | NeWay

  2. Pingback: NeWay Technologies – Weekly Newsletter #159 – August 7, 2015 | NeWay

Leave a Reply