Welcome to MSDN Blogs Sign in | Join | Help

Automating the setup of URL monitoring

One of the new things in OpsMgr is the ability to easily setup URL monitoring from multiple watcher nodes. What what if you want to monitor 500 different URLs? Setting this up manually could be pretty time consuming. Here is a script I put together that demonstrates how to automate this process using PowerShell.

There are four parameters you need to pass to this script:

1 - The URL

2 - One or more FQDNs of watcher nodes. The watcher nodes must have the OpsMgr agent installed.

3 - The display name of the type that will be created. This will appear in the authoring space where you see all the web site monitoring objects as well as when you will be creating the state view or alert view.

4 - The display name of the management pack into which all the URL monitoring logic will be stored as a result of running the script.

Here is exactly what you need to do to run this script:

1 - Open the OpsMgr Command Shell

2 - Type the following

C:\CreateUrlMonitoring.ps1 -url:"http://url.contoso.com" -watcherNodes:"watcherNode1.contoso.com","watcherNode2.contoso.com" -displayName:"Url Monitor 1" -targetMp:"WebSiteMonitoring"

Running the script with the above parameters will create the right monitoring logic to monitor "http://url.contoso.com" URL from watcherNode1.contoso.com and watcherNode2.contoso.com and store the monitoring logic in a management pack whose display name is WebSiteMonitoring.

Once you run the script, you will need to create state and alert views to see the status of the URL from the perspective of the watcher nodes.

If you find this sort of automation script useful and you want to see automation of other monitoring scenarios, please leave a comment and let me know.

The script is attached and the link is at the bottom of this post.

This posting is provided "AS IS" with no warranties, and confers no rights.
Use of included scripts are subject to the terms specified at
http://www.microsoft.com/info/cpyright.htm

 

Published Saturday, August 11, 2007 3:33 AM by Boris Yanushpolsky
Filed under:

Attachment(s): CreateUrlMonitoring.zip

Comment Notification

If you would like to receive an email when updates are made to this post, please register here

Subscribe to this post's comments using RSS

Comments

# MSDN Blog Postings » Automating the setup of URL monitoring

# re: Automating the setup of URL monitoring

Sunday, August 12, 2007 1:03 PM by timpmcfadden

I really like this.  We need to setup a ton of url monitors and this will really help.

Is it possible for you to create a script that the automate the process of setting up multiple service monitors.

# A Great place for SCOM scripts

Thursday, August 21, 2008 12:41 PM by Dario IT Solutions Blog

Check out Boris Yanushpolsky's blog ( http://blogs.msdn.com/boris_yanushpolsky ). Boris is an SCOM

# URL monitoring with certificate authentication

Wednesday, December 10, 2008 9:03 PM by Capriole

Is there any way of forcing the web application monitor to use a client certificate to authenticate?

We would like to monitor an IIS website that allows certificate auth only - not Basic, Digest or IWA/NTLM.

# re: Automating the setup of URL monitoring

Thursday, December 11, 2008 3:45 PM by Boris Yanushpolsky

I am not sure to tell you the truth. I suggest you post a question to one of the OpsMgr newsgroups or contact CSS.

# re: Automating the setup of URL monitoring

Wednesday, January 14, 2009 4:30 AM by Richard

Hi there, I am trying to run this script and keep getting a bumch of errors, the first one being The term 'Get-ManagementGroupConnection' is not recognised as a cmdlet.. Any help?

# re: Automating the setup of URL monitoring

Wednesday, January 14, 2009 12:43 PM by Boris Yanushpolsky

You need to open the OpsMgr commandshell first and then run the script.

# re: Automating the setup of URL monitoring

Wednesday, January 21, 2009 6:51 AM by Richard

Hi there, this is working 100% correctly. However saying that there is one thing that I cant work out for the life of me, I am trying to allow the checking of the following checkBox on creation of a watcher, the name is "Stop Processing the subsequent requests if any error criteria is met". How would I go about doing this?

# re: Automating the setup of URL monitoring

Wednesday, January 21, 2009 6:53 PM by Boris Yanushpolsky

There is no easy way to do this with the script I posted as it requires manipulation of the MP objects created by the script.

# re: Automating the setup of URL monitoring

Thursday, February 05, 2009 12:13 AM by Roel

Can we check for searchstrings (like NetIQ)? E.g.: check if the return page has a string. If it doesn't (or not) generate an alert.

# re: Automating the setup of URL monitoring

Thursday, February 05, 2009 12:40 AM by Boris Yanushpolsky

You can do this, but through the UI rather than in powershell.

# re: Automating the setup of URL monitoring

Sunday, February 08, 2009 11:55 PM by Roel

Is there no other way of doing this through a script? We need to migrate 700 NetIQ URL monitors. If this is not possible through a script the customer wont be a happy customer.

# re: Automating the setup of URL monitoring

Monday, February 09, 2009 6:42 PM by Roel

Hi Boris, we need to migrate 700 URL monitors from NetIQ to Operations Manager. If we are not able to script this the customer will not be happy. Is there any other way to script this except for Powershell?

# re: Automating the setup of URL monitoring

Monday, February 09, 2009 8:59 PM by Boris Yanushpolsky

In theory there should be a way to do this, but there are no cmdlets for this, so it would require writing managed code.

# @Roel

Tuesday, February 24, 2009 9:47 AM by Marco Shaw

@Roel,

If you're still looking for something, please email me directly and I will try to help: marco DOT shaw AT gmail DOT com.

# re: Automating the setup of URL monitoring

Friday, April 10, 2009 2:57 PM by David

Hi Roel,

We have a tool that we wrote to do what you are looking for. We have used it to migrate hundreds of Sitescope monitors. Contact me if you would like some information.

david.stclair AT infrontconsulting DOT com

# re: Automating the setup of URL monitoring

Wednesday, April 22, 2009 8:52 AM by Zuro

Hi,

I tried this script on R2. it didn't add url monitoring to Authoring -> Web application. neither the script seems to finished successfully without errors.

moreover I export the WebSiteMonitor MP (which I created manually) and no evidence for url monitoring.

# re: Automating the setup of URL monitoring

Thursday, April 23, 2009 4:38 AM by Zuro

Hi,

I tried this script on R2. it didn't add url monitoring to Authoring -> Web application. neither the script seems to finished successfully without errors.

moreover I export the WebSiteMonitor MP (which I created manually) and no evidence for url monitoring.

# New features in OpsMgr 2007 R2

Saturday, May 16, 2009 5:54 PM by Mark Wolzak

I've been one of the lucky guys to be able to attend the MMS 2009 in Las Vegas a few weeks ago. One

Leave a Comment

(required) 
required 
(required) 

  
Enter Code Here: Required
 
Page view tracker