Running scripts for additional checks

If you want KSYS to perform some additional checks that are specific to your environment, you can add those checks as scripts. You can specify whether those scripts must be run before or after the discovery, verification, or disaster recovery operations.

For example, if you use the Enterprise Pool resource management, you can add a customized script to update the backup host capacity and revert to older capacity values after the verification is complete. To monitor the workload that is running on the virtual machines on a specific criteria, you can add script to check the workload before and after the verification.

start of changeYou can run the scripts at site and host group levels.end of change The sample scripts are available in the /opt/IBM/ksys/samples/custom_validation/ directory.

Running scripts before or after discovery and verification operations

You can use the following attributes to add a script for additional checks during verification operations:

pre_verify
When you specify a script with this attribute, the script is run before any discovery and verification operations. You can add a pre_verify script by entering the following command syntax:
ksysmgr add script entity=site|host_group pre_verify=script_path
post_verify
When you specify a script with this attribute, the script is run after any discovery and verification operations. You can add a post_verify script by entering the following command syntax:
ksysmgr add script entity=site|host_group post_verify=script_path
The following environment variables are set when you run the pre_verify and post_verify scripts:
GDR_OPERATION_TYPE
Specifies the type of the operation that is run. This environment variable can have the following values:
GDR_DISCOVER
This value is set if the discovery operation is run. For example, when you run the following command:
ksysmgr discover site=Site1
GDR_DISCOVER_AND_VERIFY
This value is set if the discovery operation is run along with the verification operation. For example, when you run the following command:
ksysmgr discover site=Site1 verify=true
GDR_VERIFY
This value is set if the verification operation is run. For example, when you run the following command:
ksysmgr verify site=Site1
GDR_OPERATION_MODE
Specifies the mode of discovery operation. This environment variable is not valid for verification operation. This environment variable can have the following values:
GDR_QUICK_DISCOVERY
This value is set for the automatic hourly discovery operation that is run by the KSYS subsystem.
GDR_DEEP_DISCOVERY
This value is set for the automatic daily discovery operation that is run by the KSYS subsystem or a manual discovery operation.

Running scripts before or after the disaster recovery operations

You can use the following attributes to add a script for additional checks during disaster recovery operations:

start of change
pre_offline
When you specify a script with this attribute, the script is run before the virtual machines are shut down in the primary site. You can add a pre_offline script by entering the following command syntax:
ksysmgr add script entity=site|host_group pre_offline=script_path
post_offline
When you specify a script with this attribute, the script is run after all the virtual machines are shut down in the primary site. You can add a post_offline script by entering the following command syntax:
ksysmgr add script entity=host_group post_offline=script_path
pre_online
When you specify a script with this attribute, the script is run before the storage replication direction is reversed and before the virtual machines are restarted on the target site. You can add a pre_online script by entering the following command syntax:
ksysmgr add script entity=host_group pre_online=script_path
post_online
When you specify a script with this attribute, the script is run after the virtual machines are restarted on the target site. You can add a post_online script by entering the following command syntax:
ksysmgr add script entity=site|host_group post_online=script_path
end of change

For the scripts that are run at host group level, the name of the host group is also passed to the scripts by the KSYS subsystem. You can look at the sample scripts to understand how to execute operations for different host groups from the same script.