/* IBM_PROLOG_BEGIN_TAG */ /* This is an automatically generated prolog. */ /* */ /* */ /* */ /* Licensed Materials - Property of IBM */ /* */ /* (C) COPYRIGHT International Business Machines Corp. 1996,2019 */ /* All Rights Reserved */ /* */ /* US Government Users Restricted Rights - Use, duplication or */ /* disclosure restricted by GSA ADP Schedule Contract with IBM Corp. */ /* */ /* IBM_PROLOG_END_TAG */ /*===========================================================================*/ /* @(#)42 1.9 src/rsct/pem/emtools/rmapi_samples/rmapi_smpcmd.c, emtools, rsct_rady, rady2035a 6/5/98 11:25:29 */ #include #include #include #include #include /* * rmapi_smpcmd.c * * This program presents an example of using the Resource Monitor Application * Programming Interface (RMAPI). The configuration data for this monitor * is in the file RmapiSample.loadsdr. This monitor is an example of a command * based client monitor (connects to the Event Management daemon) and uses * state type variables. * * Event Management objects defined for this monitor: * * Monitor: * IBM.PSSP.SampleCmdMon # client monitor * # * Class: # * IBM.PSSP.SampleCmdClass # variable class * # * Variables: # * IBM.PSSP.SampleCmdMon.state # Valuetype state, datatype long used to * # reflect the state of the resource: * # Configured, Unconfigured, Running. * Resource Identifiers: NodeNum # Used as locator field of variable. * NAME # Name of the resource instance. * # * IBM.PSSP.SampleCmdMon.call # Valuetype state, datatype SBS used to * # reflect the state of the last command * # for this resource instance. * Resource Identifiers: NodeNum # Used as locator field of variable. * NAME # Name of the resource instance. * SBS Field: Action # Datatype long, sn=0. * # Last action attempted for this resource. * Options # Datatype char, sn=1. * # Dummy options string to put into SBS. * StateChange # Datatype long, sn=2. * # 0 if action failed, else !0. * State # Datatype long, sn=3. * # Final state of the resource (same as the state var). * * What this monitor does: rmapi_smpcmd provides an example of a command which * controls some imaginary resource. The command is used to change the "state" * of the resource to one of the following: Unconfigured, Configured, or Running, * by passing an "action" argument: config, unconfig, start, or stop. One * or both of the state variables will be updated through the RMAPI on each * invocation of this command. * * Legal state transitions (action): * Unconfigured -> Configured (config) * Configured -> Unconfigured (unconfig) * Configured -> Running (start) * Running -> Configured (stop) * * If a "legal" action is requested, the command will add both of the variables * for this resource to the Event Management client session. The IBM.PSSP.SampleCmdMon.state * variable will be added by the call ha_rr_add_var() with a value of TRANSITION and then * updated to the new state value by ha_rr_send_val(). * * If the action is "illegal" for the current state, only the IBM.PSSP.SampleCmdMon.call variable * will be updated so that the IBM.PSSP.SampleCmdMon.state variable remains unchanged. * * Parameters: * * -a Required. Possible options are config, unconfig, start or stop. This is * the action requested. * * -c Required. Possible options are Configured, Unconfigured, or Running. * Since this command does no real work, this option tells the command * what "state" the resource is in before attempting the action. * * -n Required. Used as the resource ID NAME element to uniquely * identify different instances of the resource variables. * * -o