Pre-event and post-event scripts
You can specify commands or multiple user-defined scripts that execute before and after the cluster manager calls an event script.
For example, you can specify one or more pre-event scripts that run before the node_down event script is processed. When the cluster manager recognizes that a remote node is down, it first processes these user-defined scripts. One such script might designate that a message be sent to all users to indicate that performance might be affected (when adapters are swapped and when application controllers are stopped and restarted). Following the node_down event script, a post processing event script for network_up notification might be included to broadcast a message to all users that a certain system is now available at another network address.
The following scenarios are other examples of where pre-event and post-event processing is useful:
- If a node_down event occurs, this script could notify users on the server about to takeover for the downed application controller that performance might vary, or that they should seek alternate systems for certain applications.
- Due to a network being down, a custom installation might be able to reroute traffic through other machines by creating new IP routes. The network_up and network_up_complete event scripts could reverse the procedure, ensuring that the correct routes exist after all networks are functioning.
- You can stop cluster services and move resource groups to another node as a post-event script if a network failed on the local node (but otherwise the network is functioning).
Note that when writing your PowerHA® SystemMirror® pre-event or post-event scripts, none of the shell environment variables defined in /etc/environment are available to your program. If you need to use any of these variables, explicitly source them by including this line in your script:
". /etc/environment"If you plan to create pre-event or post-event scripts for your cluster, be aware that your scripts will be passed the same parameters used by the PowerHA SystemMirror event script you specify. For pre-event and post-event scripts, the arguments passed to the event command are the event name, event exit status, and the trailing arguments passed to the event command.
All PowerHA SystemMirror event scripts are maintained in the /usr/es/sbin/cluster/events directory. The parameters passed to your script are listed in the event script headers.