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