WalkThroughExample_short

12
Getting Started Guide for Resolve v3.4 12 Chapter 7 – Runbook Walkthrough Example This chapter provides an example of setting up a Runbook. The example creates a Runbook that pings a UNIX server and then checks the free disk space on that same server. You are prompted to enter the IP address of the remote UNIX server. The username and password for the remote UNIX server gets retrieved from variables stored in memory. Note: Resolve must be installed on a Windows server. This chapter contains the following sections: Planning the Runbook Creating Usernames and Passwords Creating ActionTasks Creating the Runbook Wiki Document Creating the Runbook Automation Model Executing the Runbook Viewing Runbook Results in Worksheets Viewing Results in the Wiki Document Related Documentation Planning the Runbook When planning a new Runbook, focus on the following two areas: Identifying the ActionTasks in the Runbook. In this example, the ActionTasks are: - Inputting the parameters - Pinging the server - Obtaining the available disk space available - Formatting the final results Understanding the logical workflow of the Runbook. By identifying the logical workflow in advance, we can ensure that all potential outcomes during processing are identified. See Figure 71. Copyright Material

Transcript of WalkThroughExample_short

Page 1: WalkThroughExample_short

Getting Started Guide for Resolve v3.4 12

Chapter 7 – Runbook Walkthrough Example

This chapter provides an example of setting up a Runbook. The example creates a Runbook that pings a UNIX server and then checks the free disk space on that same server. You are prompted to enter the IP address of the remote UNIX server. The username and password for the remote UNIX server gets retrieved from variables stored in memory.

Note: Resolve must be installed on a Windows server.

This chapter contains the following sections:

• Planning the Runbook

• Creating Usernames and Passwords

• Creating ActionTasks

• Creating the Runbook Wiki Document

• Creating the Runbook Automation Model

• Executing the Runbook

• Viewing Runbook Results in Worksheets

• Viewing Results in the Wiki Document

• Related Documentation

Planning the Runbook

When planning a new Runbook, focus on the following two

areas:

• Identifying the ActionTasks in the Runbook. In this example, the ActionTasks are:

- Inputting the parameters

- Pinging the server

- Obtaining the available disk space available

- Formatting the final results

• Understanding the logical workflow of the Runbook. By identifying the logical workflow in advance, we can ensure that all potential outcomes during processing are identified. See Figure 71.

Copyri

ght M

ateria

l

Page 2: WalkThroughExample_short

Chapter 7 – Runbook Walkthrough Example

Getting Started Guide for Resolve v3.4 13

Figure 71 - Logical Runbook Workflow

• Plan the parameters for each ActionTask. When each ActionTask is created, you specify which parameters are passed in and which parameters are passed out for the next ActionTask. For this example, INPUTS and Properties for input parameters and FLOWS and OUTPUTS for output parameters. For additional parameter options, see the Runbook Developers Guide.

Copyri

ght M

ateria

l

Page 3: WalkThroughExample_short

Chapter 7 – Runbook Walkthrough Example

Getting Started Guide for Resolve v3.4 14

The parameters are shown in Table 2.

Creating Usernames and Passwords

Properties are read-only parameters that are available in any ActionTask. For the example, the username and password are stored for the remote server as Properties, so that the user does not need to input or see these values.

Table 2 - ActionTasks, Parameters, and Descriptions

ActionTasks Parameters Descriptions

InitParameters INPUTS[“ipaddress”]$PROPERTY{username}$PROPERTY{password}

Enables manual input of the IP address at runtime. The username, and password of the remote server gets retrieved from Properties (stored values).Resolve supports population of alerts and tickets from external sources so that they do not need to be retrieved each time the Runbook is executed.

FLOWS[“ipaddress”] Contains the IP address, username, and password which are passed for future use by any ActionTasks.

FLOWS[“username”]

FLOWS[“password”]

Ping INPUTS[“ipaddress”] Retrieves the IP address for the server to ping from the InitParameters FLOWS[“ipaddress”] parameter.

OUTPUTS[“summary”] Outputs a summary (results) and an alive parameter. The alive parameter is a Boolean value that indicates whether or not the pinged server is up. The alive parameter is part of the condition and is not part of the Disk Free ActionTask.

OUTPUTS[“alive”]

Disk Free INPUTS[“username”] Obtains the IP address, username, and password from FLOWS output (InitParameters).

INPUTS[“password”]

INPUTS[“ipaddress”]

INPUTS[“summary']

OUTPUTS[“summary”] Output the summary to the Summary ActionTask so that cumulative results are displayed to the user.

Summary INPUTS[“ipaddress”] Obtains the IP address from the FLOWS parameter and the summary from the OUTPUTS parameter of Disk Free or Ping.The Summary ActionTask has no output parameters, because it is the final ActionTask in the Runbook.

INPUTS[“summary”]

Copyri

ght M

ateria

l

Page 4: WalkThroughExample_short

Chapter 7 – Runbook Walkthrough Example

Getting Started Guide for Resolve v3.4 15

To create a Property, perform the following steps.

1. Click Action Definition > Component > Properties in the Navigation Menu. A list of existing Properties displays. See Figure 72.

Figure 72 - Properties Definition

2. Click New in the Control Menu on the right to add a new Property.

3. Add the following values, in the Properties pop-up (see Figure 73):

• Name: The name of the Property. This value is case sensitive and is the parameter name as will be referenced by the ActionTask. For the username Property, type “username.”

• Module: The module where the Property resides. For the username Property, type “test”.

• Type: Options are Plain or Encrypt. If Encrypt is selected, the Property value will be displayed in the Properties list as encrypted text; otherwise, the Property value will be displayed as plain text, readable to all users with permissions to create or manage ActionTasks. For this example, specify Encrypted.

• Value: The actual value of the Property. For example, if the username is “User127”, enter “User127” in this field. Since Encrypt was selected, you will not see the characters as they are typed.

Copyri

ght M

ateria

l

Page 5: WalkThroughExample_short

Chapter 7 – Runbook Walkthrough Example

Getting Started Guide for Resolve v3.4 16

Figure 73 - New Properties Definition

4. Click Save & Exit.

5. Repeat the process for the password Property. When you are done, both Properties should display in the Properties list.

Note: You may need to sort by Last Updated column to see the new Properties at the top of the list.

Creating ActionTasks

The Runbook example includes the following four ActionTasks:

• InitParameters: Populates the IP address, username, and password for the remote server.

• Ping: Ping the remote server.

• Disk Free: Determine the free disk space on the remote server.

• Summary: Returns results to the user.

InitParameters ActionTask

To create the InitParameters ActionTask, perform the following steps:

1. Click Action Definition > My ActionTasks or All ActionTasks in the Navigation menu. Figure 74 shows the menu that displays.

Copyri

ght M

ateria

l

Page 6: WalkThroughExample_short

Chapter 7 – Runbook Walkthrough Example

Getting Started Guide for Resolve v3.4 17

Figure 74 - Action Definition Menu and Sub-Menu

2. Click New in the ActionTask sub-menu in the Control menu. After the new ActionTask has been saved, additional tabs display below the main ActionTask window as shown in Figure 75.

Figure 75 - ActionTask Tabs

General Tab

The ActionTask General tab displays first after you click New. Input the ActionTask name, module, menu path, and a summary. See Figure 76.

Figure 76 - InitParameters ActionTask Window

Click Save in the Control menu to save your changes.

Command Tab

The Command tab enables you to define the ActionTask by using commands and parameter information. Because the InitParameters ActionTask populates and outputs three parameters without performing any other processes, it is an ASSESS type. For a complete list of ActionTask types and functions, see the Resolve Runbook Development Guide.

To add the input and output parameters to the InitParameters ActionTask, perform the following steps.

1. Click Add.

2. Enter the parameter name. For example, use “ipaddress.” Figure 77 shows the Add window.

Copyri

ght M

ateria

l

Page 7: WalkThroughExample_short

Chapter 7 – Runbook Walkthrough Example

Getting Started Guide for Resolve v3.4 18

Figure 77 - Add Input Param

3. Enter a Description.

4. Click OK. The input parameter displays in the Input Parameters section of the Command tab as shown in Figure 78.

Figure 78 - Input Parameters

5. Click Add in the Output Parameters section.

6. Input the summary parameter as shown in Figure 79.

Copyri

ght M

ateria

l

Page 8: WalkThroughExample_short

Chapter 7 – Runbook Walkthrough Example

Getting Started Guide for Resolve v3.4 19

Figure 79 - Add Summary Output Param

7. Click OK.

8. Add the username and password parameters the same way.

9. Check the Encrypt box for the username and password Input Parameters.

Warning: You must click Save in the Control menu to save these changes. If you exit before saving your work, the new parameters will be lost.

Assessor Tab

The Assessor retrieves results from the ActionTask and determines whether the desired or expected results were received. The Assessor interprets and passes the results onto the next ActionTask.

To add content in the Assessor tab, perform the following steps.

1. Click Assessor. Figure 80 shows the window that displays.

Figure 80 - Assessor Add Window

Copyri

ght M

ateria

l

Page 9: WalkThroughExample_short

Chapter 7 – Runbook Walkthrough Example

Getting Started Guide for Resolve v3.4 20

2. Input the full script as follows:

// Set default values for responsesdef condition = “good”def severity = “good”def summary = RAWdef detail = RAW// Save the results of the Assessor in the Resultsvariable for display in the// WorksheetRESULT.condition = conditionRESULT.severity = severityRESULT.summary = summaryRESULT.detail = detail// Pass the parameters out as FLOWS variablesFLOWS[“ipaddress”]=INPUTS[“ipaddress”]FLOWS[“username”]=”$PROPERTY{username}”FLOWS[“password”]=”$PROPERTY{password}”

The result of the ActionTask is set by populating the RESULT special variable. The RESULT.condition is used to control the Automation Model flow diagram logic while the RESULT.summary, severity and detail are used for display in the worksheet and Wiki document. The ActionTask will display as successful or failed in the Worksheet, along with more detailed information available in the summary and detail fields.

Note: The “$PROPERTY{username}” and “$PROPERTY{password}” must be enclosed within double quotes as the value of the property is literally replaced before the script is executed.

3. Click Save & Exit.

Ping ActionTask

The Ping ActionTask executes the ping command from the operating system of the Resolve server and a Windows server was used in this case.

To create the new ActionTask, perform the following steps.

1. Click Action Definition > My ActionTasks or All ActionTasks (see Figure 81) in the Navigation Menu.

Figure 81 - Action Definition Menu

2. Click New in the ActionTask sub-menu (see Figure 82) in the Control menu.

Copyri

ght M

ateria

l

Page 10: WalkThroughExample_short

Chapter 7 – Runbook Walkthrough Example

Getting Started Guide for Resolve v3.4 21

Figure 82 - ActionTask Control Sub-Menu

General Tab

To add information to the General tab, perform the following steps.

1. Enter the ActionTask name, module, and a summary of its functionality. Figure 83 shows the ActionTask window.

Figure 83 - Ping ActionTask General Tab

2. Click Save.

Command Tab

Because the Ping ActionTask executes only an operating system command, the ActionTask type is OS. For a complete list of ActionTask types and their functions, see the Resolve Runbook Development Guide.

To add parameters in the Command tab, perform the following steps.

1. Select OS as the Type. Leave the Timeout at 300 seconds.

2. Click Add in the Input Parameters section. Figure 84 shows the Add Input Param window.

• If the server is UNIX, enter the ping -c 1 command in the Command Line box. Enter the $INPUT{ipaddress} in the arguments box.

• If the server is Windows, enter ping /n 1. Enter the $INPUT{ipaddress} 1 command in the arguments box.

Copyri

ght M

ateria

l

Page 11: WalkThroughExample_short

Chapter 7 – Runbook Walkthrough Example

Getting Started Guide for Resolve v3.4 22

3. Enter the parameter name as ipaddress in the Name field and a description.

Figure 84 - Add Input Param

4. Click Add in the Input Parameters section and type “summary” in the name field.

5. Add a description.

6. Click OK.

7. Add the alive output parameter the same way.

Warning: You must click Save in the Control menu to save the changes. If you exit without sav-ing, the new parameters are lost.

Assessor Tab

The Assessor gets results when the ActionTask executes and determines whether the desired or expected responses were received. The Assessor interprets and passes on the results.

The Assessor includes three main sections:

• Variable Instantiation: Values that indicate the ActionTask results are instantiated. The RAW ActionTask variable gets assigned a local value so that the information can be accessed within the Assessor.

• RAW Data Assessment: RAW data returned by the ActionTask gets evaluated to determine if the ActionTask was successful or not.

• Parameter Output: ActionTask parameters that are sent to OUTPUT parameters.

For the Ping ActionTask, the ping command should generate a result from the remote server. If the remote server is available, the result is GOOD/SUCCESS. If unavailable, the result is BAD/FAILED.

The full Assessor script is as follows.

// Set default values for responsesdef condition = “good”def severity = “good”def alive = “true”// Set the summary variable with the RAW results

Copyri

ght M

ateria

l

Page 12: WalkThroughExample_short

Chapter 7 – Runbook Walkthrough Example

Getting Started Guide for Resolve v3.4 23

def summary = RAWdef detail = RAWif (RAW =~ /unreachable/ || RAW =~ /timed out/ || RAW.contains(“0received”) || RAW.contains(“Usage”)){condition = “bad”severity = “critical”alive = “false”}// Save the results of the Assessor in the Results variable fordisplay in the// WorksheetRESULT.condition = conditionRESULT.severity = severityRESULT.summary = summaryRESULT.detail = detailOUTPUTS[“summary”] = summaryGetting Started Guide for Resolve v3.4 94OUTPUTS[“alive”] = alive

To configure the Assessor tab, perform the following steps.

1. 1. Enter the code in the Script section of the Assessor tab as shown in Figure 85.

Figure 85 - Ping ActionTask Script

2. 2. Click Save & Exit.

Ping ActionTask Test

To test the Ping ActionTask, perform the following steps:

1. View a list of the existing ActionTasks by clicking either My ActionTasks or All ActionTasks in the Action Definition menu. Figure 86 shows the window that displays.

Copyri

ght M

ateria

l