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/
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
Create a new management pack:
Give it a proper name:
Save in a location (I’ll do it by default on my SkyDrive so I can work on my project anytime from anywhere)
Leave the references as is
Now create a target for our watcher node which is identified by reg key: HKLM\software\nest\watchernode
Right click target and choose group
Check for a server where the regkey is located on. It’s easier to browse than to type in the key.
and locate the key: HKLM\Software\nest\watchernode
Give the attribute a name
identify the discovery
and we only want to check whether it exists. We don’t care about the content.
We run this every day.
Next thing we need to do is create the group of watcher nodes
Fill in the desired expression and click next (note this changed in the final mp I’ve uploaded)
Create the group
So now we need to create the performance rule with our PowerShell we tested earlier on:
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.
Fill in the location variable
Identify the performance rule
Map the content of the property bags to instance and value which scom can use to create the performance dataset.
Leave the schedule as is (more on this later)
Create the script
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:
You need to change this to:
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.