I (used to) write ugly management packs
AKA Recreating the ReSearch This! Management Pack – By Example
During MMS 2010 I was involved in a discussion where I mentioned that you don’t have to be a coder to write management packs. The ReSearch This! management pack was the example that I was citing as it’s a really simple management pack which just provides a way to interact with a community driven alert repository. It was written in the Operations Manager console, and just exported to use. A good friend of mine however pointed out that if I really want to make this a management pack I really needed to re-write it and pretty it up a bit. The core reasons to author management packs in the authoring console are as follows:
1) The Operations manager console uses GUIDs instead of names in places to make them unique.
2) The ability to use the Management Pack Best Practices Analyzer (MPBPA) is a big plus.
3) A good discussion on the functions of the authoring console is available at: http://nocentdocent.wordpress.com/2009/04/29/operations-manager-2007-r2-rc-authoring-console-review/
To do this I was going to need to learn more about some of the other tools in the OpsMgr arsenal – specifically the Authoring console and the Management Pack Best Practices Analyzer.
Alright, so it was time to roll up the sleeves and get to this. Here’s the steps used to recreate the ReSearch This! management pack in the authoring console:
1) Install the OpsMgr authoring console from the installation media located in the AuthoringConsole directory on the media under the appropriate folder for the platform (AMD64 or i386)
2) Create a new empty management pack – in this case the name is SystemCenterCentralReSearchThis.
3) Provide name name and description for the new management pack as shown below. This is the display name which will be used, and throughout while many of the fields are optional it is recommended to provide the information as these will may be relevant when we use the BPA to assess the management pack.
4) Provide a version number for the management pack on the general tab for the properties of the management pack.
5) The first step taken was to re-create the new views which had been added in the last version of the management pack which was done within Presentation / Views.
6) Next configure the properties of the folder (it would have been a good idea to add the description information as well but I missed this the first time).
7) On the configuration tab, browse for a type to use.
8) For this example we chose the Microsoft.SystemCenter.UrlViewType as that displays the content of a URL which is the function of these particular views.
9) What’s the fun of creating a management pack without cutting through a bit of XML so the next step was to make a change in the file so that it would direct to the correct URL – sample shown below.
10) Next we chose the folder to store this view in as shown below (the top level folder for the ReSearch This management pack had not been created at this point so this was actually the incorrect location to store the new views I was creating).
11) On the Options tab verified that the view was both enabled and visible.
12) Used this process to create each of the different views required within the management pack. There were issues here which I found later with where I had put these views, but for now at least the views existed.
14) On the general tab we specify the ID, Name, and Description for the ReSearch This! task.
15) The task syntax shows the name of the application being run (iexplore.exe) and the parameter is the URL to browse with the addition of $Name$ with is the parameter to pass the alert name. No working directory is required, and the option to display output when the task is run should not be checked.
16) The same step was taken to create the ShareThis task but it only specifies a different URL of Http://www.systemcentercentral.com/sharethis/sharethis.aspx for the sharing functionality. At this point I was hoping to have all of the pieces of this management pack functional – the views, and the two tasks which are included. So it was time to run the best practices analysis and see what it had to say. This is available under Tools / Best Practice Analysis.
17) As you can see below, it didn’t show up quite as spotless as I had been hoping. One error, and five warnings.
18) To fix the error I went back to the properties of the management pack, and filled in the Product Knowledge as shown below.
19) Next I re-ran the BPA to see what was left – my error was gone and now it was down to finding and fixing the five warnings. The warnings came from the views which I had created, as I had not specified the Description (Optional) section of the view itself. Resolved this by adding information to the description field as shown below for each of the five different views.
20) Resulting in a clean bill of health from the MPBPA!
21) Once the management pack was imported I did some testing and found two issues:
- The views appeared in the top level folder as opposed to a sub-folder for the ReSearch This management pack.
- The tasks were not functional as I had missed an option that needed to be configured on them.
22) So I re-cracked the management pack with the authoring console and created a new folder as shown below to hold the ReSearch This views.
23) And placed each of the five views I had created into this folder as shown below.
24) The end result looked like this where there is a SystemCenterCentralReSearchThis.Views folder with each view stored within it.
25) Next I changed the options on the two tasks which I had created to set them to a category of Alert from the default category of MonitoringObject.
26) Re-ran the MPBPA and verified that all was still green, deleted the management pack from the OpsMgr environment and re-imported it and then re-tested. With the changes identified the management pack was now functional.
The OpsMgr authoring console is not as intuitive as the Operations manager console for management pack authoring but it does add some heavy duty functionality which makes it worth while. I don’t claim to be an MP authoring guru, but going through this exercise has shown me some of the real benefits to the authoring console and I plan on using it going forward so I can stop developing ugly management packs.
Good reference links:
http://ianblythmanagement.wordpress.com/2008/07/10/authoring-console-quick-tips/ – Authoring console quick tips
http://www.systemcentercentral.com/BlogDetails/tabid/143/IndexID/68387/Default.aspx – Retargeting with the Authoring console
http://nocentdocent.wordpress.com/2009/05/01/opsmgr-r2-authoring-console-business-hours-monitor/ – Authoring console to create a business hours monitor
Summary: The authoring console and BPA are really powerful tools and while they may initially seem a little tough to tackle they aren’t as fearsome after spending some time with them.