In the first part of this series we got our toolset setup so that we can write our own MP, created a root folder and added a state view to duplicate the Hyper-V Server Role state view.
Now it's time to start adding our own extensions to the base Hyper-V MP, keep in mind that what I'm doing here will work with any management pack, including the BridgeWays MPs where we may be exposing data but only consuming it through rules and you want to add a monitor.
So open up the Authoring Console and goto the Health Model frame. You'll see that we have the option to add Discoveries (we don't need these right now because the base Hyper-V MP is doing this for us), Monitors, Rules, Service Levels, etc.
Let's create a new monitor:
- Right-Click the view frame and select New->Windows Performance->Static Threshold->Average Threshold to create a new monitor that will take the average of a series of polls and determine Health/Error state from that average value
- Provide a new name, I'm going to build an alert for the number of Virtual Machines being reported as in a critical state, so my name is VMsCritical
- Give the monitor a display name "Virtual Machines are Critical"
- Specify the target by clicking the ellipses, selecting list and finding hyper. I set the target to Microsoft.Windows.HyperV.ServerRole so that the monitor will run against any Hyper-V Server
- Set the Parent Monitor to be System.Health.PerformanceState. This is because I feel VMs in a critical state is a resource issue causing bad performance, it's not necessarily an Availability issue because the VMs are running.
- Click Next
- Now, we set the object we're going to monitor. You can either hit the Select button and search for the appropriate perfmon counter through the dialog that pops up or enter the data directly. For this counter it is: Object = Hyper-V Virtual Machine Health Summary, Counter = Health Critical, Instance is blank.
- Set an appropriate interval for the monitor, 5 minutes is the lowest you should go.
- Click Next
- Set our threshold, I use 1 because I want to know if even a single VM is critical
- Set our number of samples, I use 2 if a VM goes critical and then clears the next poll... I'm fine with that, the problem was a blip.
- Click finish and we're almost done.
We've created the base monitor, now we just need to do a little tweaking to make it be everything we want it to be. To finish things off, select the monitor and click properties.
- Goto to the Health Tab and change the Over Threshold Health state to be Critical, I do this because I view VMS being critical as a Critical alarm.
- Click on the Alerting tab and select Generate alerts for this monitor, you can also tweak the priority and severity which helps you sort alerts in custom alert views where you may only want to see Critical alerts shown.
- Click on the Options tab and change Accessibility to "Public" so that you can make future MPs that extend this MP and people can add Diagnostic and Recovery tasks to the monitor without having to be part of this MP directly.
- Click on Product Knowledge, Edit and this will launch Word, if you have it and visual studio installed, so you can create a KB article.
- Goto the word document that launched and add some knowledge base information about the monitor, why it would fire, and how to fix it.
Now that we've done that, save your MP. Import the new version into SCOM and see how the monitor shows up under the Performance
Repeat this process to add any additional monitors you may wish to have.