Tips & Tricks for Creating Custom Management Packs for Microsoft System Center Operations ManagerMickey GoussetPrincipal ConsultantInfront Consulting Group
MGT306
Mickey [email protected]
@mickey_gousset
http://teamsystemrocks.com
http://almrocks.com
http://radiotfs.com
tinyurl.com/protfs
Agenda
Intro to Management Pack StructureTools for Getting The Job DoneBasic Tips & TricksAdvanced Tips & TricksExpert Tips & Tricks
Intro to Management Packs
Simply an XML fileUsed to add functionality into SCOMSealed vs. Unsealed
Management Pack Structure
Tools for Getting The Job Done
SCOM 2007 Authoring ToolSCOM 2012 Operations ConsoleVisio 2010 (via extension)Visual Studio 2010 (via extension)A Text Editor (I like Notepad++)
Basic Tips & Tricks
TargetingManagement Pack Design – One vs. ManyMP Version ControlSealed Management PacksDiscovery Scripts
Debugging ScriptsCustomizing Rules and Monitors
Running a rule during business Hours
TargetingYou want to monitor failed logon attempts on
Windows ComputersGOOD
Use Windows Operating System to target all Windows managed nodes (desktop and servers)Use Windows Server Operating System to target all Windows server managed nodes (all versions)Use Windows Server 2003 Operating System to target all Windows Server 2003 managed nodesUsed Windows Computer to target all windows computers (desktop and servers)
BADDon’t use Agent:
The monitor will not work for agent-less managed computers.The monitor will affect the health state of the Agent which is not what you want.
Don’t use Computer:Management packs for non windows management are likely to use computer as the base type for types such as Unix computer. The monitor that you just created will not work against non windows computers.The monitor will execute against all windows computers. Both clients and servers that are managed by OpsMgr.
Targeting – Operating System Model
Operating System
Windows Operating System
Windows Server Operating System
Windows Client Operating System
Windows Server 2003
Operating System
Windows Server 2008
Operating System
Windows XP Operating
System
Windows Vista Operating
System
Other Operating System
Inheritance
Management Pack Design – One vs. Many
MyCustomMP.xmlClassesDiscoveriesRulesMonitorsReports
MyCustomMP.Classes.xmlMyCustomMP.Discoveries.xmlMyCustomMP.Rules.xmlMyCustomMP.Monitors.xmlMyCustomMP.Reporting.xml
Management Pack Design – One vs. Many
MyCustomMP.Classes.mp
MyCustomMp.Discoveries.xmlMyCustomMp.Monitors.xml
A MP must be sealed to reference itHave to reseal MyCustomMP.Classes after each change
MP Version Control
MP Development is “development”Version Control allows you to track changesVersion Control Options
Microsoft Team Foundation ServerWorks well with new Visual Studio extensions
Other 3rd party VCS“Poor Man’s Version Control”
Basic Discovery Script‘Setup the objectsSet oAPi = CreateObject (“MOM.ScriptAPI”)Set oDiscoveryData = oAPI.CreateDiscoveryData(0,SourceId, ManagedEntityId)
‘Create Discovery InstanceSet oInstance = oDiscoveryData.CreateClassInstance(
“$MPElement[Name=‘ClassName’]$”)oInstance.AddProperty “$MPElement[Name=‘ClassName’]/Property1$, Value1oDiscoveryData.AddInstance oInstance
‘Return discovery dataoAPI.Return oDiscoveryData
SourceId and ManagedEntityId
SourceIdThe workflow ID$MPElement$
ManagedEntityIdThe base ID for the object the workflow is running against$Target/Id$
Discovery Scripts – Best Practices
Always return discovery data – even if nothing is discovered
This is how SCOM knows to delete previously discovered object instances
Always target as specifically as possible
Use oAPI.LogScriptEvent to help debug scripts
Running A Rule During Business Hours
Advanced Tips & Tricks
Advanced Authoring ConceptsCreating a Custom Data SourceCreating a Custom Unit Monitor
Advanced Authoring Concepts
Behind the scenes, everything is a workflowWorkflows are composed of four module types
Data Source
ProbeAction
Condition Detection
WriteAction
Does not take input, generates output based on external sources. Does not change object state.
One input and zero or one output streams. Changes object state. Always the last module in Rules and Recoveries.
One or more input streams, one output. No external sources and no state changes.
One input and one output; when triggered, generates output from external sources.
Advanced Authoring Concepts – Rules
One or more data sourcesZero or one condition detectionOne or more write actions
Data Source
Condition Detection
WriteAction
Creating a Custom Data Source
Creating a Custom Unit Monitor
Expert Tips & Tricks
CookdownOn Demand DetectionSupporting Agentless Monitoring
Cookdown – An Example – Part 1 Monitor: MyMP.Monitor.MyCustomMonitor1
Date Source: Simple.Schedul
er
Probe: MyCustomProb
e
Condition Detection: My Results
Filter
Monitor: MyMP.Monitor.MyCustomMonitor2
Date Source: MyCustomDa
taSource
Condition Detection:
Schedule Filter
Monitor: MyMP.Monitor.MyCustomAlertRule
Date Source: MyCustomDa
taSource
Condition Detection:
Consolidator
Write Action: Generate Alert
DataSource: MyCustomDataSource
Date Source: Simple.Schedul
er
Probe: MyCustomProb
e
Condition Detection: My Results
Filter
MyCustomMonitor1 has been configured with a probe so it can use on-demand detection
MyCustomMonitor2 is using a custom data sourcethat makes use of our probe. It also has a schedule filter configured
MyCustomAlertRule is collecting events using our custom data source, and only alerting if certain events show up in order
MyCustomDatasource is collecting events on a timer from a text log, and ignoring informational events
Cookdown – An Example – Part 2 Monitor: MyMP.Monitor.MyCustomMonitor1
Date Source: Simple.Schedul
er
Probe: MyCustomProb
e
Monitor: MyMP.Monitor.MyCustomMonitor2
Condition Detection:
Schedule Filter
Monitor: MyMP.Monitor.MyCustomAlertRule
Condition Detection:
Consolidator
Write Action: Generate Alert
Date Source: Simple.Schedul
er
Probe: MyCustomProb
e
Condition Detection: My Results
Filter
Date Source: Simple.Schedul
er
Probe: MyCustomProb
e
Condition Detection: My Results
Filter
Condition Detection: My Results
Filter
For each workflow, SCOM builds an execution chain. The first step is to resolve/expand all modules to their root definitions, and place them into the chain. So, all our instances of the custom data source are replaced with the modules that make up the data source. Each chain is analyzed, and each module’s input parameters submitted to a hash function. If module IDs and hash results are the same, that indicates duplicate modules that are candidates for cookdown.
Cookdown Workflow
Cooked Down Workflow
Date Source: Simple.Schedul
er
Probe: MyCustomProb
e
Condition Detection: My Results
Filter
Monitor: MyMP.Monitor.MyCustomMonitor1
Monitor: MyMP.Monitor.MyCustomMonitor2
Monitor: MyMP.Monitor.MyCustomAlertRule
Condition Detection:
Schedule Filter
Condition Detection:
Consolidator
Write Action: Generate Alert
Since the first three modules were all configured identically, they are cooked down and run once, with the output replayed to each consuming workflow
Cookdown Example
On Demand Detection
Allows the “Recalculate Health” button to work in Health ExplorerAllows health calculation when exiting maintenance modeCan only trigger a probe module, not a data source moduleBe care if you have many instances of a target class on one host
Agentless Monitoring
Module should have Remoting = True parameter setScripts should never use “localhost” or “.” for computer nameAttempt to use APIs in scripts that support remote execution
Summary
Intro to Management Pack StructureTools for Getting The Job Done
SCOM 2007 Authoring ToolSCOM 2012 Operations ConsoleVisio 2010 (via extension)Visual Studio 2010 (via extension)A Text Editor (I like Notepad++)
Summary – Cont.
Basic Tips & TricksTargetingManagement Pack Design – One vs. ManyMP Version ControlSealed Management PacksDiscovery Scripts
Debugging Scripts
Customizing Rules and Monitors
Running a rule during business Hours
Advanced Tips & TricksAdvanced Authoring ConceptsCreating a Custom Data SourceCreating a Custom Unit Monitor
Expert Tips & TricksCookdownOn Demand DetectionSupporting Agentless Monitoring
More InformationMP Dev Kit - http://msdn.microsoft.com/en-us/library/ee533840.aspxSCOM SDK - http://msdn.microsoft.com/en-us/library/hh329086.aspxMP Dev Documentation - http://social.technet.microsoft.com/wiki/contents/articles/tags/management+packs/default.aspx
Matthew Long- http://matthewlong.wordpress.com/Pete Zerger- http://www.systemcentercentral.com/Blogs/Community/tabid/119/controlType/ViewProfile/UserID/7/Default.aspxBrian Wren - http://blogs.technet.com/b/mpauthor/
Special Thanks To…
Matthew Long
Mickey [email protected]
@mickey_gousset
http://teamsystemrocks.com
http://almrocks.com
http://radiotfs.com
MGT Track Resources
DOWNLOAD System Center 2012 SP1 CTP
microsoft.com/systemcenter
#TEMGT306 DOWNLOAD System Center 2012 Evaluation
microsoft.com/systemcenterHands-On Labs
Talk to our Experts at the TLC
Resources
Connect. Share. Discuss.
http://europe.msteched.com
Learning
Microsoft Certification & Training Resources
www.microsoft.com/learning
TechNet
Resources for IT Professionals
http://microsoft.com/technet
Resources for Developers
http://microsoft.com/msdn
Evaluations
http://europe.msteched.com/sessions
Submit your evals online
© 2012 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or may be registered trademarks and/or trademarks in the U.S. and/or other countries.The information herein is for informational purposes only and represents the current view of Microsoft Corporation as of the date of this presentation. Because Microsoft must respond to changing market conditions, it should not be interpreted to
be a commitment on the part of Microsoft, and Microsoft cannot guarantee the accuracy of any information provided after the date of this presentation. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS
PRESENTATION.