At this point, we have used Orchestrator to create a new computer account in a specific OU in Active Directory. We then used Orchestrator to create the computer based on a template in VMM. We are now going to generate alerts in System Center 2012 SP1 Operations Manager as a new Computer (Windows 2012 R2 Datacenter Preview is built) is built using Orchestrator.
If you missed Part 1, 2 or 3; here are the links to the posts:
Part 1 – Orchestrator System Center Integrations Part 1 – Setting up the Integration Packs
Part 2 – Orchestrator System Center Integrations Part 2 – Creating a computer account in an OU
Part 3 – Orchestrator System Center Integrations Part 3 – Creating a VM based on a Template in VMM
Right now, our Runbook looks like this:
In Initialize Data, we enter in the Computer Name, Computer Description, Computer location and the name of our Cloud.
We then pass the information onto the "Create Computer Account in the Servers OU" activity; this activity is the "Create Computer" activity renamed from the Active Directory Integration.
After the computer account is created, we pass the information on the Orchestrator Databus to the Create VM from Template activity from the SC 2012 Virtual Machine Manager integration. This activity uses the template we created for Windows 2012 R2 Datacenter Preview to create a new VM in Virtual Machine Manager.
After the VM is created, we start the VM using the Start VM activity.
Adding in Alerts
What we are going to do next is add in Alerts for the Runbook so we are alerted in the event the process for creating a new computer account and a new VM fail in the process.
In the activities pane, we see we have a couple of Activities in the SC 2012 SP1 Operations Manager Integration. We can create alerts, get monitors, start and stop maintenance mode, update alerts and check monitor states.
The activity we are concerned with for our Runbook is the Create Alert Activity. In Part 5, we will use the Start Maintenance Mode activity to start Maintenance Mode for a collection from ConfigMgr.
Select the Create Alert activity and drag it to our Runbook.
I am going to add in Alerts for Success and Failure for Create Computer Account, Create VM from Template, and Start VM. In total, this will be 6 different Alerts.
With the Create Alert activity highlighted, I will copy the Create Alert activity and paste the so I have a total of 6 Alert activities.
Next, rename each Alert activity for the Alert it will generate. Starting with the Create Alert (6) I rename as follows:
- Create Computer Account Failure
- Create Computer Account Success
- Create New VM Failure
- Create New VM Success
- Start New VM Failure
- Start New VM Success
Now, I simply connect each alert with the associated activity. We will have 2 alerts, success and failure for Create Computer Account, Create VM from Template and Start VM.
Connector Links between Activities also have properties. By default, the condition is Success. What we need to do now is change the Link Properties to filter out the Failures and send to the correct Alert. Simply right click on the Connector Links between the Activities and select Properties.
All we do next is change the Results from Success to Failed for each Failure result I want an Alert on.
Now all we need to do is edit the properties of each Activity so we get the information we want from the Alert.
The first thing you need to do connect to the Operations Manager Integration by clicking on the ellipse and select OK.
By default, each property for an alert only contains Priority and Severity. Just like in the Create Computer Activity, there are additional properties you can select by clicking on the Select fields button in each Activity.
Clicking on the Select fields button, I add in Description and Name.
For each Success, I will generate an Information Alert with a Low Priority and place in a Description of the Alert and the Name the same as the name of the Alert. Priority and Severity can be selected by clicking on the elapse.
For Description, what I want to do is put in the name of the VM that is being created, the time, and the what happened with the Runbook was run. So for Description, I start out by typing in the properties for Description "New VM "
Then I Right Click and Subscribe to Published Data on the Databus for the Computer Name from property from Initialize Data.
The Description property now reads New VM {Computer Name from "Initialize Data"}
Now I add on to the description the time the VM started. After – New VM {Computer Name from "Initialize Data"}, I type in "started successfully at" the Description line now reads New VM {Computer Name from "Initialize Data"} started successfully at
Once again, I Subscribe to Published Data for the Start VM activity and select Modified Time from the Start VM activity on the Databus.
The Description field now reads New VM {Computer Name from "Initialize Data"} started successfully at {Modified Time from "Start VM"} and select Finish
For Success Alerts, I have a Priority of Low and a Severity of Information. For Failures, I have a Priority of Low and a Severity of Warning. You can modify for your environment and select whatever you want or simply experiment.
For the Start New VM Failure Alert, the Description field reads New VM {Computer Name from "Initialize Data"} failed to start
For the Create New VM Success alert, I have in the Description New VM {Computer Name from "Initialize Data"} created Successfully at {Modified Time from "Create VM From Template"}
For Create New VM Failure, I have in the Description New VM {Computer Name from "Initialize Data"} failed to create
For Create Computer Account Success I have in the Description A new Computer Account named {Computer Name from "Initialize Data"} has been created in {Container Path from "Create Computer Account in the Servers OU"} successfully
For Create Computer Account Failure I have in the Description A new Computer Account named {Computer Name from "Initialize Data"} failed to create
Testing Alerts
All we are doing here is running our Runbook to create a new computer and making sure alerts show up in Operations Manager. For the first test, I am going to use the Runbook Tester and when I run the Runbook to Create a new computer, I am not going to enter in any information to Initialize Data. I should receive a warning alert that we failed to create a computer account and the Runbook will stop running because we have a failure. The other Activities stop at this point.
Running the Runbook, I select OK in the Runbook Tester without entering in Data
I see in the Orchestrator Log that the Create Computer Account in Servers OU step failed; however, the step to send an Alert was successful.
In Operations Manager, I see I have a new Alert using the Rule Microsoft.SystemCenter.Orchestrator.Intergration.Library.AlertOnEventForComputer with a Description "A new Computer Account named {Computer Name from "Initialize Data"} failed to create". Since I did not enter in a name in Initialize Data, nothing is populated for the Computer Name.
Now, when I run the Runbook, using the Runbook Tester, I will populate the information normally. We should now get information Alerts that everything ran successfully.
Populating the Initialize Data Parameters, I am going to create the my System Center R2 Preview server for OpsMgr on Windows 2012 R2 Preview. Entering in the information, I select OK.
Here is my Information Alert that the New Computer Account created successfully
Here is the Information Alert that the VM was created successfully in VMM
Here is the Information Alert that the New VM Started Successfully
In the Orchestrator Log, I now also see that each Activity ran successfully.
And finally, here is the new VM all set and ready to go running Windows 2012 R2 Datacenter Preview based on the template we created in Part 3 of this Blog series.
Conclusion
Hopefully by now you have learned enough to start using System Center 2012 SP1 Orchestrator effectively in your Datacenter. Orchestrator truly is a complete automation solution that you can use right now and if you’re not, you should be. Orchestrator is really easy to use once you get a few of the basics out of the way. If I had the Exchange Integration setup, I could easily send an email as well for each step. Bottom line is there are a lot of options and capabilities with Orchestrator.
If you would like to download this Runbook and configure for your environment, rather than starting from scratch; I have this Runbook available at System Center Central here:
In the next Blog of this series, we will move away from VMM and focus on how use Collections in Configuration Manager to place computers in Operations Manager in Maintenance Mode using Orchestrator. Hope you are enjoying this Blog series so far and thanks for checking it out!