View DPM Protection Groups in Operations Manager 

Posted by David Sunday, January 31, 2010 10:00:00 PM
Rate this Content 0 Votes

I like using Operations Manager as a central console for DPM but there a few limitations of the current DPM management pack that prevent me from using Operations Manager as much as would like.  This doesn't stop me though as by using PowerShell it is not difficult to get far more information into Operations Manager.  The first thing I wanted was all my protection groups across all my DPM servers listed; here's how I did it.

Note:  This will only work in Operations Manager 2007 R2 as it relies on the PowerShell discovery module.

First you will need to make sure you have the authoring console installed, if not download it from here http://www.microsoft.com/downloads/details.aspx?FamilyID=9104af8b-ff87-45a1-81cd-b73e6f6b51f0&displaylang=en.

Once installed, open the authoring console and create a new management pack using the Empty Management Pack template with a name of your choosing and then save it.  I named mine SCDPMOnline.DPM2007.Extra so the saved file is SCDPMOnline.DPM2007.Extra.xml.  Now we have an empty management pack that we can create a new protection group class in and a discovery rule to populate the class.

As there is an existing DPM management pack, we'll use it as a reference MP.  So, with the authoring console open, select File -> Management Pack Properties and then click the References tab.  Click the Add Reference... button, then navigate and select the Microsoft.Windows.SystemCenterDPM.mp file (this MP can be downloaded through the Operations Manager console or at the online MP library).  You may get prompted with a question asking if you want to add the path of the MP to your reference paths, if so click Yes.  Your reference MP list should now look like this, now click OK.

MP References

Now, to create the new class open the Service Model pane in the authoring console and select Classes in the tree.  Click New in the Actions menu on the right and select Custom Class... .  A new window will open asking you to enter a unique identifier; it will already be pre-populated with the name of the management pack so in my case it will be SCDPMOnline.DPM2007.Extra.  As this is going to be a class containing DPM Protection Groups, I am naming mine SCDPMOnline.DPM2007.Extra.ProtectionGroups.  Click OK to open the properties of the new class.

Select a base class of System.LogicalEntity and enter a relevant display name for the class, like Protection Groups.  Also, under the Attributes heading change Accessibility to Public.

MP Class General Properties

Now click the Properties tab, right click in the left column and select Add Property, enter a unique identifier of ProtectionGroup and click OK.  Repeat the step and add another property with a unique identifier of Compression.  Now select the ProtectionGroup property and place a check next to Key.  Click OK.

MP Properties

Now select Relationships in the Service Model tree.  Select New -> Custom Class... from the Actions menu and enter a unique identifier of PSHostsPG so in my case the full name is SCDPMOnline.DPM2007.Extra.PSHostsPG.  When the Relationship properties window opens, select a Base Relationship of System.Hosting, a Source Class of Microsoft.Windows.SystemCenterDPM.ProductionServer and set the Target Class as the class we just created, SCDPMOnline.DPM2007.Extra.ProtectionGroups.  Now give your relationship a name, something like "PS Hosts PG", and set the Accessibility attribute to Public.  Click OK.

PSHostsPG Relationship

Now we have a relationship in place, go back into the properties of our newly created class and check that the Hosted attribute is now checked.

MP Hosted

That's it, our new class is done.  Now we need to create a new discovery rule to populate the new class with an object for each protection group.  So still in the authoring console, open the Health Model pane and select Discoveries from the Health Model tree.  Select New -> Custom Discovery... from the Actions menu and enter a unique identifier for the discovery, mine is SCDPMOnline.DPM2007.Extra.DiscoverDPMProtectionGroups.  Now enter a friendly display name and set the Target to Microsoft.Windows.SystemCenterDPM.DPMServer as out protection group information is stored on the DPM servers.

Discovery General Properites

Now click the Discovered Classes tab and click the Add button for the "Discovered Classes and their attributes:" field.  Click Add discovered type... and select the new class created earlier, then click Add again and select <class name> -> All properties.

MP Discovered Classes

Now select the Configuration tab and click Browse for a type... .  Highlight the Microsoft.Windows.TimedPowerShell.DiscoveryProvider, enter a Module ID and click OK.

PowerShell Module

Here is where we put the PowerShell script to discover our DPM protection groups.  Click Edit... and update the values in the following tags:

  • IntervalSeconds:  3600
  • SyncTime:  blank (<SyncTime></SyncTime>)
  • ScriptName:  DiscoverProtectionGroups.ps1
  • TimeoutSeconds:  300

Within the ScriptBody tags, delete whatever is already there and paste the following script.

Note:  If you have not named your class SCDPMOnline.DPM2007.Extra do a find and replace on this script to replace every instance of my class name with yours.

param ([string] $DPMServerName, $Target, $Element)

$momapi = new-object -comObject "MOM.ScriptAPI"

$momapi.LogScriptEvent("SCDPMOnline.DPM2007.Extra", 100, 4, "Script Started: $DPMServerName, $Target, $Element, $Domain")

$discData = $momapi.CreateDiscoveryData(0, $Element, $Target)

$dpmserver = connect-dpmserver $DPMServerName
if(!$dpmserver)
{
$momapi.LogScriptEvent("SCDPMOnline.DPM2007.Extra", 5150, 4, "Unable to connect to $dpmservername")
exit 1
}

$PGList = @(Get-ProtectionGroup $DPMServerName)
if($PGList.Count -lt 1)
{
$momapi.LogScriptEvent("SCDPMOnline.DPM2007.Extra", 5150, 4, "DPM Server has no Protection Groups.")
exit 1
}

foreach ($PG in $PGList)
{
$PGCompression = $PG.Performance.Split(" ")[2]
$Instance = $discData.CreateClassInstance("$MPElement[Name='SCDPMOnline.DPM2007.Extra.ProtectionGroup']$")
$Instance.AddProperty("$MPElement[Name='Windows!Microsoft.Windows.Computer']/PrincipalName$", $DPMServerName)
$Instance.AddProperty("$MPElement[Name='System!System.Entity']/DisplayName$", $($PG.FriendlyName))
$Instance.AddProperty("$MPElement[Name='SCDPMOnline.DPM2007.Extra.ProtectionGroups']/ProtectionGroup$", $($PG.FriendlyName))
$Instance.AddProperty("$MPElement[Name='SCDPMOnline.DPM2007.Extra.ProtectionGroups']/Compression$", $PGCompression)
$Instance.AddProperty("$MPElement[Name='MicrosoftWindowsSystemCenterDPM!Microsoft.Windows.SystemCenterDPM.ProductionServer']/ServerNameLong$", $DPMServerName)
$discData.AddInstance($Instance)
}

$discData

disconnect-dpmserver $DPMServerName

$momapi.LogScriptEvent("SCDPMOnline.DPM2007.Extra", 5150, 4, "Script Complete")
We now need to add a bit more information to the discovery configuration.  So still in the notepad window, we need to add a couple more tags as below.
  • <SnapIns></SnapIns>
  • <Parameters></Parameters>

Within the SnapIns tag we need to add the DPM Management Shell SnapIn and within the Parameters tag we need to specify the parameters passed to the script like this.  These tags sit in the order below and in between the ScriptBody and TimeoutSeconds tags.  It's very important that the tags are placed in the correct location.

<SnapIns>
    <SnapIn>Microsoft.DataProtectionManager.PowerShell</SnapIn>
</SnapIns>
<Parameters>
    <Parameter>
        <Name>DPMServerName</Name>
        <Value>$Target/Host/Property[Type="Windows!Microsoft.Windows.Computer"]/PrincipalName$</Value>
    </Parameter>
    <Parameter>
        <Name>Target</Name>
        <Value>$Target/Id$</Value>
    </Parameter>
    <Parameter>
        <Name>Element</Name>
        <Value>$MPElement$</Value>
    </Parameter>
</Parameters>

Your completed configuration file should look like this.

That's the discovery done; you can now click OK and save your management pack.  The last thing we need to do before we can import out MP into Operations Manager is to add a view so we can see all our protection groups.

Still within the authoring console select the Presentation pane and ten select the Folder/Folder Items view from the Presentation tree.  Select New -> Folder... from the Actions menu and give the new folder a unique ID like SCDPMOnline.DPM2007.Extra.DPMExtra.  When the properties window opens for the new folder, give it nice friendly name like DPM Extra.

MP Folder

Now click the Folder tab and place the green check next to the Microsoft.SystemCenter.Monitoring.ViewFolder.Root item, then click OK.  This makes the new folder visible in Operations Manager.

MP Folder Location

Now we can create the new view containing the protection groups within the new folder.  Select Views from the Presentation tree the select New -> State View from the Actions menu.  Update the element ID to a more suitable name, like SCDPMOnline.DPM2007.Extra.StateView and enter a display name of Protection Groups.  Under Target, select the new class created and under Category select Discovery.  Click Finish.

PG State View General

Now expand the Microsoft.SystemCenter.Monitoring.ViewFolder.Root and you'll find the new view you just created.  Double click the view to open the properties and select the Folder tab.  Uncheck the green mark and place it next the new folder,  SCDPMOnline.DPM2007.Extra.DPMExtra.

PG State View Folder

Finally, select the Options tab and change the Accessibility to Public.

PG State View Options

Click OK and save your MP.  Now it's ready to be imported into Operations Manager! 

Once it's imported into Operations Manager, give it few minutes or maybe more depending on your environment and you'll see all your protection groups appear in the Protection Group view.

Operations Manager

Your protection group objects will remain in an unmonitored state as we haven't created any monitors but feel free to add a monitor or two if you so wish :-)

As I had to make the MP to put this guide together, I have made it available for you to download if you want, just click here.

What I particularly like about this is that if you have an Operations Manager agent installed on each DPM server you will have a central list of all your protection groups.  For dealing with very large DPM environments lie I do, it makes it very convenient to have all my DPM data in one place.

Enjoy!

 

If you would like this as a PDF to download, please visit the download page.  

 

MVP  
David Allen
MVP System Center Operations Manager
 
Email David Allen at SCDPMOnline  Follow David on Facebook  David Allen on LinkedIn  RSS SCDPMOnline Articles  Follow David on Twitter  PlayStation Network
Share This Using Popular Bookmarking Services
Copyright 2010 SCDPMOnline.org
You must sign in to this site to post comments.

Site Map | Printable View | © 2008 - 2010 SCDPM Online

Locations of visitors to this page

Powered by mojoPortal | HTML 5 | CSS | Design by styleshout