InfoScale™ 9.0 Cluster Server Agent Developer's Guide - AIX, Linux, Solaris, Windows
- Introduction
- Agent entry point overview
- About agent entry points
- Agent entry points described
- About the action entry point
- About the info entry point
- Considerations for using C++ or script entry points
- About the agent information file
- About the ArgList and ArgListValues attributes
- Creating entry points in C++
- About creating entry points in C++
- Syntax for C++ entry points
- Agent framework primitives
- Agent Framework primitives for container support
- Creating entry points in scripts
- About creating entry points in scripts
- Syntax for script entry points
- Agent framework primitives
- VCSAG_GET_ATTR_VALUE
- Agent Framework primitives with container support
- Example script entry points
- Logging agent messages
- Building a custom agent
- Building a script based IMF-aware custom agent
- Creating XML file required for AMF plugins to do resource registration for online and offline state monitoring
- Testing agents
- Static type attributes
- About static attributes
- Static type attribute definitions
- AdvDbg
- ArgList
- State transition diagram
- Internationalized messages
- Troubleshooting VCS resource's unexpected behavior using First Failure Data Capture (FFDC)
- Appendix A. Using pre-5.0 VCS agents
Syntax for C++ action
unsigned int action(const char *res_name, const char *action_token, void **attr_val, char **args, char *action_output);
The parameters passed to the C++ action entry point are described as follows using the example that the user fires
$> hares -action res1 myaction...
from the command-line or the equivalent from the GUI.
res_name: This is an input parameter. The name of the resource in whose context the action entry point is being invoked. In the above example, res_name would be set to "res1".
action_token: This is an input parameter. This gives the name of the action that the user wants to run. In the above example, action_token would be set to "myaction".
If the user ran
$> hares -action res1 youraction ...
then the same function above will get invoked but action_token will be set to "youraction". This parameter enables different actions to be implemented for the same agent which will all get handled in the same function above.
attr_val: This is an input parameter. This contains the ArgListValues of the resource for which the action is invoked.
args: This is an input parameter. This contains the list of strings that are passed to the "-actionargs" switch when invoking the "hares -action" command.
$> hares -action res1 myaction -actionargs foo bar fubar -sys ...
would give "foo", "bar" and "fubar" in the args parameter.
action_output: This is an output parameter. Any output that the agent developer wants the user to see as a result of invoking the "hares -action" command needs to be filled into the buffer whose pointer is given by this parameter. The maximum number of characters that will be displayed to the user is 2048 (2K).
Use the VCSAgValidateAndSetEntryPoint() API to register the name of the function that implements the action entry-point for the agent.
For example:
extern "C" unsigned int res_action (const char *res_name, const char *token,void **attr_val, char **args, char *action_output) { const int output_buffer_size = 2048; // // checks on the attr_val entry point arg list // perform an action based on the action token passed in if (!strcmp(token, "token1")) { // // Perform action corresponding to token1 // } else if (!strcmp(token, "token2") { // // Perform action corresponding to token2 // } : : : } else { // // a token for which no action is implemented yet // VCSAgSnprintf(action_output, output_buffer_size, "No implementation provided for token(%s)", token); } // // Any other checks to be done // // // return value should indicate whether the ep succeeded or // not: // return 0 on success // any other value on failure // if (success) { return 0; } else { return 1; } } void VCSAgStartup() { VCSAG_LOG_INIT("VCSAgStartup"); VCSAgSetLogCategory(10051); VCSAgInitEntryPointStruct(V51); VCSAgValidateAndSetEntryPoint(VCSAgEPAction, res_action); }