Jump to content


  • 0
AdinE

SCORCH 2012 SP1 in a LAB – Configuration (Part B – Runbooks)

Question

So at this point we have Orchestrator setup and running, but we don’t have any runbooks yet.

 

So, we are going to use the Sample Runbook from this TechNet article: Creating and Testing a Sample Runbook.

 

The following topic describes how to create and test a simple runbook. The purpose of this runbook is to detect when a text file is added to a particular folder, copy that file to another folder, read the contents of the file, append a line from the copied file to another file, and then delete the original file.

 

The runbook starts with a Monitor File activity to wait for the text file to be created. It then uses the Copy File, Read Line, Append Line, and Delete File activities to perform the other functions. A Junction activity is used to coordinate the activities so that the Copy File and Append Line activities are both completed before the source file is deleted.

 

Creating the runbook

Use the following procedures to create the runbook by using the required activities.

 

To create a runbook

Click Start, point to All Programs, click Microsoft System Center 2012, click Orchestrator, and then click Runbook Designer.

Create Runbook 01.png

 

In the Connections pane, right-click Runbooks to select New, and then click Runbook.

Create Runbook 02.png

 

A New Runbook tab appears at the top of the Runbook Designer Design workspace with the name New Runbook.

Right-click the New Runbook tab to select Rename.

Create Runbook 03.png

 

Type Append and Copy Workflow in the Input box, and then press Enter.

 

You have created a new runbook and are ready to begin adding and configuring activities.

 

 

To add and configure a Monitor File activity

With the newly created Append and Copy Workflow runbook open, in the Activities pane, expand the File Management category.

Add and Config Monitor File 01.png

 

Click and drag the Monitor File activity to the Runbook Designer Design workspace.

Add and Config Monitor File 02.png

 

Double-click the Monitor File activity to open its Properties dialog box.

Add and Config Monitor File 03.png

 

In the In folder box, type C:\Drop.

Add and Config Monitor File 04.png

 

In the Filters section, click the Add button.

Add and Config Monitor File 05.png

 

In the Filter Settings dialog box, in the Name list, select File Name.

Add and Config Monitor File 06.png

 

In the Relation list, select Matches Pattern.

Add and Config Monitor File 07.png

 

In the Value box, type *.txt.

Add and Config Monitor File 08.png

 

Click OK.

Add and Config Monitor File 09.png

 

Click the Triggers tab.

Add and Config Monitor File 10.png

 

In the Trigger if one of the files was section, select the Created check box, and then click Finish.

Add and Config Monitor File 11.png

 

The Monitor File activity is created and configured to watch for any new text files that are created in the C:\Drop folder.

 

 

To add additional activities to the runbook

In the Activities pane, expand the File Management category.

Add Additional Runbook Activities 01.png

 

Click and drag the Copy File activity to the Runbook Designer Design workspace.

Add Additional Runbook Activities 02.png

 

Expand the Text File Management category.

Add Additional Runbook Activities 03.png

 

Click and drag the Read Line activity to the Runbook Designer Design workspace.

Add Additional Runbook Activities 04.png

 

To create a link between the Monitor File activity and the Copy File activity, click and drag the right arrow of the Monitor File activity to the Copy File activity.

Add Additional Runbook Activities 05.png

 

To create a link between the Monitor File activity and the Read Line activity, click and drag the right arrow of the Monitor File activity to the Read Line activity.

Add Additional Runbook Activities 06.png

 

By adding both the Read Line activity and the Copy File activity, you have created a workflow.

 

 

To configure the Copy File activity

In the Append and Copy Workflow runbook, right-click the Copy File activity to select Properties.

Config Copy File Activity 01.png

 

On the Details tab, right-click the File box to select Subscribe, and then click Published Data to open the Published Data dialog box.

Config Copy File Activity 02.png

 

The Monitor File activity is listed at the top of the Published Data dialog box because this is the activity just before to the selected activity.

Config Copy File Activity 03.png

 

In the Name column, select Name and path of the file, and then click OK. This populates the File property of the Copy File activity with the name of and path to the file from the Monitor File activity.

Config Copy File Activity 04.png

Config Copy File Activity 05.png

In the destination Folder box, type C:\Copy.

Config Copy File Activity 06.png

 

Click Finish.

 

The Copy File activity is now configured to copy files from the source folder to the destination folder.

 

 

To configure the Read Line activity

In the Append and Copy Workflow runbook, right-click the Read Line activity to select Properties.

Config Read Line Activity 01.png

 

On the Details tab, right-click the File box to select Subscribe, and then click Published Data to open the Published Data dialog box.

Config Read Line Activity 02.png

 

In the Activities list, select Monitor File.

Config Read Line Activity 03.png

 

In the Name column, select Name and path of the file, and then click OK.

Config Read Line Activity 04.png

 

Click the ellipse () button to the right of the File encoding box, and then select auto.

Config Read Line Activity 05.png

 

In the Line numbers box, type 1-END, and then click Finish.

Config Read Line Activity 06.png

 

The Read Line activity is now configured.

 

 

To add an Append Line activity

In the Activities pane, expand the Text File Management category.

Add Append Line Activity 01.png

 

Click and drag the Append Line activity to the Runbook Designer Design workspace to the right of the Read Line activity.

Add Append Line Activity 02.png

 

To create a link from the Read Line activity to the Append Line activity, click and drag the right arrow of the Read Line activity to the Append Line activity.

Add Append Line Activity 03.png

 

Right-click the Append Line activity to select Properties.

Add Append Line Activity 04.png

 

On the Details tab in the File box, type C:\Copy\Masterlog.txt.

Add Append Line Activity 05.png

 

Click the ellipse () button to the right of the File encoding box, and then select auto.

Add Append Line Activity 06.png

 

Right-click the Text box to select Subscribe, and then click Published Data to open the Published Data dialog box.

Add Append Line Activity 07.png

 

In the Name column for the Read Line activity, select Line text, and then click OK.

Add Append Line Activity 08.png

 

Click Finish.

Add Append Line Activity 09.png

 

The Append File activity is now configured to append files to the Masterlog.txt file.

 

 

To synchronize branches of a runbook

In the Activities pane, expand the Runbook Control category.

Synch Branches 01.png

 

Click and drag the Junction icon to the Runbook Designer Design workspace.

Synch Branches 02.png

 

To create a link from the Append Line activity to the Junction activity, click and drag the right arrow of the Append Line activity to the Junction activity.

Synch Branches 03.png

 

To create a link from the Copy File activity to the Junction activity, click and drag the right arrow of the Copy File activity to the Junction activity.

Synch Branches 04.png

 

Right-click the Junction activity to select Properties.

Synch Branches 05.png

 

Click the ellipse () button next to the Return data from box, and then select Copy File. Click OK. This action configures the activity to return the same Published Data as the Copy File activity.

Synch Branches 06.png

 

Click Finish.

Synch Branches 07.png

 

The Junction activity is configured to coordinate the workflow so that no further activities run until both the Copy File activity and Append Line activity finish.

 

 

To add and configure the Delete File activity

In the Activities pane, expand the File Management category.

Delete File Activity 01.png

 

Click and drag the Delete File icon to the Runbook Designer Design workspace.

Delete File Activity 02.png

 

To create a link from the Junction activity to the Delete File activity, click and drag the right arrow of the Junction activity to the Delete File activity.

Delete File Activity 03.png

 

Right-click the Delete File activity to select Properties.

Delete File Activity 04.png

 

Right-click the Path box to select Subscribe, and then click Published Data to open the Published Data dialog box.

Delete File Activity 05.png

 

In the Activity list, select Copy File.

Delete File Activity 06.png

 

In the Name column, select Name and path of the original file, and then click OK.

Delete File Activity 07.png

 

Click Finish.

Delete File Activity 08.png

 

The Append and Copy Workflow runbook is now completed. It should look similar to the following illustration.

Delete File Activity 09.png

 

 

Testing the Runbook

You can test the runbook by using the Runbook Tester. This tool lets you run the entire runbook and inspect the completion status and output of each activity. The Runbook Tester runs the activities, so you must first create the folders specified for the runbook.

 

To Test the Runbook

Create a folder on the runbook server called C:\Drop.

Test Runbook 01.png

 

Create a folder on the runbook server called C:\Copy.

Test Runbook 02.png

 

With the Append and Copy Workflow runbook selected in the Runbook Designer, on the toolbar, click Runbook Tester.

Test Runbook 03.png

 

Click Run. The Monitor File activity is loaded and waits for a text file to be created in the C:\Drop folder.

Test Runbook 04.png

 

Open Notepad and type a few lines of text. Save the file as C:\Drop\File1.txt.

Test Runbook 05.png

 

Wait a few moments for the other activities to run. Ensure that each of the activities is completed successfully.

To view the Published Data and other details of an activity, click Show Details for the activity.

Test Runbook 06.png

 

Open the C:\Drop folder and ensure that the file has been removed.

Open the C:\Copy folder and ensure that the file has been copied. Also verify that the MasterLog.txt file has the contents of the original file.

Share this post


Link to post
Share on other sites

0 answers to this question

Recommended Posts

There have been no answers to this question yet

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...


×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.