Choosing a Tool
Once you have gathered all of the information you need about the application, and if necessary created the wrapper scripts to start, stop, or monitor the application, you need to decide what tools to use to build the resource type itself. There are essentially three options:
- Generic Data Service
- SunPlex Agent Builder
- Develop source by hand
The one you choose will be dictated by the circumstances and requirements of the application as well as your own abilities and time constraints.
Generic Data Service
The GDS was introduced in Chapter 3, "Getting Started." It is essentially a prebuilt resource type that can be customized at deployment time to suit any network-aware application. In most cases it should only be used for relatively simple applications, since it cannot be heavily customized.
In particular, the monitoring probe command must simply return an integer from zero for success to 100 for complete failure (a special value of 201 will cause a request for immediate failover to another node; see the man page for SUNW.gds(5) for details).
As we saw in Chapter 3, creating an agent using GDS simply involves creating a resource of type SUNW.gds, and assigning values to the properties:
START_COMMAND STOP_COMMAND PROBE_COMMAND PORT_LIST
Resources and resource properties are discussed in more detail in Chapter 6, "Understanding the RGM."
When choosing a tool, it's worth considering that the GDS also generally has a more streamlined support model from Sun Microsystems because the programs that make up the GDS are part of the supported Sun Cluster packages.
SunPlex Agent Builder
The SunPlex Agent Builder is a tool that can be used either from the command line or with a GUI to generate source code and build a Solaris package with your resource type. Since the tool generates source code, it is possible to use the Agent Builder to provide a template for further customizing. In particular, the builder generates the resource type registration (RTR) file, [4] which can be a complex undertaking by hand.
We'll be looking at the SunPlex Agent Builder in more detail in Chapter 5, "Developing with the SunPlex Agent Builder."
Source from Scratch
If absolutely necessary, it is possible to write the code for your resource type completely from scratch, although this drastic approach is usually only really useful for cluster-aware applications.
In particular, if you decide to code from scratch, quite a few fairly repetitive functions must be coded, and the RTR file must be constructed by hand. Although this is not impossible, it can be time consuming and the combination of required, optional, defined, and undefined properties can become confusing. For this reason it's usually worthwhile to use the SunPlex Agent Builder to create a basic template, so that all of the required components are in place.