In this section we will create an application resource using "sysman caa".
# sysman caa
Figure 24-2 shows the main window you will see when starting "sysman caa".
Figure 24-2: CAA Main Window
Table 24-1 shows the main menu button and the caa_* command that will be executed.
|
The main CAA window displays the currently registered resources and their state. To create a new resource, select the button, which will bring a popup window as shown in Figure 24-3. To see the equivalent caa_* commands that can be used in lieu of the buttons on the setup menu, see Table 24-1.
Figure 24-3: CAA Setup Window
Adding a resource using "sysman caa" is as simple as clicking on the button from the setup screen (Figure 24-3) which will popup the "Add" window as shown in Figure 24-4.
Figure 24-4: CAA Setup: Add Resource Popup and Resource Type Pulldown Menu
Choose a resource name that is unique and relatively descriptive.
In our example we have chosen to call our resource "memberUP" to indicate that a member is up if this resource is running somewhere in the cluster.
Select the resource type using the pulldown menu.
In this example we will create an application resource.
Click on the button to continue – this will pop up the window illustrated in Figure 24-5.
Figure 24-5: CAA Setup Resources
The next step is to input the required profile attribute that does not have a default value.
Resource | Required Resource Attribute without a default value | |
---|---|---|
| ||
Application | – | ACTION_SCRIPT |
Changer | – | DEVICE |
Network | – | SUBNET |
Tape | – | DEVICE |
In our case, we will choose the application name to manage and the action script name. For a more complex application we would likely write our own action script. However, since we will be using a very simple Tcl/Tk application that we wrote (see section 24.2.1), we will choose to have a default action script generated, and we will simply indicate the path to our application. Choosing to generate a default action script causes "sysman caa" to copy the template.scr script from the /var/cluster/caa/template directory and inserts the application name and resource name in the appropriate spots within the script.
# grep -E "memberUP|xhostname" /var/cluster/caa/script/memberUP.scr SERVICE_NAME="memberUP" PROBE_PROCS="/code/caa/xhostname" START_APPCMD="/code/caa/xhostname"
Note that the action script name is the name resource name with a ".scr" extension. Also note that the script will be located in the /var/cluster/caa/script directory by default. We recommend that all action scripts remain in this default directory.
At this point you can choose to take the default profile attributes by clicking the button. Or you can choose to customize the profile attributes by clicking the button.
The Options popup window includes the default values for the remaining attributes. The Options popup window for each resource type is shown in Figure 24-6.
Figure 24-6: CAA Resource Options Pages
In our simple application resource we will take all of the default values except that we will add a resource description (the DESCRIPTION profile attribute). After adding the text for the resource description, click the button – this will return you to the Resource Setup popup window (Figure 24-5). Click the button again and the resource will be created (see Figure 24-7).
Figure 24-7: CAA Informational Popup
You will then be prompted to register the resource as shown in Figure 24-8.
Figure 24-8: CAA Resource Registration Popup and Start Resource Informational Popup
There will be another informational popup letting you know that the registration was successful. It will look similar to the one shown in Figure 24-7 before the reminder to start the resource (the far right popup in Figure 24-8).
Before we can start the "memberUP" resource, we need to make a couple of minor changes. The application that we chose to use — xhostname — is a typical X Window System application that is designed to run in the foreground; therefore we will need to modify the action script to launch xhostname in the background. Failure to do this would result in an action script timeout and would return an error to the resource manager, a condition that should be avoided. Furthermore, since this is an X Window System application, it will require that we set the DISPLAY environment variable.
# diff memberUP.scr memberUP.scr.orig 315,316d314 < export DISPLAY="delenn:0.0" < 322c320 < out=$($START_APPCMD)& --- > out='$START_APPCMD'
The diff(1) command above shows where we added the DISPLAY environment variable and where we modified the line where the application is started by inserting an ampersand (&). Note that we also replaced the grave accent (') command substitution to the "$()" syntax for clarity.
Once the resource is created, select the resource and register the resource by pressing the button as shown in Figure 24-3. Finally, you can start, stop, and relocate a resource by clicking on the appropriate button in the main CAA window as shown in Figure 24-2.