I know what you are thinking. “Wait, what did he just say?”
Well, hear me out.
Over the years, there have been many tools that we have used to write MP’s. The SCOM UI Authoring tab, Notepad, XML Notepad, Notepad++, SCOM 2007R2 Authoring Console, Silect MP Author, and Visual Studio.
They all have tradeoffs. I’d argue the most powerful tool over the years that was “somewhat” user friendly was the SCOM 2007R2 authoring console. Once you learned the quirks, it was pretty good when you needed to make complex MP’s. But even it was far from perfect. And moving into SCOM 2012, now that the schema changed, using it becomes VERY challenging to update your existing MP’s. Silect’s MPAuthor (http://www.silect.com/mp-author) has stepped up in a big way to fill some of these gaps, and they have done a fantastic job of creating wizards that spit out MP’s that are useful, and relatively easy to author. But they don’t have a wizard for all scenarios, and they don’t offer a way to update the workflows using the same UI that created them, so you are back to XML at that point.
Visual Studio has a powerful plugin called VSAE (Visual Studio Authoring Extensions) https://www.microsoft.com/en-us/download/details.aspx?id=30169
The challenge with VSAE is unless you come from a developer background using Visual Studio, or you write management packs all day for a living, most people find it VERY daunting to use. Even with experience, I find adding certain module types VERY cumbersome to use. I find customers rarely use Visual Studio for authoring because of this.
I think that can change. I have been presenting a different method on using VSAE with my customers and it has resonated very well. The most powerful part of VSAE to me, is the ability to use Management Pack fragments.
A Management Pack fragment is simply a bit of XML, that contains all the “working parts” for a specific workflow…. Several authors have written about the power of fragments since VSAE launched, but the biggest gap I saw can be broken up into two major issues:
- Nobody provided a good “library” of workable MP fragments
- Nobody came up with a VERY simple method to reuse fragments quickly and easily
I hope to change that. I am presenting an MP fragment library for you to download, and a simple methodology to add fragments to a MP you wish to create. If you can do a FIND and REPLACE in notepad, you can use this.
What if I told you, in a few *minutes*, you could write a full Management Pack, that discovered an application dynamically, created views for the app, monitored for events and performance, monitored key services, and could even run your custom scripts against the app using VBScript or PowerShell?
I will be starting a blog series, which will include step by step examples of these fragments, and how to use them.
You can download the fragment library here from GitHub: https://github.com/thekevinholman/FragmentLibrary
This will be a step by step series. You really should go in order if you are just getting started, but it isn’t really required except for the first two parts. You can complete ALL of these in less than an hour, even for a first timer.
Part 1: Use VSAE to create a new Management Pack Project
Part 3: Use VSAE fragments to monitor a service
Part 4: Use VSAE fragments to create an alert generating event log rule
Part 5: Use VSAE fragments to create a performance collection rule
Part 6: Use VSAE fragments to add Alert, State, and Performance views to your MP
Part 7: Use VSAE fragments to add custom Groups to your MP
Part 8: Use VSAE fragments to create a Windows Performance Monitor with Consecutive Samples
There MANY more fragments available in my download than just what I am documenting here. These are just a basic walkthrough of VERY common workflows, to show how easy it can be, to use VSAE and create great management packs, quickly. I will add additional examples as time goes on. I welcome any feedback or MP fragment requests to be added to the library.
One of the important things to remember – is you aren’t limited by the fragments I provide. You can (and should) make your own fragments, specializing them to your company. For instance, one of the things you could do, is download all the fragments, and replace ##CompanyID## with your actual company ID. This way – that is one step already eliminated in your find/replace steps. If you ALWAYS do specific things with your classes (such as you always create classes AND groups) then you should combine these fragments into one. It will just make it that much faster.
Let the “easy series” begin.
Super tutorial!
Thankyou !
Hi Kevin,
I created a MP for monitoring windows applications using Fragments which is working great, used most of the Fragments for the various components, seed discoveries, groups, monitories, rules etc. When importing “Class.And.Discovery.Registry.KeyExists.mpx” into my MP then importing into SCOM Console with no toehr components in the MP at this point, immediately the application is discovered and the servers can be seen under “Discovered Inventory” against the Class, albeit not monitored to be expected but, I can see the discovery is working.
I have now a task to build a MP for UNIX/Linux and imported the Fragment “Class.And.Discovery.Unix.FileExists.mpx”, however see no discovered servers under “Discovered Inventory” against the Class. The UNIX Solaris and Red Hat servers are in the Console and are all of State=Healthy. The file path and file name are correct in the Discovery and exist on the servers. Should I be seeing the Servers being Discovered at this point as with the Windows App MP? I just didn’t want to move on with creating other discoveries and monitors etc., if there should be results at this stage, and I need to troubleshoot now rather than later. Thanks for any insight into the UNIX File Exists Class and Discovery behaviour.
You absolutely should have discovered instances. Something isn’t working. Permissions?
Interesting, the sudoers file is correct, the Servers discover ok, and the Agent installs fine, and the servers are monitoring as Healthy. There are no monitor errors or alerts for processes that are being monitored – sshd, rpcbind, nscd, syslogd so assuming permissions look to be correct if processes are monitoring ok and performance metrics are being collected ok?
So, if you run the exact same she’ll command in putty, what result do you get?
So for > ls $Config/AppPath$ | wc -l
running shell command in putty > ls /opt/tivoli/tsm/client/ba/bin/dsm.sys | wc -l
returns 1
Just to clarify, I logged in as the SCOM monitoring account and ran the shell command in a putty session and “1” is returned…
So for > ls $Config/AppPath$ | wc -l
running shell command in putty > ls /opt/tivoli/tsm/client/ba/bin/dsm.sys | wc -l
returns 1
Just to clarify, I logged in as the SCOM monitoring account and ran the shell command in a putty session and “1” is returned…
Wondering if Kevin ever gets a response to his responses… 🙂
hi Kevin, I have a jobscheduler which generates an event in the Windows Application Log. There is no counter event, but I want to influence the Health of an object. I cannot use the Windows Server class because we will miss other issues with the server. I created a Manual Reset Monitor which works great but I think I need a custom class (like job class for instance). Can you help me in the right direction? (which MP fragments etcetera). Thanks in advance.
Greetings,
Pim, SCOM Admin
I have a question regarding your fragment “Class.And.Discovery.Script.ByServerName.mpx” For the ComputerNameList is it possible to use wildcards or a regex expresstion in the comma separated list. If so what would be the syntax.
It is possible – but the way it is written would have to be changed. I started down this path and not using a script at all, but found it incredibly difficult as most of my customers are no Regex wizards, and ultimately we determined it would be easier to just use a comma separated explicit naming, rather than troubleshooting Regex outputs.
If you are going to use Regex – you and use a different module and not need powershell, but a simple discovery like registry or WMI even. Or you can use regex condition detection along with or inside powershell. But it would need some development in the overall solution.
I’m using your Monitor.Unix.ShellCommand.mpx fragment to create a two state monitor for memory consumption. I would like to add overrides for the error state, how can I do so?
I don’t understand. What do you want to override?
A lot of people at my company want a percent based memory monitor. They don’t understand why that’s not a thing in SCOM when so many other monitoring products have this. So I’m left creating a custom monitor. At first I created a Unix/Linux Shell Command Two State Monitor to determine the memory on a machine and alert when it’s above 80%. The problem is, some people think that’s too low and want a 90% threshold. There is no way to override the healthy, or error expression on this monitor. So I have to create another one when somebody wants a new threshold. I was hoping there would be a way to resolve this by using your fragment.
when using the cat file discovery fragments for Unix, the discovery script always runs as the SCOM Server Action Account (which I see in the event log). How can you confirm if the Unix Privileged Account is being used to actually read the file? i.e. it needs to use the Unix Run As account to detect the existence of the file, the SCOM action account doesn’t have permissions.
Is there a free alternative to Visio (online subscription) to work with VSAE en fragments?
disregard please 🙂 i read wrong.
I use Rule.Performance.Collection.Perfmon.mpx (A RULE to collect performance data from native perfmon.) fragment a lot for creating performance views in SCOM. Unfortunately I have come to realise that this does not work for CPU % as it multiplies by the number of CPUs and gives a misleading graph. I found a blog post from you about it 2010. I am sure I must have read but obviously forgotten.
However you have blogged about the ScaleBy option and I found out that is used in the Authoring Templates – Process Monitoring and Windows Service. The trouble with these templates is they setup discoveries for the process/service and you have to use a group to do the filtering. I would prefer to target a custom role that I have created for custom application.
Can I suggest that you put a warning in the rule fragment not to use it for CPU and create a new rule fragment just for CPU collection that uses
$Target/Host/Property[Type=”Windows!Microsoft.Windows.Computer”]/LogicalProcessors$
That would be much appreciated.
I checked adding the scaleby line to Rule.Performance.Collection.Perfmon.mpx and it worked for using with CPU % rule collection so I have created a separate fragment with a new name and the scaleby line.
$Target/Host/Property[Type=”Windows!Microsoft.Windows.Computer”]/LogicalProcessors$
I still thing that a warning needs to go into the original fragment not to use it with CPU % for process/service.
i wish they would add the VSAE stuff into the visual studio installer for those of us that are on a locked down image
Pingback:Copy SCOM monitors inside sealed management packs | SCOM Maintenance Mode Scheduler
Hi Kevin,
We have been using SCOM to monitor our systems for 5 years now and have learned a lot through your blogs. Thanks!!!
Our current version is SCOM 2016 UR9.
We recently started using Visual Studio 2019 and your VSAE fragments to create custom Windows service alerts for our applications.
Where we are running into issues creating a custom class for the Windows servers that make up the applications. Part 2 of your steps above.
We can’t seem to find a fragment that will isolate and create a class of servers that make up a given application.
We do have unique names for our servers. Each server has a 4 letter designation with the name of the server that identifies and associates it with an application.
An example would be zxswXXXXdbpr01. Where XXXX would be the reference to the application and is in the location on every server.
It would be great if we could key off that information from within the registry.
Thanks in advance!
Pingback:SCOM Resource Pools, part 1: how & why to create one - Monitoring Stuff
When a colleague and myself have tried using the Class.Group.Unix.Computers.mpx fragment the group is not populated. I have checked it through and cannot see why it is not working.
We created a group using the console and that worked so we have created a fragment based on that.
Hello Kevin,
I have tried working with the fragment Rule.TimedScript.DistributeFile.mpx, and when building the management pack the build is successfull, but I get a warning:
C:\Program Files (x86)\MSBuild\Microsoft\VSAC\Microsoft.SystemCenter.OperationsManager.targets(253,5): warning : Management pack resource ‘DUO.STLogMon.SCOM.DistributeSendSMSScript.File.Resource’ is referencing file name ‘C:\SCOM\Scripts\SendSMS.ps1’ that could not be found.
The file is at the location specified. Do you have any idea what the problem is?
Thanks for the help.
Found the solution, I should not have used the full file path when referencing the file. It works now.
Visual Studio 2022 Authoring Console?
Not yet. VSAE latest supported version of Visual Studio is VS 2019.
https://www.microsoft.com/en-us/download/details.aspx?id=30169
It’s part of our team training, and is designed to get new entrants to know your wonderful site Kevin, so thank you so much!
And to you learners, after reading this whole page go to the MP file of the training and read it; Good luck!
I find myself installing Visual Studio again as I had to get a new laptop as there was a fault with the original one. When install VS there are a lot of modules you can add to be installed and we generally install too many to be “safe”. I cannot find a document anywhere that states what exactly you need to install in Visual Studio if you only use it for creating Management Packs. That would be a useful blog post.
https://www.microsoft.com/en-us/download/details.aspx?id=30169
not supported to VS 2019 error .msproj
Hi Kevin
Can i use VSAE 2019 to create MP SCOM 2022?
Thanks for all
Yes – just create it for 2019 – it will import and work fine in 2022.
When installing VS 2022 or 2019 fresh with VSAE, a dialog box pops up saying “The ManagementPackProject .mpproj targets .NET Framework 4.0, which is no longer supported” and gives me the option to update to 4.8. I do this and everything works. But even selecting ‘Remember my choice’, I have to address this dialog box everytime I open the the project. I recreated the project and selected to target 4.8, but it must be something with VSAE as I still get the dialog.
Are you aware of any work around for this? Issue with either VASE 1.4.1.0 or 1.4.1.1. I know I could install .NET 4.0, but I mean do you know a way to make it target a newer version. 2022 VSAE will retarget to 4.8 adn previous VSAE will retarget to 4.6.1
Thanks
If you ever find the solution for this, please share!
Hi Kevin,
Is it possible to do this in just Visual Studio Code? I am able to upload the XML data of a MP, edit it, export and reimport to SCOM just fine, but didnt know if I could follow this series you made and continue using Visual Studio Code?
Sorry if this is a stupid question, I am new to management pack authoring.
No – unfortunately VSAE only supports Visual Studio.
I’m looking to start using Visual Studio 2019 for management packs – when I go to install it, it’s asking for several different Workloads/Components.
Can anyone assist in providing what is needed to work with VSAE? I’ve searched and can’t seem to find the requirements.
Thanks in advanced,
-Freddy
Hello Freddy. Don’t know if this is still relevant for you, but I only selected workload .NET desktop development.
I would skip 2019 and go for VS2022.
Kind regards,
Dennis
Hello Kevin. When i create a new monitor using Authoring -> Management Pack Templates, i have the option in the Task Pane to start/stop the service. When i create a new monitoring using your fragments, i do not have that option.
Is it possible to add that option to your fragments?
Kind regards,
Dennis
Mr. Holman, you have helped me immeasurably in my design, deployment, and management of SCOM 2022 for our server infrastructure monitoring. I can’t thank you enough. I’m am just now delving into the creation of custom management packs for our environment, and it is refreshing to be able to (almost!) just click ‘Next, Next, Finish’. I LOVE the fragments library. My dad would have called you a ‘gentleman and a scholar’. I can’t say that any better.
Fantastic set of tools, have actually built a bunch of (admittedly) simply management packs for our organization, but now I’m being asked for the harder stuff.
We’re looking at a Printer Server and Queue Job Management pak to replace the native one (Tasty has the same issue). Whilst my initial discovery of the Print SERVERS is working correctly, when i try and discover the queues (to a separate class) I keep getting this strange error on build:
Error The configuration specified for Module DS is not valid.
: Cannot find specified MPSubElement PrinterName, on MPElement= XX.PrintServer.PrinterQueue.Class, in expression: $MPElement[Name=’XX.PrintServer.PrinterQueue.Class’]/PrinterName$
(Path = XX.PrintServer.PrinterQueue.Class.Discovery/DS) XX.PrintMonitoring C:\Program Files (x86)\MSBuild\Microsoft\VSAC\Microsoft.SystemCenter.OperationsManager.targets 317
I do have a 2nd Discovery class, both based on the Class.And.Discovery.Script.PowerShell fragment so i’m not sure if it needs a 2nd reference to DataSource or if there’s something more obvious that i’ve missed. Any help would be appreciated.
Thanks! Doug
Just be careful with the fragments that include on-demand monitors. The ones I have seen are calling the scheduler and then the probe actions which isn’t good practice.
E.g. if a script is set to run every hour then clicking “Recalculate Health” in the SCOM console will trigger the on-demand monitor which kicks off the scheduler .. every hour. On-demand monitors should just run the probe action.