Blog

Nest Thermostat monitoring pack: Part 3: Create the mp

This blog post is part of a series check out the other posts in this series:

The Nest thermostat monitoring pack is in general part of a “monitor your home with scom” series which can be found here: http://scug.be/dieter/2014/02/19/monitor-your-home-with-scom/

downloadbuttonfertig11.jpg

Download the MP I’ve created here: http://scug.be/dieter/?p=1204

Now that we have discussed how to get the data from the Nest website via an api call into our dbase where we were able to get the data via PowerShell into a property bag. It’s now time to get SCOM working with this data.

I’m gathering a sample of the dbase every 5 minutes and the dbase itself is filled with data only when there was a call home from the device to the Nest website. As some of you will probably already know it’s not possible to use a PowerShell script to populate a performance rule in the console itself. You need to have a vbs. In fact it’s not a good idea at all to create a management pack in the console as it will be filled with GUID’s and such.

I’ve used the SCOM 2007 authoring console for quite a long time and am still using it but the biggest disadvantage is the fact it cannot interpret SCOM 2012 mp’s. If you create a MP with the authoring console it will work on both SCOM 2007 and SCOM 2012. But if you try to load a scom 2012 mp into the authoring console you’ll get a schema mismatch because it just can’t cope with the new schema. This makes it impossible to create the mp in the authoring console, load it in the SCOM 2012 management group, make minor modifications and then load it back into the console…

Well then you should use Visual Studio Authoring Extensions… True… But I don’t know Visual Studio. It’s still on my to do list but hey there are many things in there.

So for now I’ve used another great tool: Silect MP Author which is freely available. I made the core rules in there to get the PowerShell performance collection rule in there and then made view modifications and such in the console itself. Ok it’s not pretty but it’s just to showcase the possibilities of SCOM and I plan to integrate this bit into a larger “Monitor your home” mp which I probably rebuild from scratch using VSAE.

So enough chatting. Let’s create this performance rules to get the data we have in our dbase via PowerShell into our management group.

First things first. Download the free Silect MP author tool here: https://bridgeways.com/mp-author-landing-page

Install the tool and open MP Author

clip_image001

Create a new management pack:

clip_image002

Give it a proper name:

clip_image003

Save in a location (I’ll do it by default on my SkyDrive so I can work on my project anytime from anywhere)

clip_image004

Leave the references as is

clip_image005

Choose Empty

clip_image006

Create

clip_image007

Now create a target for our watcher node which is identified by reg key: HKLM\software\nest\watchernode

clip_image008

Right click target and choose group

clip_image009

Check for a server where the regkey is located on. It’s easier to browse than to type in the key.

clip_image010

Supply credentials.

clip_image011

and locate the key: HKLM\Software\nest\watchernode

clip_image012

Give the attribute a name

clip_image013

identify the discovery

clip_image014

and we only want to check whether it exists. We don’t care about the content.

clip_image015

We run this every day.

clip_image016

Create.

clip_image017

Next thing we need to do is create the group of watcher nodes

clip_image018

Fill in the desired expression and click next (note this changed in the final mp I’ve uploaded)

clip_image019

Create the group

clip_image020

So now we need to create the performance rule with our PowerShell we tested earlier on:

clip_image021

Copy paste the script in the script body window.

Make sure to change the credentials in the connection string as discussed in part 2 of this blog series.

clip_image022

Fill in the location variable

clip_image023

Identify the performance rule

clip_image024

Map the content of the property bags to instance and value which scom can use to create the performance dataset.

clip_image025

Leave the schedule as is (more on this later)

clip_image026

Create the script

clip_image027

So now we have a script to get humidity in our environment, the value that is… The same process needs to be followed to get current temperature, target temperature and heating status in as well.

I already did it in the mp I’ve uploaded but I really wanted to show you the ease of use of mpauthor. I plan to do a more thorough blog series on this great tool but this is not in scope of this blog series of course.

So now the scheduler part… We want to collect data more frequent than once a day of course. Turns out it’s not possible to change this in MP author nor in the console after you have loaded the mp. You need to change the xml code itself.

The collection rule is only configured in the mp as daily:

clip_image028

You need to change this to:

clip_image029

And you need to do this for all rules you have created of course.

Note: Like I said before this is just a small showcase of how the management pack is constructed. The management pack which is attached here is slightly different and has some config done in the console in there so it’s not as clean as ID’s concerned. Again I’m planning to rebuild a full mp when I have all my different monitoring aspects in place.

If you want to use the management pack I have created make sure to change the connection string values to your dbase location username and password

So all left to do now is load the MP in your management group and check whether everything is running.

Enough talk, let’s build
Something together.