# Plain Agent Use Case Example

# Configure the WLOC Resource Environment

In a WLOC environment, resource pools provide a virtual environment in which you can deploy WLOC services. Each resource pool provides access to physical computing resources (such as CPU cycles, memory, and disk space) and pre-installed software that a service needs to run.

To establish a WLOC resource environment, you need to configure a controller and one or more agents. You can do so using the WLOC Configuration Wizard. When you configure an Agent, you configure its resource pool. A Plain Agent manages the computing resources for the physical machine on which the Agent is installed.

When you configure the Controller, you bind it to the Agents so that it can get information about the resources and deploy services accordingly.

The Controller also hosts the WLOC Administration Console, which provides a graphical interface into the WLOC environment.

In this example, we will install and create a Plain Agent and a Controller on the same local Windows machine. For instructions about installing WLOC and starting the Configuration Wizard on UNIX or Linux platforms, see the following:

- WLOC Installation Guide.
- “Configuring the Controller and Agents” in the Configuration Guide

The main steps in this topic include:

- Step 1: Install WLOC
- Step 2: Create the Plain Agent
- Step 3: Create the Controller

## Step 1: Install WLOC

In this example, we will install the Plain Agent and the Controller on the same local Windows machine. When you perform a Complete installation, all of the WLOC components are installed automatically. For details about installing WLOC, see the WLOC Installation Guide.

If the Plain Agent is managing resources on a different machine, be sure to install the Agent software on that machine.

In this example, we install WLOC into the `C:\WLOC_UseCase` directory.

After you install the agent and the controller software, you create them using the WLOC Configuration Wizard.

## Step 2: Create the Plain Agent

To create the Plain Agent, complete the following steps:

1. From the Start Menu, select Start > All Programs > WebLogic Operations Control 10gR3 > WLOC Configuration Wizard.

2. In the Welcome window, click Next.
3. In the Choose Controller or Agent window, select Create a new Agent for this host and click Next.

4. In the Enter Agent Directory Location window, specify the path to the directory for the Agent and click Next.

By default, this directory is created in `BEA_HOME`\`user_projects\agent1`, but you can specify any name and directory location you choose.

Note that we used `C:\WLOC_UseCase` as the `BEA_HOME` directory when we installed the WLOC software, therefore that `BEA_HOME` value is displayed as the default.

For this example, we accept the default `C:\WLOC_UseCase\user_projects` location, and change the name of the directory to PlainAgent.

5. In the Configure Agent Connection Details window, specify the connection information shown in Table 2-1 for the Plain Agent.

Note: | In this example, we do not need to select the Secure setting for the Security mode field because we do not need to use SSL between the Agent and the Controller. However, in a production environment, you need to use the secure settings, and set the passwords and passphrases accordingly. For details about secure communications, see “Configuring Security” in the Configuration Guide.

Table 2-1 Agent Connection Information
In this field . . . | Enter the following value . . .
--- | ---
Agent Name | PlainAgent
Agent Host | The URL for the host machine. In this example we use `localhost`
Agent Port | 8001 (the default)
Agent Secure Port | 8002 (the default)
Transfer Encryption Passphrase | Default
Confirm Transfer Encryption Passphrase | Default
Security Mode | Unsecure (default)

6. Click Next in the following two windows to accept the defaults:

- Configure Agent Logging
- Configure Agent Keystore Passwords

7. In the Configure Agent Type window, select Plain Agent and click Next.

8. In the Configure Plain Agent (1 of 2) window, provide a name for the resource pool associated with this Agent and the CPU capacity available to the resource pool, as shown in the following table:

Table 2-2 Plain Agent Resource Pool Configuration
In this field . . . | Enter the following value . . .
--- | ---
Resource Pool Name | plain-resource-pool
Description | plain resource pool
CPU capacity (MHz) | The CPU capacity for your machine. In this example we specify 512.
Stdout Directory | Accept the default
Stderr Directory | Accept the default

9. In the Configure Plain Agent (2 of 2) window, you specify the available software you want to include in the resource pool. For this example, do not specify any additional software and click Next.

10. In the Create Agent Configuration window, click Create.

11. After the Agent has been created, click Done to exit the WLOC Configuration Wizard.

### Agent Directory Structure

After completing the Plain Agent installation and creation, the following directory structure is created in the `C:\WLOC_UseCase\user_projects\PlainAgent` directory.

Table 2-2 describes the contents of these directories.

Table 2-3 Agent Directory Description
Directory | Description
--- | ---
`bin` | Commands to start the Agent, and to install and remove the Agent as a Windows service.
`config` | Agent configuration files.
`keys` | Encryption key used to encrypt clear text passwords.
`logs` | Agent log files.
`ssl` | Internal digital certificate and keystores for the Agent used for SSL communication with the Controller.

### Agent Configuration File

When you create an Agent using the WLOC Configuration Wizard, the configuration is persisted in an XML file named `loc-agent-config.xml`. In this example, the file is created in the following directory:

`C:\WLOC_UseCase\user_projects\PlainAgent\config`

where:

`WLOC_UseCase` is the BEA Home directory containing the WLOC installation, and `PlainAgent` is the name that we specified for the Agent Directory location in the Configuration Wizard.

After you have created the Agent using the Configuration Wizard, it can be modified using the Administration Console or by directly editing its configuration file.

The `loc-agent-config.xml` file created in this example is shown in Listing 2-1

Listing 2-1 Sample loc-agent-config.xml File

    <?xml version="1.0" encoding="UTF-8"?><loc-agent xmlns="bea.com/loc/agent" xmlns:loc="http://bea.com/loc">
      <name>PlainAgent</name>
      <description>PlainAgent</description>
      <network>
        <loc:host>localhost</loc:host>
        <loc:components>
          <loc:component>
            <loc:name>ListenPorts</loc:name>
            <loc:description>ListenPorts</loc:description>
            <loc:port>8001</loc:port>
            <loc:secure-port>8002</loc:secure-port>
          </loc:component>
        </loc:components>
      </network>
      <use-secure-connections>false</use-secure-connections>
      <logging>
        <loc:file-severity>Info</loc:file-severity>
        <loc:base-file-name>C:\WLOC_UseCase/user_projects/PlainAgent/logs/Agent.log</loc:base-file-name>
        <loc:rotation-type>BySize</loc:rotation-type>
        <loc:rotation-size>5000</loc:rotation-size>
        <loc:rotation-time>00:00</loc:rotation-time>
        <loc:file-rotation-dir>./logs/logrotdir</loc:file-rotation-dir>
        <loc:number-of-files-limited>true</loc:number-of-files-limited>
        <loc:rotated-file-count>5</loc:rotated-file-count>
        <loc:rotation-time-span>24</loc:rotation-time-span>
        <loc:rotation-time-span-factor>3500000</loc:rotation-time-span-factor>
        <loc:rotation-on-startup-enabled>true</loc:rotation-on-startup-enabled>
        <loc:stdout-severity>Info</loc:stdout-severity>
      </logging>
      <audit>
        <loc:base-file-name>./logs/audit.log</loc:base-file-name>
        <loc:rotation-type>BySize</loc:rotation-type>
        <loc:rotation-size>300</loc:rotation-size>
        <loc:rotation-time>00:00</loc:rotation-time>
        <loc:file-rotation-dir>./logs/logrotdir</loc:file-rotation-dir>
        <loc:number-of-files-limited>true</loc:number-of-files-limited>
        <loc:rotated-file-count>50</loc:rotated-file-count>
        <loc:rotation-time-span>24</loc:rotation-time-span>
        <loc:rotation-time-span-factor>50</loc:rotation-time-span-factor>
        <loc:rotation-on-startup-enabled>true</loc:rotation-on-startup-enabled>
        <loc:enabled>true</loc:enabled>
        <loc:scope>
          <loc:type>All</loc:type>
        </loc:scope>
      </audit>
      <work-managers>
        <loc:work-manager>
          <loc:name>WM</loc:name>
          <loc:description>WM</loc:description>
          <loc:max-threads-constraint>64</loc:max-threads-constraint>
          <loc:min-threads-constraint>3</loc:min-threads-constraint>
        </loc:work-manager>
        <loc:work-manager>
          <loc:name>ResourceBrokerAgent-WM</loc:name>
          <loc:description>ResourceBrokerAgent-WM</loc:description>
          <loc:max-threads-constraint>15</loc:max-threads-constraint>
          <loc:min-threads-constraint>3</loc:min-threads-constraint>
        </loc:work-manager>
        <loc:work-manager>
          <loc:name>AgentRuntime-WM</loc:name>
          <loc:description>AgentRuntime-WM</loc:description>
          <loc:max-threads-constraint>15</loc:max-threads-constraint>
          <loc:min-threads-constraint>3</loc:min-threads-constraint>
        </loc:work-manager>
      </work-managers>
      <encryption>
        <password>{Salted-3DES}8U+L9mNDmAFoUayTkWaFOQ==</password>
      </encryption>
      <resource-pools>
        <plain-resource-pool>
          <name>resource-resource-pool</name>
          <description>plain resource pool</description>
          <cpu-capacity>512</cpu-capacity>
          <stdout-dir>C:\WLOC_UseCase\user_projects\PlainAgent\stdout</stdout-dir>
          <stderr-dir>C:\WLOC_UseCase\user_projects\PlainAgent\stderr</stderr-dir>
        </plain-resource-pool>
      </resource-pools>
    </loc-agent>

For information about the elements of the `loc-agent-config.xml` Agent configuration file, see the Agent Configuration Schema Reference.

## Step 3: Create the Controller

Every WLOC environment includes a single Controller and one or more Agents. The Controller is the central component that gathers data about the operating environment from Agents. The Controller uses the data that it gathers to intelligently deploy new services and to evaluate and enforce policies for all services in the environment. The Controller also hosts the WLOC Administration Console.

Although you can install the Agent and the Controller on different physical machines, in this example, we installed the Controller as part of a complete installation on the local machine as described in Step 1: Install WLOC. After the controller is installed, you create it using the WLOC Configuration WIzard.

To create the Controller, complete the following steps:

1. From the Start Menu, select Start > All Programs > WebLogic Operations Control 10gR3 > WLOC Configuration Wizard.

2. In the Welcome window, click Next.
3. In the Choose Controller or Agent window, select Create the Controller or extend the existing Controller for this host and click Next.

4. In the Enter Controller Directory Location window, we accept the default path and filename for the Controller and click Next.

5. In the Enter Controller Connection Data window, specify the following connection information for the Controller.

Table 2-4 Controller Connection Information
In this field . . . | Enter the following value . . .
--- | ---
Controller Host | localhost
Console Port | 9001 (the default)
Console Secure Port | 9002 (the default)
Console Mode | Both
Internal Port | 9003 (the default)
Internal Secure Port | 9004 (the default)
Security Mode | Unsecure (default)

6. Accept the default options in the following windows and click Next:

- Configure Controller Logging
- Configure Controller Notifications (1 of 3)
- Configure Controller Notifications (2 of 3)
- Configure Controller Notifications (3 of 3)

7. In the Configure Agents for this Controller window, click Add to bind the Plain Agent we created to this Controller. The fields are populated with the default data for your machine. Edit the fields as follows:

Note: | To edit a field, you need to double-click the value in the field.

1. Enter PlainAgent in the Name field.
2. Enter localhost in the Agent’s Hostname field.
3. Accept the defaults for the remaining fields.
4. Click Next.

Note that the passphrase specified here must match the passphrase that you defined when you created the Agent. Because we accepted the default when we created the Agent, we can accept the same default here.

8. Click Next in the Use SSH for WLOC ESX Agents window. In this example, only a Plain Agent is configured.
9. In the Enter User Data window, specify a username and password for the boot user. For this example, accept the defaults.

Note: | The default username is WLOCBootUser and the default password is changeit:

10. In the Configure Controller KeyStore Passwords, accept the default passwords and click Next.

Note: | The default passwords are changeit.

11. In the Create Controller Configuration window, click Create.

12. After the Controller has been created, click Done to exit the WLOC Configuration Wizard.

### Controller Directory Structure

After completing the Controller installation and creation, the following directory structure is created in the `C:\WLOC_UseCase\user_projects\controller` directory.

Table 2-2 describes the contents of these directories.

Table 2-5 Controller Directory Description
Directory | Description
--- | ---
`bin` | Commands to start the Controller, and to install and remove the Controller as a Windows service.
`config` | Controller configuration files.
`keys` | Encryption keys used to encrypt clear text passwords and data.
`logs` | Controller log files.
`ssl` | Internal digital certificate and keystores for the Controller used for SSL communication with the Agents.

### Controller Configuration File

When you create a Controller using the WLOC Configuration Wizard, the configuration is persisted in an XML file named `loc-controller-config.xml`. In this example, the file is created in the following directory:

`C:\WLOC_UseCase\user_projects\controller\config`

where:

`WLOC_UseCase` is the BEA Home directory containing the WLOC installation, and `controller` is the name that we specified for the Controller Directory location in the Configuration Wizard.

After you have created the Controller using the Configuration Wizard, it can be modified using the Administration Console or by directly editing its configuration file.

The `loc-controller-config.xml` file created in this example is shown in Listing 2-2.

Listing 2-2 Sample loc-controller-config.xml File

    <?xml version="1.0" encoding="UTF-8"?><loc-controller xmlns="bea.com/loc/controller" xmlns:loc="http://bea.com/loc">
      <network>
        <loc:host>localhost</loc:host>
        <loc:components>
          <loc:component>
            <loc:name>Console</loc:name>
            <loc:description>Console</loc:description>
            <loc:port>9001</loc:port>
            <loc:secure-port>9002</loc:secure-port>
          </loc:component>
          <loc:component>
            <loc:name>InternalCommunication</loc:name>
            <loc:description>InternalCommunication</loc:description>
            <loc:port>9003</loc:port>
            <loc:secure-port>9004</loc:secure-port>
          </loc:component>
        </loc:components>
      </network>
      <use-secure-connections>false</use-secure-connections>
      <console-mode>BOTH</console-mode>
      <logging>
        <loc:file-severity>Info</loc:file-severity>
        <loc:base-file-name>C:/WLOC_UseCase/user_projects/controller/logs/Controller.log</loc:base-file-name>
        <loc:rotation-type>BySize</loc:rotation-type>
        <loc:rotation-size>500</loc:rotation-size>
        <loc:rotation-time>00:00</loc:rotation-time>
        <loc:file-rotation-dir>./logs/logrotdir</loc:file-rotation-dir>
        <loc:number-of-files-limited>true</loc:number-of-files-limited>
        <loc:rotated-file-count>5</loc:rotated-file-count>
        <loc:rotation-time-span>24</loc:rotation-time-span>
        <loc:rotation-time-span-factor>3500000</loc:rotation-time-span-factor>
        <loc:rotation-on-startup-enabled>true</loc:rotation-on-startup-enabled>
        <loc:stdout-severity>Info</loc:stdout-severity>
      </logging>
      <audit>
        <loc:base-file-name>./logs/audit.log</loc:base-file-name>
        <loc:rotation-type>BySize</loc:rotation-type>
        <loc:rotation-size>300</loc:rotation-size>
        <loc:rotation-time>00:00</loc:rotation-time>
        <loc:file-rotation-dir>./logs/logrotdir</loc:file-rotation-dir>
        <loc:number-of-files-limited>true</loc:number-of-files-limited>
        <loc:rotated-file-count>50</loc:rotated-file-count>
        <loc:rotation-time-span>24</loc:rotation-time-span>
        <loc:rotation-time-span-factor>50</loc:rotation-time-span-factor>
        <loc:rotation-on-startup-enabled>true</loc:rotation-on-startup-enabled>
        <loc:enabled>true</loc:enabled>
        <loc:scope>
          <loc:type>ControllerConfiguration</loc:type>
          <loc:type>ServiceConfiguration</loc:type>
          <loc:type>Rules</loc:type>
          <loc:type>ControllerAction</loc:type>
          <loc:type>Adjudication</loc:type>
          <loc:type>AgentConfiguration</loc:type>
        </loc:scope>
      </audit>
      <work-managers>
        <loc:work-manager>
          <loc:name>WM</loc:name>
          <loc:description>WM</loc:description>
          <loc:max-threads-constraint>64</loc:max-threads-constraint>
          <loc:min-threads-constraint>3</loc:min-threads-constraint>
        </loc:work-manager>
        <loc:work-manager>
          <loc:name>ResourceBroker-WM</loc:name>
          <loc:description>ResourceBroker-WM</loc:description>
          <loc:max-threads-constraint>15</loc:max-threads-constraint>
          <loc:min-threads-constraint>3</loc:min-threads-constraint>
        </loc:work-manager>
        <loc:work-manager>
          <loc:name>Action-Purge-WM</loc:name>
          <loc:description>Action-Purge-WM</loc:description>
          <loc:max-threads-constraint>15</loc:max-threads-constraint>
          <loc:min-threads-constraint>3</loc:min-threads-constraint>
        </loc:work-manager>
        <loc:work-manager>
          <loc:name>ExecuteEngine-WM</loc:name>
          <loc:description>ExecuteEngine-WM</loc:description>
          <loc:max-threads-constraint>15</loc:max-threads-constraint>
          <loc:min-threads-constraint>3</loc:min-threads-constraint>
        </loc:work-manager>
        <loc:work-manager>
          <loc:name>ProcessRuntime-WM</loc:name>
          <loc:description>ProcessRuntime-WM</loc:description>
          <loc:max-threads-constraint>15</loc:max-threads-constraint>
          <loc:min-threads-constraint>3</loc:min-threads-constraint>
        </loc:work-manager>
        <loc:work-manager>
          <loc:name>Actions-WM</loc:name>
          <loc:description>Actions-WM</loc:description>
          <loc:max-threads-constraint>15</loc:max-threads-constraint>
          <loc:min-threads-constraint>3</loc:min-threads-constraint>
        </loc:work-manager>
      </work-managers>
      <heartbeat-interval>20</heartbeat-interval>
      <reconnect-attempts>3</reconnect-attempts>
      <agents>
        <agent>
          <name>PlainAgent</name>
          <host>localhost</host>
          <port>8001</port>
          <secure-port>8002</secure-port>
          <state>Enabled</state>
          <password>{Salted-3DES}P6sAuDdtOnRp7Q/eDWnhKg==</password>
        </agent>
      </agents>
      <lvm-ssh-config>
        <public-key-file/>
      </lvm-ssh-config>
      <notification>
        <smtp>
          <name>LOC EMail Notification Service</name>
          <description>LOC EMail Notification Service</description>
          <to-address>bogus</to-address>
          <from-address>bogus</from-address>
          <smtp-server>bogus</smtp-server>
          <enabled>false</enabled>
        </smtp>
        <jms>
          <name>LOC JMS Notification Service</name>
          <description>LOC JMS Notification Service</description>
          <destination-jndi-name>com.bea.adaptive.loc.notification.JMSNotifier</destination-jndi-name>
          <connection-factory-jndi-name>QueueConnectionFactory</connection-factory-jndi-name>
          <jndi-properties>
            <initial-factory>org.mom4j.jndi.InitialCtxFactory</initial-factory>
            <provider-url>bogus</provider-url>
            <security-principal>bogus</security-principal>
            <password>{Salted-3DES}ZlcPX6S/hpM=</password>
          </jndi-properties>
          <enabled>false</enabled>
        </jms>
        <jmx>
          <name>JMX Notification Service</name>
          <description>JMX Notification Service</description>
          <enabled>false</enabled>
        </jmx>
        <snmp>
          <name>LOC SNMP Notification Service</name>
          <description>LOC SNMP Notification Service</description>
          <agent>
            <name>MySNMPAgent</name>
            <description>MySNMPAgent</description>
            <host>bogus</host>
            <port>5555</port>
            <trap-version>SNMPv2</trap-version>
            <enable-inform>false</enable-inform>
          </agent>
          <trap-destinations>
            <destination>
              <name>testTrapDest</name>
              <description>testTrapDest</description>
              <host>bogus</host>
              <port>5555</port>
              <community>public</community>
              <security-level>noAuthNoPriv</security-level>
            </destination>
          </trap-destinations>
          <enabled>false</enabled>
        </snmp>
      </notification>
    </loc-controller>

For information about the elements of the `loc-controller-config.xml` Controller configuration file, see the Controller Configuration Schema Reference.

## What’s Next?

After installing and creating the Plain Agent and Controller, go to Establish the WLOC Runtime Environment, which describes how to start the Agent, the Controller, and the WLOC Administration Console.