Policy Management for Autonomic Computing: Solving a business problem using PMAC

How to create an autonomic policy to manage a business scenario

Businesses of all types have policies that dictate the behavior of their IT resources, human resources, business rules, and so on. Policy Management for Autonomic Computing (PMAC) provides a mechanism and environment for creating and enforcing policies and automating these business scenarios. By using PMAC in this manner, your business will run more efficiently and with less process errors.

Share:

Eric Kirchstein (ekirchst@us.ibm.com), Software Engineer, IBM

ekirchst photo

Eric Kirchstein is a Software Engineer for IBM working with autonomic computing technologies, where he specializes in XML programming technology and methodology. Before working with autonomic computing technologies, Eric worked on Tivoli Service Level Advisor as a Java programmer and DB2 focal point. He has a B.S. degree in Computer Science from North Carolina State University, is an IBM Certified Specialist in DB2 UDB V6.1/V7.1, and a Level 1 plateau inventor.



20 September 2005

Before you start

About this tutorial

This tutorial is written for IT Administrators who want to create new policies that define business rules and scenarios. After explaining some of the rudimentary concepts associated with a policy document, the tutorial describes a few fictional business scenarios. The tutorial then breaks the pieces of these scenarios into their policy-related components. Meanwhile, the policy Extensible Markup Language (XML) will be written and put together into functional policy documents.

Prerequisites

You must have a basic knowledge of XML to complete this tutorial. Additionally, you should understand the ins and outs of the PMAC application. Resources contains some useful XML and PMAC-related links.


Introducing autonomic policy documents

Most, if not all, businesses have policies by which they operate. Some rules may dictate the business' resource behavior, while others may dictate the rules for business operation. This tutorial gives you an in-depth look into creating autonomic policy documents that can be used to automate and carry out business scenarios. Two example scenarios are used to illustrate the way in which generic business policies can be translated into PMAC XML policy documents.

Using policy documents with PMAC

The policy documents you create in this tutorial can be used in conjunction with PMAC to create a functional autonomic manager for your resources. See Resources for more information on setting up and using PMAC.


Introduction to the business scenarios

This section gives a high-level explanation of each of the business scenarios used in this tutorial.

A customer rewards policy

The first example scenario involves a fictional retail store's customer rewards policy. This is a business policy that dictates the type of discounts available to customers with different purchasing histories.

A server provisioning policy

The second example scenario deals with an IT shop's allocation of server resources. This is an IT policy that dictates when to add and remove servers depending on the number of users connected to the system, as well as other pertinent conditions.


Breaking down the scenarios

This section creates examples of the scenarios and breaks each down into their respective if-then statements, which eventually become the Condition and Decision components of the policy documents. For a full explanation of these elements, see "How to write a complete XML policy using PMAC" in Resources.

Creating the if-then statements

For both scenarios, you need to create an if-then statement that best sums up what the business or IT rule is trying to accomplish. This can be a somewhat subjective process, depending upon the complexity of a given scenario; therefore, heuristic testing of the if-then statement is generally a good idea.

Customer rewards if-then statement

Expanding upon the scenario introduced in the Introduction to the business scenarios section for the customer rewards business rule, you could create the following example:

Listing 1. Customer rewards example
if 
   the customer spent more than $4000 in the last six months, 
   and more than $10,000 last year,
then 
   give him a 20% discount on all purchases for the next month.

OR

if 
   the customer spent over $4000 in the last six months, 
   but less than $10,000 last year,
then 
   give him a 10% discount on all purchases for the next month.

It is very important to note that PMAC policies do not have an explicit else mechanism built in. This is handled by writing a separate policy document for each if-then statement. This is explained in detail as you continue to build the policy document for the scenarios in this tutorial.

Server provisioning if-then statement

Expanding upon the scenario introduced in the Introduction to the business scenarios section for the server provisioning business rule, you could create the following example:

Listing 2. Server provisioning example
if 
   there are currently ten or less servers online,
   and there are currently more than 3000 active connections
then 
   activate eight additional servers to take the extra workload.

Constructing the policy Condition if statements

This section breaks down each of the if-then statements from the previous section into the Condition (also known as if) component of the policy document. To really understand what is going on in this section, you must be familiar with the content of the "How to write a complete XML policy using PMAC" tutorial (see Resources).

The customer reward if statement

As you did in the "How to write a complete XML policy using PMAC" tutorial (see Resources), you first need to reword the if statement in the previous section to resemble an equation. In the case of the "if the customer spent more than $4000 in the last six months, and more than $10000 last year" statement, you could rewrite it as such:

Listing 3. Rewriting customer reward statement
if (the customer's orders over last 6 months > $400) and 
   (the customer's orders for last year > $10,000)

That's pretty simple, right? Try to write the same sort of statement for the "if the customer spent over $4000 in the last six months, but less than $10,000 last year" condition. Check your answer by looking at the customer_if_answer.txt file from the sample code zip file that you can download from this tutorial.

The server provisioning if statement

Let's create a statement that resembles an equation for the server provisioning if statement in the previous section. The "if there are currently ten or less servers online, and there are currently more than 3000 active connections" statement could be rewritten as:

Listing 4. Rewriting server provisioning statement
if (the number of servers <= 10) and 
   (the number of active connections > 3000)

Constructing the policy Condition XML

In this section, you'll take the if statement "equations" from the previous section and convert them into PMAC Condition XML elements. To really understand what is going on in this section, you need to be familiar with the content of the "How to write a complete XML policy using PMAC" tutorial (see Resources).

The customer reward Condition XML

Let's create a few variables to represent the amount a customer spent. These are used during run time to set actual values for the policy to use when evaluating the statements. For more information on this, see Resources.

You'll use Orders_Over_Last_6_Months to represent a customer's orders over the last six months, and Orders_Over_Last_Year to represent a customer's orders over the last year. You'll use these variables as Property Sensors in the example policy. Listing 5 shows the Condition XML for the customer reward scenario:

Listing 5. Condition XML for customer reward scenario
<acpl:Condition>
   <exp:And>
      <exp:Greater>
         <exp:PropertySensor propertyName="Orders_Over_Last_6_Months"/>
         <exp:IntConstant>
            <Value>4000</Value>
         </exp:IntConstant>
      </exp:Greater>
      <exp:Greater>
         <exp:PropertySensor propertyName="Orders_Over_Last_Year"/>
         <exp:IntConstant>
            <Value>10000</Value>
         </exp:IntConstant>
      </exp:Greater>
   </exp:And>
</acpl:Condition>

If you have not yet completed the "How to write a complete XML policy using PMAC" tutorial (see Resources), this may look a bit like graffiti. But if you are familiar with the Condition structure, you can see how the PropertySensor elements are being compared to a preset constant.

The server provisioning Condition XML

Now, it is your turn to try writing a Condition. Using the server provisioning if statement from the previous section, construct your own Condition XML. Use the variables NumberOfServers and NumberOfActiveConnections to represent the current number of servers and current number of connections, respectively. Check your answer against the server_xml_answer.txt file in the sample code zip file that you can download from this tutorial.


Constructing the policy Decision then statements

The then portion of the if-then statement is the policy Decision. It determines the action to be taken given a Condition that evaluates to true. This tutorial deals with result-based policies, which tend to be fairly straightforward. For information about the different types of decisions, see the developerWorks article "An Introduction to Policy for Autonomic Computing" (see Resources).

The customer reward then statement

In the customer rewards scenario, there are two different outcomes depending on which Condition you used. Let's rewrite the first statement, "then give him a 20% discount on all purchases for the next month" as:

then discount = .20

The other statement, "then give him a 10% discount on all purchases for the next month," would translate to this:

then discount = .10

It doesn't get much simpler than that!

The server provisioning "then" statement

The server provisioning Decision is just as simple to break down as the customer reward. The statement "activate eight additional servers to take the extra workload" can be rewritten as:

then AddServersNumber = 8

where AddServersNumber is a variable that represents the number of servers to add to the configuration.


Constructing the policy Decision XML

In this section, you will take the then statements from the previous section and convert them into PMAC Decision XML elements. To really understand what is going on in this section, you must be familiar with the content of the "How to write a complete XML policy using PMAC" tutorial (see Resources).

The customer reward XML

Much like the Condition XML you created earlier, the Decision XML will use a variable, known as a Property, to represent the discount rate. You'll call this variable Discount. Listing 6 shows what the Decision XML snippet would look like:

Listing 6. Decision XML code snippet
<acpl:Decision>
   <acpl:Result>
      <acpl:Property propertyName="Discount">
         <exp:FloatConstant>
            <Value>.20</Value>
         </exp:FloatConstant>
      </acpl:Property>
   </acpl:Result>
<acpl:Decision>

The other then statement would look exactly the same, except the FloatConstant would be set to .10 rather than .20.

The server provisioning XML

Using the AddServersNumber as a variable (in other words, Property) that represents the number of servers to add to the configuration, you would get the XML snippet shown in Listing 7 for the Decision:

Listing 7. Decision XML code snippet
<acpl:Decision>
   <acpl:Result>
      <acpl:Property propertyName="AddServersNumber">
         <exp:IntConstant>
            <Value>8</Value>
         </exp:InConstant>
      </acpl:Property>
   </acpl:Result>
<acpl:Decision>

Constructing the Policy Business Value

The Business Value is not as complicated a topic as the Condition and Decision, but it does deserve mention for each of the scenarios. This section presents a business value case for each of the scenarios.

The customer reward business value

There are cases where two or more policies could evaluate to true, and the autonomic manager would need to decide which one takes precedence. For example, the customer rewards policy could use the business value to give a discount to a loyal customer before (or instead of) a new customer. I'll use a more generic business value case for this tutorial; specifically, one that rewards a customer who spends more, and ignores one who spends less. Not the smartest practice for a retail store to adopt, but it suits this tutorial just fine.

To implement this, simply create a business value that is higher for the policy that gives a 20% discount for the customer who spends more than $4000 in six months, and more than $10,000 in a year. To see this business value XML in the context of a policy document, see the customer_rewards1.xml and customer_rewards2.xml files in the sample code zip file that you can download from this tutorial.

The server provisioning business value

In the server provisioning scenario, a higher business value could grant precedence to a policy that checked for server connections and CPU utilization rate over policies that checked only one of those conditions. To see this business value XML in the context of a policy document, see the server_provisioning1.xml and server_provisioning2.xml files in the downloadable zip file.


Constructing the Policy Scope

I won't dwell on the policy scope component of the policy document, but will simply define separate scopes for each of the scenarios. This is not to take away from the importance of the scope element in PMAC, but it is beyond the scope of this tutorial to delve deeply into the scope.

The customer rewards scenario will use a scope named Customer_Rewards, and the server provisioning scenario will use Server_Provisioning. Makes sense! To see this scope XML in the context of a policy document, see the customer_rewards1.xml and customer_rewards2.xml files in the downloadable zip file.


Conclusion

In this tutorial, you have created complete policy document XML files that model real-world, fictional business and IT scenarios. You have learned to break down each of the components of an if-then statement and translate them into policy XML and to further distinguish these policies using the business value and scope elements.


Download

DescriptionNameSize
Collection of samples for this tutorialac-buspmacsource.zip56 KB

Resources

Learn

Get products and technologies

Comments

developerWorks: Sign in

Required fields are indicated with an asterisk (*).


Need an IBM ID?
Forgot your IBM ID?


Forgot your password?
Change your password

By clicking Submit, you agree to the developerWorks terms of use.

 


The first time you sign into developerWorks, a profile is created for you. Information in your profile (your name, country/region, and company name) is displayed to the public and will accompany any content you post, unless you opt to hide your company name. You may update your IBM account at any time.

All information submitted is secure.

Choose your display name



The first time you sign in to developerWorks, a profile is created for you, so you need to choose a display name. Your display name accompanies the content you post on developerWorks.

Please choose a display name between 3-31 characters. Your display name must be unique in the developerWorks community and should not be your email address for privacy reasons.

Required fields are indicated with an asterisk (*).

(Must be between 3 – 31 characters.)

By clicking Submit, you agree to the developerWorks terms of use.

 


All information submitted is secure.

Dig deeper into Tivoli (service management) on developerWorks


static.content.url=http://www.ibm.com/developerworks/js/artrating/
SITE_ID=1
Zone=Tivoli (service management), Tivoli
ArticleID=129387
ArticleTitle=Policy Management for Autonomic Computing: Solving a business problem using PMAC
publish-date=09202005