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:"https://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 "https://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
https://www.microsoft.com/info/cpyright.htm
Comments
Anonymous
August 10, 2007
PingBack from http://msdnrss.thecoderblogs.com/2007/08/10/automating-the-setup-of-url-monitoring/Anonymous
August 12, 2007
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.Anonymous
August 21, 2008
Check out Boris Yanushpolsky's blog ( http://blogs.msdn.com/boris_yanushpolsky ). Boris is an SCOMAnonymous
December 10, 2008
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.Anonymous
December 11, 2008
I am not sure to tell you the truth. I suggest you post a question to one of the OpsMgr newsgroups or contact CSS.Anonymous
January 13, 2009
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?Anonymous
January 14, 2009
You need to open the OpsMgr commandshell first and then run the script.Anonymous
January 20, 2009
The comment has been removedAnonymous
January 21, 2009
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.Anonymous
February 04, 2009
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.Anonymous
February 04, 2009
You can do this, but through the UI rather than in powershell.Anonymous
February 08, 2009
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.Anonymous
February 09, 2009
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?Anonymous
February 09, 2009
In theory there should be a way to do this, but there are no cmdlets for this, so it would require writing managed code.Anonymous
February 24, 2009
@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.Anonymous
April 10, 2009
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 comAnonymous
April 22, 2009
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.Anonymous
April 22, 2009
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.Anonymous
May 16, 2009
I've been one of the lucky guys to be able to attend the MMS 2009 in Las Vegas a few weeks ago. One