As my first post, I would like to share my experience on creating a custom module in OpsMgr that will take a Powershell script and its parameters as its values, and run the script according to a schedule.
This module can then be selected as a data source module in a custom rule for a Powershell script to be tested or used.
An example of such rule will be posted later. (Creating a custom Powershell script based rule to find and alert on Live Maps in a non-healthy state)
The sealed management pack containing this custom module can be downloaded from here. This management pack is sealed so that other management packs can reference it as a library in order to be able to select the module when creating a custom rule.
Here is a summary on how this data source module was created and configured in the OpsMgr Authoring Console:
- The Configuration Schema was configured by following the exact same configuration as the Configuration Schema in the "Microsoft.Windows.PowershellPropertyBagTriggerOnlyProbe" probe action module.


- In Member Modules, the "Microsoft.Windows.PowershellPropertyBagTriggerOnlyProbe" probe action and "System.SimpleScheduler" data source modules were selected with the following IDs (Scheduler & Probe):
Probe was configured to run in response to Scheduler according to a schedule and have parameters that will accept values from a custom rule.
- Lastly, the data source module was saved and its management pack was then sealed (Take.A.Wei.MP.Demo.Library.MP), to allow referencing by other management packs as a library pack. Download.
With this custom module created, a custom rule can be created to collect the data from a Powershell script to a condition detection module that will send the data to a alert generating write action module for an alert to be generated and seen in the OpsMgr Operations Console.
Here are some examples on how this can be achieved (to be posted later):
- Creating a custom Powershell script based rule to find and alert on Live Maps in a non-healthy state
- Creating a custom Powershell script based rule to alert on agents without a failover management server in a management group
- Creating a custom Powershell script based rule to alert on agents without a failover management server in a management group
To use this custom module for a monitor, a custom monitor type will need to be created.
Note that separate workflows for each health state will have to be defined for the monitor type.
This module can be used as the data source module for the regular detection of the monitor type but an addition probe action module will have to be created for on demand detection.
Sources of Inspiration and Some Very Helpful References:
Sources of Inspiration and Some Very Helpful References:
- How to generate an alert directly from a script-based rule by Jonathan Almquist
Disclaimer:
All information on this blog is provided on an as-is basis with no warranties and for informational purposes only. Use at your own risk. The opinions and views expressed in this blog are those of the author and do not necessarily state or reflect those of my employer.
All information on this blog is provided on an as-is basis with no warranties and for informational purposes only. Use at your own risk. The opinions and views expressed in this blog are those of the author and do not necessarily state or reflect those of my employer.







No comments:
Post a Comment