Start or Stop all Monitor Runbooks in Folders

I have just put together a 4th script for manipulating monitor runbooks through the Orchestrator web service. As always, the Module and associated example scripts are available up at https://scorch.codeplex.com/releases/view/107858. Instead of just dropping the script on my blog and saying “have a good time” in this post I’ll show you how to get the module, install it and use it and one of the example scripts to start all monitors in an array of folders and stop all monitors in a different array of folders

Get the module

Step one to getting going is to go out and download the module and the setMonitorRBs.ps1 script file that will be used in this demo

Once downloaded, unpack the zip file to a location you know, Launch PowerShell as Administrator and run the deploy.ps1 script (this will place the module files in C:\Program Files\SCOrchDev\Modules and add this path to the $env:PSModulePath for the machine

setMonitorRBs.ps1

We now have the module installed on the system! The next step is to run the setMonitorRBs.ps1 script! Before doing that let’s talk about what it does. You pass it two arrays, one array of folders that contains monitor runbooks that should be started and another array of folders that contain monitor runbooks that should be turned off. The script will then query your web service, find all monitor runbooks, look at their paths and shutoff the runbooks that are start with the ‘stop’ folder paths and turn on the monitors that start with the ‘start’ folder paths! The other important parameters are EnvironmentName and EnvironmentPort

  • EnvironmentName
    • This is the name of your orchestrator webserver box
  • EnvironmentPort
    • This is the port your orchestrator web service runs on (default is 81)

Running the script!

Each start or stop operation is done in a PowerShell job so you can check its status using Get-Job or get its output using Receive-Job

 

Feel free to take a closer look at the script, it uses some cool PowerShell job functionality. Enjoy!

Advertisements
Posted in Uncategorized

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: