How to Create a SCOM MP using Fragments

Hello All, I have written my first blog about alert creation using SCOM and provided an MP fragment in that.

After publishing that, I got a suggestion from Stoyan Chalakov to write a blog that how we can create a MP using an MP fragment so we can utilize this.
Indeed, this is very awesome and Inspired me to write on it (How to) in my second (This) blog.
 
So Let’s get started……….
First we need to do some downloading, And the very stuff is Visual Studio. We could download it from below link
https://visualstudio.microsoft.com/downloads/
Select Community version on clicking Free Download. Once you click it would fire to download.

Now we have VsInstaller in our Downloads folder run this and select the workloads for Visual Studio. And it should be Universal Windows Platform development for us.

Now hold on and let them do their work…….
Can you see this Launch and Modify buttons? Yes, I could see……
Hurrah!!!! Visual Studio downloaded successfully on your machine now time to launch. So what are you waiting to launch.

HOLD ON, we also need to download Visual Studio Authoring Extensions to create MP using Visual Studio.
Again open your browser and copy the below link to download this System Center Add-on for Visual Studio.
https://www.microsoft.com/en-in/download/details.aspx?id=30169
Now how to download,
Step 1: – Click on Download button.

Step 2: –  Select Addon (VSAE authoring console for VS) as per your OS version either 64 or 86(for 32-bit OS).

After downloading this, run the MSI to install this add-on in your machine.
Note: – Make sure that when you run this VASE msi to install in machine, that at that time Visual Studio should not be running.
 
All set…. Finally, now get your hands dirty to cook an MP using a fragment.
Open Visual Studio and select File -> New -> Project

In the left most side, we could see Management Pack option click on it then click Operations Manager underneath it.
And second last step is to select SCOM version (I am going with SCOM 2012 R2) and give the name of your MP (My is Alert.Rule.Blog) and OK.
 
Now we have our solution ready to edit.

Now time to add Fragment in MP, since we have the alert rule fragment I am adding this under a rule name folder.
Why, I am doing this this using folder wise hierarchy is best practice because we can edit next time easily by opening folder only and we do not need to dig into the whole MP.
How to create a folder: – Right click on Alert.Rule.Blog and you could see an option with create a new folder name. Simple!!!!!!!!!

Now the next question that’s on everyone’s mind is how we can the add fragment under this Rules folder. So here we go: –
Right click Rules, and Add > Existing item
Find the fragment named “Alert Rule Mp Fragment for Disk” and add it. Or you could  add another fragment. I am taking my last blog fragment here.
Select Alert Rule Mp Fragment for Disk in solution explorer to display the XML
 
And now replace ##Frequency## as your time of sample (in seconds) and ##Value## as a threshold (in percent like if 10% then only type 10) on which you want to generate an alert.
 
After everything Build the MP.   Build -> Build Solution

 
Now import or Deploy the management pack in your SCOM and enjoy alerting with a Rule and your MP……………
 
Happy MP creation, Keep SCOMing 🙂
Thanks for reading.
Gourav Kumar