Freigeben über


Automating port monitoring using PowerShell

A while I wrote a blog entry about how you can automate the creation of URL monitoring logic in OpsMgr using PowerShell. One of the questions I have received is "how do you do the same thing for port monitoring ?". Attached is a script that demonstrates how this can be done.

In order to run the script, you need to open the OpsMgr Command Shell and run the following:

CreatePortMonitoring.ps1 -serverName:'TargetServerName.contoso.com' -portNumber:'80' -pollIntervalSeconds:'120' -watcherNodes:"watcher1.contoso.com", "watcher2.contoso.com" -displayName:'Test URL monitoring' -targetMP:'Port Monitoring MP'

Note: If you specify the interval less than 1 minute, the monitoring should still work but you will not be able to load the configuration page and will see a UI error.....

In one of my future posts I will try to explain how this scripts works for those of you who want to automate execution of MP templates.

CreatePortMonitoring.ps1.zip

Comments