SEARCH DOCS
info central: your site for Collage technical info
  CASSATT.COM   INFO CENTRAL
ACTIVE RESPONSE 5.1 TOPICS BLUEPRINTS TROUBLESHOOTING DOC INDEX


 

TOC

arrow What is it?
arrow Writing a CERI client application
arrow Registering with the CERI server
arrow Processing events
arrow Handling restarts
arrow Handling failures
arrow Event types
arrow Event data definitions
arrow InitializationEvent data
arrow NodeInventoryEvent data
arrow NodeConfigurationEvent data
arrow ServiceConfigurationEvent data
 

Sidebars

arrrow Sample CERI client program
arrrow Sample CERI event output
arrrow Sample CERI scenario
know how:

Cassatt Event Registration Interface (CERI): Writing Client Programs for Use With Cassatt Active Response

Intended for use with Cassatt Active Response Standard Edition, Premium Edition and Data Center Edition V5.1.

What is it?

The Cassatt Event Registration Interface (CERI) provides a programmatic way to access Cassatt Active Response system events. You can use this interface when you want to programmatically leverage Cassatt Active Response events to trigger other actions in your environment. For example, say you want to populate a site CMDB with inventory data collected by Cassatt Active Response, to communicate with load balancing software to modify application node configuration, or to otherwise modify behavior based on the state of application nodes in a Cassatt Active Response environment. You just need to write a client program that registers with the CERI server, interprets the incoming event stream, and modifies system behavior or configuration based on those events.

The CERI is a set of Java library classes and methods needed to register and authenticate requests from a calling application. CERI is available on the Cassatt Active Response distribution media as a JAR file. You simply place the JAR where you want your client program to run, ensure the JAR is in the classpath, and execute your client program. The JAR also includes a sample program. If you want to see the entire program, click Sample CERI client program, but I will highlight key sections of it in this article. (There is also a sample shell script named watch that you can use to run the sample program. Just modify the classpath and connection parameters for your site before running the program. Then it will output the various events provided by CERI.)

top

Writing a CERI client application

A CERI client program minimally needs to do the following to successfully communicate with the CERI server and receive Cassatt Active Response events:

  • Register with the CERI server on the control node via the registerClient() method.
  • Implement the following three public interface methods:
    • processEvent() – this method does the bulk of the work for your client program. Based on the Cassatt Active Response events it receives, you can trigger other actions (defined by the processEvent() method) in your environment to meet your configuration goals.
    • reStart() – this method is used to notify the client application that a Cassatt Active Response control node restart is going to occur and to expect a new initialization event when the control node comes back online.
    • unregistered() – this method is called when the CERI server unregisters a client that has thrown an exception. The CERI server returns the exception to the client via the unregistered() method. To start receiving events again, the client application needs to re-register with the CERI server.

The CERI client JAR file provides a Java interface class named EventReceiver that defines these methods. A CERI client application must pass an implementation class of this interface to the registerClient() method to successfully register with the CERI server.

Now, let's take a look at the sample program in the CERI JAR file to see how to register and implement these methods.

top

Registering with CERI server

The sample program is called CollageEventWatcher. In it, you'll see the following try block, which registers with CERI and then enters a loop to receive events as they are supplied by Cassatt Active Response, and then unregisters the client. Notice that the registerClient() method includes user, password, and host access information. This information is used by the CERI server to authenticate the client registration.

try {
    NotificationClient.registerClient(user, pw, host, rmiPort, 
                                   namingPort, eventReceiver);
    if (verbose) {
        System.err.println("Registration request complete.");
        System.err.println("");
 }
while (true) {
   // keep alive
   for (int i = 0; i < LOOPS; i++) {
      try {
          Thread.sleep(SLEEP_INTERVAL);
      } catch (final InterruptedException ie) {
    // deliberately ignored
      }
   }
}
} catch (Exception e) {
      if (verbose) {
         System.err.println("Failed to register event 
                        receiver with Collage: " + e);
   }
} finally {
      NotificationClient.unregisterClient(
                       eventReceiver.getReceiverId());
      if (verbose) {
         System.err.println("Unregistered event receiver 
            with Collage: " + eventReceiver.getReceiverId());
      }
 }
}                   

top

Processing events

The first method you must implement in your CERI client program is processEvent(). The processEvent() method does the work of your CERI client program. In the sample client program, processEvent() simply prints events as they are reported from the CERI server. In your own program, this is where you would put the logic to modify your site configuration or system behavior. The receiverID is the unique ID CERI assigns to each event receiver. This ID is needed for the client to unregister with CERI.

     public void processEvent(final UUID myReceiverId, final Event event) {
         System.out.println("CollageEventWatcher received event: ");
         System.out.println(event);
         System.err.println("");
         receiverId = myReceiverId;
     }

top

Handling restarts

The second method you must implement is reStart(). This method is used in the case where the Cassatt Active Response control node has been restarted. The reStart() method serves as an indicator to the client to expect an initialization event after the Cassatt Active Response restart occurs. Here's the implementation of reStart() from the sample CERI client program:

     public void reStart(final UUID myReceiverId) {
        System.out.println("CollageEventWatcher notified of a re-start.");
     }

top

Handling failures

The last method you are obligated to implement is the unregistered() method. This method is used by CERI to pass back debug data when the client operation fails. If the client does not call the unregisteredClient() method, CERI will unregister the client after it looses communication (for example, on a failed attempt to invoke processEvent() on the client).

     public void unregistered(final Throwable throwable) {
        System.out.println("CollageEventWatcher un-registered with cause: " + throwable);
     }

top

Event types

CERI provides the following types of events to client programs:

Event type Provided when... Data provided
InitializationEvent A CERI client application registers with the CERI server. Provides an initial snapshot of the Cassatt Active Response environment, including node inventory, node configuration, and service information.
NodeInventoryEvent A node in the Cassatt Active Response environment is inventoried. Provides the application node name, IP-to-NIC map, and inventory data such as CPU, disk, hardware, etc. CERI reports inventory data in an XML format that is described by the XML Schema Definition (XSD) included with the CERI client JAR file.
NodeConfigurationEvent An application node is added, removed, allocated, deallocated, started, or stopped in the Cassatt Active Response environment. Provides application node name, IP-to-NIC map, service name, image name, and image version.
ServiceConfigurationEvent A service is added, removed, allocated, deallocated, started, or stopped in the Cassatt Active Response environment. Provides service name, image name, image version, list of IP-to-NIC maps available to the service.

You can look at the sidebar Sample event output to see how the CERI server outputs events. Now, though, let's examine the data provided by each type of Cassatt Active Response event.

top

Event data definitions

The following tables show the data provided by each type of event.

InitializationEvent data

Event data CERI server returns...
nodeInventory[]
A list of NodeInvenoryEvents, one for each node in the Cassatt Active Response environment. (See below for more on the inventory event.)
nodeConfiguration[]
A list of NodeConfigurationEvents, one for each node configured for use with a service. (See below for more on the node configuration event.)
serviceConfiguration[]
A list of ServiceConfigurationEvents, one for each service in the user domain. (See below for more on the node configuration event.)
type
EventType enumeration with value of INITIALIZATION identifying this event as the initialization event.
time
Not supplied in the initialization event.
source
String identifying the Cassatt Active Response build version as the source of the event (e.g. Cassatt Active Response 4.1.1).
class
The Cassatt Active Response event class included in the CERI jar that defines this event (i.e. com.cassatt.blt.client.notification.InitializationEvent).

top

NodeInventoryEvent data

Event data CERI server returns...

inventory

 
architecture =
The architecture type of the application node: e.g., ia32, sparc, etc.
hba =
True if the server has a Host Bus Adapter (HBA). Otherwise, false.
mem_kb =
The size in kilobytes of the application node's RAM.
nic
 
bonded =

True if this NIC is on the same LAN/VLAN as the NIC from which Cassatt Active Response booted. Otherwise, false.

booted =
True if this NIC is on the same LAN/VLAN as the NIC from which Cassatt Active Response booted. Otherwise, false.
mac =
The MAC address of the NIC.
name =
The name of the NIC as stored by the Cassatt Active Response inventory (e.g., eth0, bge0, etc.)
cpu
 
mhz =
The megahertz of the CPU.
model_name =
The hardware cpu model (e.g. Intel(R) Xeon(TM) CPU 2.40GHz, AMD, Opteron, etc.).
disk
 
dev_path =
The device path as stored by the Cassatt Active Response inventory (e.g., /dev/sda, /dev/rdsk/c1t0d0)
size_kb =
The size in kilobytes of the application node's disk.
type =

Local for directly attached disks. SAN for FC connected disks.

partition
 
dev_path =
The device path of this partition on the disk (e.g., /dev/sda1, /dev/rdsk/c1t0d0s1)
size_kb =
The size in kilobytes of the this partition.
power
 
ipaddress =
The IP address of the application node's power controller.
jmxsubtype =
The type of the power controller (e.g., dell_drac, hp_ilo,
ibm_bcmm, etc.).
mac =
The MAC address of the application node's power controller.
customAttributes[]
Array of string attribute values the user has added to the node.
nodeName
The display name of the node the inventory data defines.
serviceName
The name of the service or pool to which the node is currently allocated.
imageName
The name of the image associated to the node.
imageVersion
The version of the image associated to the node.
ipNicMacs
A mapping of the list of MAC addresses assigned to each IP address for the node.
type
EventType enumeration with value of NODE_INVENTORY identifying this event as a node inventory event.
time
The time the node inventory was received by Cassatt Active Response. Null if the inventory event is contained within an InitializationEvent.
source
String identifying the Cassatt Active Response build version as the source of the event (e.g. Cassatt Active Response 4.1.1).
class
The Cassatt Active Response event class included in the CERI jar that defines this event (i.e. com.cassatt.blt.client.notification.NodeInventoryEvent).

CERI returns inventory data in an XML string. This data is defined in the XSD included in the CERI JAR file.

top

NodeConfigurationEvent data

Event data CERI server returns...
actionType
ActionType enumeration defining the type of configuration change received for the node. Valid values are: ADDED, REMOVED, ALLOCATED, DEALLOCATED, STARTED, STOPPED.
nodeName
The display name of the node being configured.
serviceName
The name of the service or pool to which the node is currently allocated.
imageVersion
The name of the image associated to the node.
ipNicMacMaps
The name of the image associated to the node.
type
A mapping of the list of MAC addresses assigned to each IP address for the node.
time
EventType enumeration with value of NODE_CONFIGURATION identifying this event as a node configuration event.
source
The time of the node configuration change. Null if the configuration event is contained within an InitializationEvent.
class
The Cassatt Active Response event class included in the CERI jar that defines this event (i.e. com.cassatt.blt.client.notification.NodeConfigurationEvent).

top

ServiceConfigurationEvent data

Event data CERI server returns...
actionType
ActionType enumeration defining the type of configuration change received for the service. Valid values are: ADDED, REMOVED, ALLOCATED, DEALLOCATED, STARTED, STOPPED.
serviceName
The display name of the service being configured.
imageName
The name of the image used by the service.
imageVersion
The version of the image used by the service.
ipNicMacMaps
A map for each image instance IP defined for the service containing the mapping of the list of MAC addresses assigned to each IP address for the node or image instance (i.e. unallocated IP).
type
EventType enumeration with value of SERVICE_CONFIGURATION identifying this event as a service configuration event.
time
The time of the service configuration change. Null if the configuration event is contained within an InitializationEvent.
source
String identifying the Cassatt Active Response build version as the source of the event (e.g. Cassatt Active Response 4.1.1).
class
The Cassatt Active Response event class included in the CERI jar that defines this event (i.e. com.cassatt.blt.client.notification.ServiceConfigurationEvent).

top