10/02/2013

System Center Orchestration Manager

This is the sixth of a series of blog posts around Cloud Computing. It gives an overview about the current Cloud Computing trends and explains how to set up a private cloud environment with Microsoft's System Center products.

This post is about the System Center Orchestrator (SCORCH), its features, capabilities and especially integration points.

The SC Orchestrator is the main workflow engine used to automate the processes in the private cloud.
It consists of two main components:
- Runbook Designer
- Orchestration Console

Runbook Designer
The Runbook Designer is the User Interface for creating workflows. On the right-side toolbar the available activities are shown. After installing the integration packs for the other System Center products, like SCVMM, some additional folders with activities should appear. There are plenty integration packs available to integrate almost all applications into the Orchestrator workflows.



The figure shows a simple workflow, called "CreateVM", which takes several input parameters (defined in the "InitializeData" activity) and connects to the SCVMM server to set up a new virtual machine ("Create VM from Template" activity). The InitializeData activity expects certain information like memory size, CPU count or machine name. This data is bound to the proper fields of the Create VM activity. (see screenshot)
After creating and checking-in the workflow, it can be executed using the Orchestration Console or Orchestration Web Service. Start activities provide a way to automatically trigger the workflow. The "Monitor File" or "Check Schedule" activities are waiting for specific events to kick-off the workflow, like a certain file is created or date is reached.

Orchestration Console
The Orchestration Console is a simple web application which allows to monitor or restart workflows.



Integration Layer - Orchestrator Web Service
There are two main integration points for the Orchestrator. On the one hand it is possible to use start activities which, for instance, monitor file changes or follow a certain schedule, on the other hand the Orchestrator Web Service can be invoked to start workflows or read their meta data.

The following web service query displays the details of the runbook with the name "CreateVM".

http://winscorch.tstune.de:81/Orchestrator2012/Orchestrator.svc/Runbooks?$filter=Name eq 'CreateVM'



Runbooks
http://winscorch.tstune.de:81/Orchestrator2012/Orchestrator.svc/Runbooks
2013-10-01T01:38:41Z


http://winscorch.tstune.de:81/Orchestrator2012/Orchestrator.svc/Runbooks(guid'4ceb5c4f-5ac1-4da1-9f3c-1d66f6280954')
CreateVM
2013-06-03T20:19:26+02:00
2013-10-01T01:18:43+02:00











    4ceb5c4f-5ac1-4da1-9f3c-1d66f6280954
    608bf0a8-3071-4c3d-8f6e-617286125b13
    CreateVM
    
    
    2013-06-03T20:19:26.403
    S-1-5-21-1169629555-895120178-2173626574-1106
    2013-10-01T01:18:43
    false
    \Thomas\CreateVM
    
    





This query selects a specific runbook and shows its input parameters. In this case the CreateVM runbook has a parameter CPUs of type integer.

http://winscorch.tstune.de:81/Orchestrator2012/Orchestrator.svc/Runbooks(guid'4ceb5c4f-5ac1-4da1-9f3c-1d66f6280954')/Parameters



Parameters
http://winscorch.tstune.de:81/Orchestrator2012/Orchestrator.svc/Runbooks(guid'4ceb5c4f-5ac1-4da1-9f3c-1d66f6280954')/Parameters
2013-10-01T01:41:07Z


    http://winscorch.tstune.de:81/Orchestrator2012/Orchestrator.svc/RunbookParameters(guid'af7e8e2e-84e7-46df-a565-0209eb618294')
    CPUs
    2013-10-01T01:41:07Z
    
    
    
    
    
    
        af7e8e2e-84e7-46df-a565-0209eb618294
        4ceb5c4f-5ac1-4da1-9f3c-1d66f6280954
        CPUs
        Integer
        
        In
    


...


This example shows how to integrate the Orchestrator Data Service into a C# .NET Console Application to figure out the input parameters of the "CreateVM" workflow.

First of all, a proxy has to be generated. Therefore, the Visual Studio Add Service Reference Wizard can be used like in the following figure.


This code creates an instance of the Orchestrator Data Service proxy class and provides the URL to the service.
It retrieves the runbook with the name "CreateVM" using a simple LINQ on the context. The context translates this query into the proper OData url (like the one above) and deserializes the result into the proxy types.

class Program
    {
        private static Uri orchestratorUri = new Uri("http://winscorch.tstune.de:81/Orchestrator2012/Orchestrator.svc");

        static void Main(string[] args)
        {
            // Creates an instance of the Orchestrator Data Service Context
            var orchestratorContext = new OrchestratorContext(orchestratorUri);

            // Linq-Query via the OrchestratorContext to retrieve the Runbook with the name "CreateVM"
            // Expand("Parameters") prefills also the subproperty Parameters
            var createVMRunbook = (from runbook in orchestratorContext.Runbooks.Expand("Parameters")
                                   where runbook.Name == "CreateVM"
                                   select runbook).FirstOrDefault();

            if (createVMRunbook != null)
            {
                Console.WriteLine("Runbook: {0}", createVMRunbook.Name);

                // Displays the parameters on the console
                foreach (var parameter in createVMRunbook.Parameters)
                {
                    Console.WriteLine("Parameter {0}, Type {1}", parameter.Name, parameter.Type);
                }
            }

            Console.ReadLine();
        }
    }

Finally, all the input parameters of the runbook are printed on the console like this screenshot shows:


This example shows how to leverage the Orchestrator Data Service to retrieve information about the available orchestrator runbooks. The example reads the input parameters from a specific runbook. The code could be used to build a dynamic user interface which provides input fields based on the workflow parameters.

This example shows the integration points of the System Center Orchestration Manager. With these integration points the Orchestrator can be easily connected to any ticketing system and can be used to automate your IT workflows. These workflows could cover any operations like creating a domain user, creating backups, migrating SQL server databases or setting up virtual machines in a private cloud.

No comments:

Post a Comment