Authoring Management Packs – the fast and easy way, using Visual Studio???


<!--[if lt IE 9]>

<![endif]-->


Comments (26)

  1. Chris Gibson says:

    Amazing, This is exactly what I’ve been after. Complex discoveries is always something that has caused me trouble (Script discoveries – creating the right king of class and Discovering new classes based on properties of other classes – i.e. DB name). If you post code for those two, that would be awesome

    1. Kevin Holman says:

      Help me understand exactly what you are looking for. Not sure I follow you Chris.

      1. Chris Gibson says:

        Sorry the delay. If I discover a server, which has a property of “DBName” I would like to able to use the value of this property to find the DB and populate a group. So if in the future the DB gets changes, scom can just discover it. Does that make sense?

        1. Kevin Holman says:

          No – I am afraid I am not following you.

          What are you trying to accomplish at the end of the day?

  2. rob1974 says:

    Hi Kevin,

    Great initiative, allthough i wonder why you’ve chosen the “mp fragment” way and not create a “template” from within Visual studio itself that contains all the snippets in it. It would make the creation of mp’s even easier with the “snippet data” item.

    1. Kevin Holman says:

      Hi Rob,

      That’s certainly possible – and I wrote about those here: https://blogs.technet.microsoft.com/kevinholman/2014/01/21/how-to-use-snippets-in-vsae-to-write-lots-of-workflows-quickly/ Anyone could take these base fragments, and create their own snippet templates from them using find and replace for the text strings pretty easily. I was trying to make this as simple as possible, while focusing on creating a large library of fragments first. If a customer decides they want to create a large amount of workflows, they can always convert one of them into a snippet. I expect customers to modify these fragments into their own standards and preferred designs as they progress. I see snippets as a “next step” when they have a lot of something to write. If I only have a few rules, or a few monitors, or a single class, I’d rather work with fragments, myself.

      1. rob1974 says:

        actually you can just use the same method with snippets (add existing item > select all files and add the .snippettemplate). Now instead of the replace action you need to add a new item “snippet data” and choose the template you’ve just added. I might even call it the faster and easier way 🙂

        1. rob1974 says:

          Is there an easy way to send you fragments/snippets? Here’s my 2property.serviceclass.discovery.templatesnippet:

          Discovery

          $Target/Property[Type=”#alias(‘Microsoft.Windows.Library’)#!Microsoft.Windows.Computer”]/PrincipalName$
          #text(‘servicename’)#
          86400
          $MPElement[Name=”Custom.Service.#text(‘serviceclassname’)#”]$

          $MPElement[Name=”#alias(‘Microsoft.Windows.Library’)#!Microsoft.Windows.Computer”]/PrincipalName$
          $Target/Property[Type=”#alias(‘Microsoft.Windows.Library’)#!Microsoft.Windows.Computer”]/PrincipalName$

          $MPElement[Name=”#alias(‘System.Library’)#!System.Entity”]/DisplayName$
          #text(‘serviceclassdisplayname’)# ($Target/Property[Type=”#alias(‘Microsoft.Windows.Library’)#!Microsoft.Windows.Computer”]/NetbiosComputerName$)

          $MPElement[Name=”Custom.Service.#text(‘serviceclassname’)#”]/Servername$
          $Target/Property[Type=”#alias(‘Microsoft.Windows.Library’)#!Microsoft.Windows.Computer”]/PrincipalName$

          $MPElement[Name=”Custom.Service.#text(‘serviceclassname’)#”]/Servicename$
          #text(‘servicename’)#

          Custom #text(‘serviceclassdisplayname’)# Class Discovery
          Class discovery for #text(‘serviceclassdisplayname’)#. Discovers the #text(‘servicename’)# service on windows computers

          Custom.Service.#text(‘serviceclassname’)# Class

          Servername

          Servicename

          1. rob1974 says:

            well that’s not easy as it removes quite some things 🙂

    2. Hi!

      I did something like this actually. And released it last week. 🙂
      If you look at the site http://mpdev.mattew.se there is a number of guides there and an extension to Visual Studio that gives you a number of snippets to use. These are “Visual studio snippets”, so you right-click and inserts the code. Then you tab your way through a number of fields and enter your values.

      Me and some of my customers have been using this for almost a year and it’s really quick to use.
      So please check it out to see if it fits your needs. 🙂

      Not all guides are up yet, and there’s more snippets coming. But it’s a start.
      Oh, forgot to say that it’s free. 🙂

      1. rob1974 says:

        not the “snippets” i was looking for, but very cool you’ve installed it in visualstudio like this.

      2. Andres Naranjo says:

        Mattias,
        Your snippets built into Visual Studio like this are pretty awesome. Great job!
        I wish you had Monitors too!

  3. sepeck says:

    The challenge with VSAE is Visual Studio. Visual Studio and it’s cryptic errors are such a huge barrier in and of itself. People who work with it often have adjusted to it, usually within a week or two. Also the flexibility and power of Visual Studio contribute to this. Property windows not being the ‘right’ property windows unless you have clicked the right thing, if you detach a window and ‘lose it’ recovering it is insanely hard if you have no clue. Before firing up VSAE, I suggest people take a basic Level 100 coding course on MS Virtual Academy and just focus on learning Visual Studio. I did a level 100 C# class. It helped a ton when I got to take the MP Authoring WorkshopPLUS course last month because I was able to focus on mostly the VSAE stuff and the few little things I missed in the VS interface previously. Just a suggestion for anyone new to VSAE.

    https://mva.microsoft.com/en-US/training-courses/c-fundamentals-for-absolute-beginners-16169

  4. sepeck says:

    Alright. I figured I would report back. This snippet approach rocks.

    I had an app with 16 services they wanted monitored, so a pretty straight forward one. Having just attended the WorkshopPLUS course I was working my way through the example labs and such to create my MP. This came out and I decided to give it a try. Fast. It’s also helping me better understand how this whole thing works. I may be able to understand that template method now. Of course I have this backlog of requests to knock out first. A lot of ours has to do with Process monitors so I will have to look at what I did in the past and adapt.

    Thanks for the resource.

  5. Amazing. I’ve been using VSAE for about 2 years to create so many MPs and after some while I found that Templates are not useful enough. Then I started using MP fragments and they are great. However, there are some difficulties using VSAE such as finding errors, debugging, and analyzing the code. Moreover, there are some tools for analyzing, simulating or Cookdown checking which are not usable. Simulating specifically is a good approach if we could use it for finding our errors.
    Thanks again for your great job.

  6. User says:

    The “easy series” needs to exist for SCSM!

  7. Just awesome Kevin. Keep up de excellent work.

  8. John Austin says:

    FYI, there seems to be an issue with the “Monitor.TimedScript.PowerShell.SQLQuery.mpx” fragment. The ##ClassID## tag in the UnitMonitor section needs quotes around it, I believe.

    1. Kevin Holman says:

      You are correct – and I caught that recently – it will go into 1.7 which should be published today to include new goodies for you. Thanks for the feedback. Feel free to shoot me direct email as well!

  9. Jason Rydstrand says:

    You have an article on creating discoveries for monitoring dynamically named services, which is great. The question I have, is how to do this with VSAE instead of utilizing the Authoring console? (SCOM 2016)

  10. John Haggerty says:

    Hi Kevin,

    These are great! I am running into an instance were I need to use a timed 2 state PowerShell script monitor. I am using your “Monitor.TimedScript.PowerShell” MP fragment but I need it to do a couple extra things.

    First, I need to be able to define an overridable parameter that the script uses for the threshold.

    The other thing is, I’m saving a value in a property bag and would like to use it in the output or the alert description of the alert.

    I have tried making these changes myself without any luck. Your assistance would be greatly appreciated.

    1. I forgot to login before posting my last message.

  11. Iske says:

    Hi Kevin,

    Thanks for this amazing series of posts which really motivated me to use VSAE.
    I downloaded your samples and used “Class.And.Discovery.SNMP.Device.byOID.mpx” and was able to discover ou Cisco Switches. Now I’d like to add an additional property “serial number” to the Cisco class which gets populated by a snmp probe .
    Any idea what I need to add in your sample ?

  12. Leif Rønnow says:

    I’ve a question regarding what Class I need to use in this scenario: I need to monitor an endpoint at a Vendor we are coorperating with. The endpoint gives me how many items that are in a Queue(Powershell script). I want to create an alert if the Queue value is grather than %something% and a Healthstate based on the Queue value. I dont want to base it on a Computer class(Watcher node).

  13. Graham-LP says:

    Hi Kevin,

    Great Webinar held by Silect last week, and your presentation of MP fragments in MP Author was excellent, thanks again. Question re: importing the Monitor.Process.mpx to monitoring processes for an application MyApp which has multiple processes, however MyApp processA runs on serverA and MyApp processB runs on ServerB – same MyApp application. When using Discovery would it be feasible to have multiple processes monitors run on different servers in the same MP and the best way to achieve this with Discovery to ensure that the appropriate monitor for processA monitors only on MyApp serverA and monitor for processB only monitors MyApp serverB or would this require the 2 x process monitors to be split into separate MPs?

    1. Graham-LP says:

      Hi Kevin,

      Probably forget my last comment re: application MyApp which has multiple processes; I think my answer is to create an initial discovery, then perhaps separate WMIQuery discoveries looking for each process to be monitored targeting the initial Discovery, then create monitors targeted at each of the WMIQuery discoveries for each of the processes?

      However, (consider the same application is run on servers in a PAT environment, and on servers in a PROD environment) would it be possible to create a fragment that discovers an application by REG Key can also in the same discovery a search for particular domain, so that when creating an application MP (app.pat) servers that are in PAT (server.pat.com) environment populate the PAT groups created with Class.Group.ClassInstances.mpx Class.Group.WindowsComputers.mpx Class.Group.WindowsComputersAndHealthServiceWatchers.mpx, and then a second created application MP (app.prod) for servers that are in the PROD (server.prod.com) environment populate the PROD groups created with Class.Group.ClassInstances.mpx Class.Group.WindowsComputers.mpx Class.Group.WindowsComputersAndHealthServiceWatchers.mpx. This is to create and keep separate groups and State, Alert, and Perf views of PAT servers and PROD servers, instead of seeing all PAT and PROD servers in the same views that would occur with just a discovery of just the application REG key?

Skip to main content