Skip to Main Content

How to create 100’s of TCP monitors in minutes with SCOM

Today we thought we'd highlight a fantastic new blog site from a rising star of the SCOM Community, Jasper Van Damme. We've worked closely with Jasper for some time, he really knows his stuff and now he's sharing the best of his knowledge of SCOM with the rest of the community. Although it's still in its infancy, we highly recommend you follow his blog, which is already full of useful hints and tips.

To give you a taster of the type of material you can expect from Jasper, we've published a guest blog from him below;

Create 100’s of TCP monitors in minutes with SCOM

By Jasper Van Damme

As you may or may not know, creating TCP monitors in SCOM through use of the template is a fairly time intensive task, especially if you have to create a ton of TCP monitors. Furthermore, templates are fine for smaller scale Operations Manager environments but tend to create a lot of unnecessary groups, overrides, views etc.

So naturally I was looking for a more elegant solution as I did not want to go through creating 100’s TCP monitors. My first thought was to google if anything exists already, and to my surprise, I did not find any immediate solutions. What I did find however was the following post (credits to Gowdhaman Karthikeyan).

This post explains how you can use a PowerShell discovery with a comma separated file or ‘CSV’ to add the proper TCP Port instances in SCOM. This has some significant advantages over using the template (as outlined in the blog post):

The blog post covers the class/discovery creation of these TCP port instances, but does not cover the monitoring part. As I did not have time to wait for part 2, I decided to use his management pack to add monitoring to it as well.

To enable monitoring I went through the following steps:

The initial data source for the monitor, which was generated by the template, will look like this. The bold part is the hard-coded part we need to replace. However, we have not yet added any data from our target class to the data source - something we will need to add to this as well.

The data source therefore eventually looks like this.

The monitor types will have to be changed as well, as the properties of the class are not passed through in the template version of the monitor. So the code went from this to this.

By changing the monitor types and data source part of the code, the hardest part is basically done. All we have to do is create four monitors and use the proper monitor types. These are the monitors that are included in the management pack:

I have not added any performance collection yet, but will endeavour to add this in a later stage.

Before or after importing the management pack, make sure you follow these steps:

Note: this MP only works with 2012 R2, but you can change the references to an older version and it should work as well.

Share this article to LinkedInShare this article on XShare this article to Facebook