#!/usr/bin/ksh93 # ALTRAN_PROLOG_BEGIN_TAG # This is an automatically generated prolog. # # Copyright (C) Altran ACT S.A.S. 2019,2020,2021. All rights reserved. # # ALTRAN_PROLOG_END_TAG # # IBM_PROLOG_BEGIN_TAG # This is an automatically generated prolog. # # 61haes_r720 src/43haes/usr/sbin/cluster/sa/wmq/sbin/cl_wmq_config.sh 1.12 # # Licensed Materials - Property of IBM # # COPYRIGHT International Business Machines Corp. 2011 # 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 # @(#) 7d4c34b 43haes/usr/sbin/cluster/sa/wmq/sbin/cl_wmq_config.sh, 726, 2147A_aha726, Feb 05 2021 09:50 PM #################################################################################### # # NAME: # cl_wmq_config # # PURPOSE: # Create PowerHA SystemMirror configuration for WebSphere MQ server. # This script configures WebSphere MQ server Resource Group with # Application server and Service IP provided by user as service IP address. # Also, finds and adds WebSphere MQ listeners associated with Queue Manager. # # ARGUMENTS: # -a Application name # -m MQM instance name # -p Primary Node for WebSphere MQ server RG # -t Take over Node(s) for WebSphere MQ server RG # -s service ip # -l MQ listeners provided through xml file # -M modify the configuration # # RETURNS # 0 on success # 1 on Failure ###################################################################################################################### if [[ $VERBOSE_LOGGING == high ]] then set -x version='7d4c34b 43haes/usr/sbin/cluster/sa/wmq/sbin/cl_wmq_config.sh, 726, 2147A_aha726, Feb 05 2021 09:50 PM' fi . /usr/es/sbin/cluster/sa/wmq/sbin/cl_wmq_Globals . /usr/es/sbin/cluster/sa/wmq/sbin/cl_wmq_Utilities #KLIB_HACMPLOG_ENTRY=$KLIB_WMQ_HACMPLOG_ENTRY typeset APP_NAME # Smart Assist Application Name of the WebSphere MQ server. typeset MQM_NAME # WebSphere MQM Instance name. typeset PRI_NODE # Primary node for the MQM RG. typeset TO_NODES # Take over nodes for the MQM RG. typeset SERVICE_IP # Service ip. typeset MODIFY="N" # Modify the MQ server configuration. typeset ACTION # Remove PowerHA resources according to ACTION value. typeset SMARTASSIST_ID="WMQ" # WebSphere MQ smart assist ID typeset COMPONENT_ID="WebSphere_MQ_SERVER" # component ID of smart assist for WebSphere MQ server typeset NODES # Nodes for a particular RG typeset LISTENERS # Listeners associated with a particular MQ server typeset MANUAL_LSNRS # Listeners of MQ server passed through xml file typeset MOD_LSNRS # In case of Modify, retain MQ listeners typeset DISCOVERY_TYPE="AUTO" # Discovery type typeset mqm_user="mqm" # Setting 'mqm' as default user to configure WebSphere MQ server ################################################################################# # Function: add_server_Instance # # Purpose: To create PowerHA SystemMirror resources and Resource group for Managing # WebSphere MQ server. # # Arguments: None. # # Returns: 0 for Sucess # 1 for Failure ################################################################################ function add_server_Instance { [[ "$VERBOSE_LOGGING" == "high" ]] && set -x # Checking 'mqm' user in 'mqm' group, 'mqm' user is default user to configure WebSphere MQ server. if ! lsgroup -a users mqm | cut -f2 -d= | grep -qw 'mqm' then KLIB_SA_logmsg ERROR 1 75 wmq_sa.cat "Failed: 'mqm' user does not exist in 'mqm' group\n" exit 1 fi #Creating the ServiceIP for RG. add_ServiceIP_Label # In case if previous configuration was done through manual discovery mode, # no need to discover the listeners again. if [[ -n "$MOD_LSNRS" ]]; then LISTENERS="$MOD_LSNRS" else # Find/Validate WebSphere MQ Listeners associated with Queue Manager KLIB_SA_logmsg INFO 2 9 wmq_sa.cat "Finding WebSphere MQ listeners associated with Queue Manager %1\$s" $MQM_NAME findLsnrs if (( $? == 0 )); then if [[ -n "$LISTENERS" ]]; then if [[ -n "$MANUAL_LSNRS" ]]; then # Now, validate the listeners provided through xml file KLIB_SA_logmsg INFO 2 28 wmq_sa.cat "Validating the listeners provided in WebSphere MQ xml file" # Modify the comma separated list to space separated list and remove duplicate entries. MANUAL_LSNRS=$(echo "$MANUAL_LSNRS" | tr ',' '\n' | sort -u | tr '\n' ' ') typeset UNDEFINED_LSNRS="" for LSNR in $MANUAL_LSNRS; do echo " $LISTENERS " | tr '\n' ' ' | grep -q "[[:space:]]${LSNR}[[:space:]]" if (( $? != 0 )); then UNDEFINED_LSNRS=$LSNR", "$UNDEFINED_LSNRS fi done if [[ -n "$UNDEFINED_LSNRS" ]]; then KLIB_SA_logmsg ERROR 2 29 wmq_sa.cat "Provided listener(s): %1\$s\n\ are not defined in WebSphere MQ server configuration.\n\ Available WebSphere MQ listeners associated with Queue Manager %2\$s are:\n%3\$s" "$UNDEFINED_LSNRS" $MQM_NAME "$LISTENERS" exit 1 else LISTENERS="$MANUAL_LSNRS" fi else # We are here because, # Configuration needs to be done with Auto discovery of listeners, or # ALL is provided in WMQ xml file KLIB_SA_logmsg INFO 2 10 wmq_sa.cat "Successfully found WebSphere MQ listeners:\n%1\$s" "$LISTENERS" fi else KLIB_SA_logmsg INFO 2 30 wmq_sa.cat "There are no WebSphere MQ listeners defined for Queue Manager %1\$s.\n\ Proceeding with WebSphere MQ server configuration without listeners." $MQM_NAME fi fi fi #Getting the RG name for WMQ RG. typeset rg_name="$MQM_NAME"_RG : Replace special characters ".", "%", and "/" with "_", because : those characters are supported in the MQ manager name. rg_name=${rg_name//[\.%\/]/_} #creating Resource Group for WebSphere MQ server configuration. KLIB_SA_logmsg INFO 1 24 wmq_sa.cat "Adding WebSphere MQ server Resource Group %1\$s to PowerHA SystemMirror configuration\n" $rg_name claddgrp -g "$rg_name" -n "$NODES" -S "OHN" -O "FNPN" -B "FBHPN" (( $? != 0 )) && { KLIB_SA_logmsg ERROR 1 25 wmq_sa.cat "Failed while adding WebSphere MQ server Resource Group %1\$s\n" $rg_name exit 1 } #Adding service IP label to the RG. KLIB_SA_logmsg INFO 1 77 wmq_sa.cat "Adding WebSphere MQ service IP to Resource Group %1\$s\n" $rg_name clvt modify resource_group "$rg_name" \ SERVICE_LABEL="$SERVICE_IP" >/dev/null 2>&1 || { KLIB_SA_logmsg ERROR 1 31 wmq_sa.cat "Failed while adding WebSphere MQ service IP to Resource Group %1\$s\n" $rg_name cleanup_and_exit } #creating MQM server Application start_script="$WMQ_HA_SBIN/cl_wmq_start -u $mqm_user -m $MQM_NAME" stop_script="$WMQ_HA_SBIN/cl_wmq_stop -u $mqm_user -m $MQM_NAME" monitor_script="$WMQ_HA_SBIN/cl_wmq_monitor -u $mqm_user -m $MQM_NAME" KLIB_SA_logmsg INFO 1 26 wmq_sa.cat "Adding WebSphere MQ server Application %1\$s to PowerHA SystemMirror configuration\n" $APP_NAME clvt add application $APP_NAME \ STARTSCRIPT="$start_script" \ STOPSCRIPT="$stop_script" >/dev/null 2>&1 || { KLIB_SA_logmsg ERROR 1 27 wmq_sa.cat "Failed while adding WebSphere MQ server Application %1\$s\n" $APP_NAME cleanup_and_exit } typeset app_mon_name="$APP_NAME"_mon # MQM application monitor name. : Replace special characters ".", "%", and "/" with "_", because : those characters are supported in the MQ manager name. app_mon_name=${app_mon_name//[\.%\/]/_} KLIB_SA_logmsg INFO 1 28 wmq_sa.cat "Adding WebSphere MQ server Application monitor %1\$s to PowerHA SystemMirror configuration\n" $app_mon_name claddappmon name=$app_mon_name \ MONITOR_TYPE='user' \ RESOURCE_TO_MONITOR=$APP_NAME \ INVOCATION='longrunning' \ FAILURE_ACTION='fallover' \ RESTART_METHOD="$start_script" \ CLEANUP_METHOD="$stop_script" \ MONITOR_METHOD="$monitor_script" \ MONITOR_INTERVAL='120' \ HUNG_MONITOR_SIGNAL='9' \ STABILIZATION_INTERVAL='180' \ RESTART_COUNT='3' \ RESTART_INTERVAL='900' >/dev/null 2>&1 || { KLIB_SA_logmsg ERROR 1 29 wmq_sa.cat "Failed while adding WebSphere MQ server Application monitor %1\$s\n" $app_mon_name cleanup_and_exit } KLIB_SA_logmsg INFO 1 20 wmq_sa.cat "Adding WebSphere MQ server configuration %1\$s\n" $APP_NAME clvt modify resource_group "$rg_name" \ SERVICE_LABEL="$SERVICE_IP" \ APPLICATIONS="$APP_NAME" >/dev/null 2>&1 || { KLIB_SA_logmsg ERROR 1 27 wmq_sa.cat "Failed while adding WebSphere MQ server Application %1\$s\n" $APP_NAME cleanup_and_exit } # adding MQM vg to the MQM RG typeset mqm_data_dir=$(/usr/bin/su $mqm_user -c "/usr/mqm/bin/dspmqinf $MQM_NAME") mqm_data_dir=${mqm_data_dir##*DataPath=} mqm_data_dir=${mqm_data_dir//\"/} VG=$(dir_fs_vg $mqm_data_dir 0) clvt modify resource_group "$rg_name" \ SERVICE_LABEL="$SERVICE_IP" \ FILESYSTEM="ALL" \ VOLUME_GROUP="$VG" \ APPLICATIONS="$APP_NAME" >/dev/null 2>&1 || { KLIB_SA_logmsg ERROR 1 35 wmq_sa.cat "Failed while adding WebSphere MQ VG to Resource Group %1\$s\n" $VG cleanup_and_exit } # Add the Resource Group and Application entry to HACMPsa_metadata ODM KLIB_SA_logmsg INFO 1 33 wmq_sa.cat "Adding WebSphere MQ Resource Configuration to HACMPsa_metadata ODM\n" claddsaapp -a $APP_NAME \ SMARTASSIST_ID="WMQ" \ COMPONENT_ID="WebSphere_MQ_SERVER" \ DISCOVERY_TYPE=$DISCOVERY_TYPE \ APPLICATION_NAME=$APP_NAME \ MQM_NAME=$MQM_NAME \ RESOURCE_GROUP=$rg_name \ PRI_NODE=$PRI_NODE \ TO_NODES=$TO_NODES \ SERVICE_IP=$SERVICE_IP >/dev/null 2>&1 || { KLIB_SA_logmsg ERROR 1 34 wmq_sa.cat "Failed while Adding WebSphere MQ server configuration to HACMPsa_metadata ODM\n" cleanup_and_exit } #adding custom verification method add_CVM # Configure application monitor for each WebSphere MQ Listener and add them to PowerHA configuration [[ -n "$LISTENERS" ]] && addLsnrs return 0 } #################################################################################### # Function: modify_server_Instance # # Purpose: To modify PowerHA SystemMirror resources and Resource group for Managing # WebSphere MQ server # # Arguments: None. # # Returns: 0 for Sucess # 1 for Failure # #################################################################################### function modify_server_Instance { [[ "$VERBOSE_LOGGING" == "high" ]] && set -x # In case if previous configuration was done through manual discovery mode, # no need to discover the listeners again. # So, we can retain the previously configured listeners before removing the SA. typeset DISC_TYPE=$(clodmget -q "name=DISCOVERY_TYPE" -f value -n HACMPsa_metadata) if [[ $DISC_TYPE == "MANUAL" ]]; then MOD_LSNRS=$(clodmget -q "name=LSNRMONITOR" -f value -n HACMPsa_metadata | cut -f1 -d' ') DISCOVERY_TYPE="MANUAL" fi remove_HAresources add_server_Instance return $? } #################################################################################### # Function: cleanup_and_exit # # Purpose: Cleanup existing configuration on error conditions. # # Arguments: None. # # Returns: always exit with 1 # #################################################################################### function cleanup_and_exit { [[ "$VERBOSE_LOGGING" == "high" ]] && set -x remove_HAresources exit 1 } ################################################################################# # Function: remove_HAresources # # Purpose: To remove PowerHA SystemMirror resources and Resource group for # Managing WebSphere MQ server. # # Arguments: None. # # Returns: 0 for Sucess # 1 for Failure # ################################################################################ function remove_HAresources { [[ "$VERBOSE_LOGGING" == "high" ]] && set -x # Check is added while modifying to check whether qmgr is already running to find the listeners echo "ping qmgr" | /usr/bin/su $mqm_user -c "/usr/mqm/bin/runmqsc $MQM_NAME > /dev/null 2>&1" if (( $? != 0 )); then KLIB_SA_logmsg ERROR 2 32 wmq_sa.cat "ERROR: Ensure WebSphere MQ Server is up and running before trying to modify the MQ Server instance." exit 1 fi typeset RG_NAME KLIB_SA_logmsg INFO 1 38 wmq_sa.cat "Removing WebSphere MQ server %1\$s configuration from PowerHA SystemMirror configuration\n" $APP_NAME # Removing the application. clvt query application $APP_NAME > /dev/null 2>&1 (( $? == 0 )) && { clvt delete application $APP_NAME > /dev/null 2>&1 (( $? != 0 )) && { KLIB_SA_logmsg ERROR 1 42 wmq_sa.cat "Failed while deleting Application for changing WebSphere MQ server configuration%1\$s\n" $APP_NAME exit 1 } } #Removing the service ip. SER_IP=$(clodmget -q "name=SERVICE_IP and application_id=$APP_NAME" -f value -n HACMPsa_metadata) if [[ -n $SER_IP ]];then clvt query service_ip $SER_IP > /dev/null 2>&1 (( $? == 0 )) && { clvt delete service_ip $SER_IP > /dev/null 2>&1 (( $? != 0 )) && { KLIB_SA_logmsg ERROR 1 57 wmq_sa.cat "Failed while deleting service IP %1\$s for changing WebSphere MQ server configuration\n" $SER_IP exit 1 } } fi #Removing the Resource Group. RG_NAME=$(clodmget -q "name=RESOURCE_GROUP and application_id=$APP_NAME" -f value -n HACMPsa_metadata) if [[ -n $RG_NAME ]]; then clvt delete resource_group $RG_NAME > /dev/null 2>&1 (( $? != 0 )) && { KLIB_SA_logmsg ERROR 1 43 wmq_sa.cat "Failed while deleting Resource Group %1\$s for changing WebSphere MQ server configuration\n" $RG_NAME exit 1 } fi # Remove the metadata entries clrmsaapp -a $APP_NAME >/dev/null 2>&1 (( $? != 0 )) && { KLIB_SA_logmsg ERROR 1 44 wmq_sa.cat "Failed while deleting WebSphere MQ server configuration from ODM.\n" exit 1 } return 0 } ############################################################################ # Function: # add_ServiceIP_Label # # Purpose: # Adds Service IP label to the PowerHA SystemMirror configuration if # it doesn't already exist. # # Arguments: # n/a # # Returns: # 0 on success # 1 on failure ############################################################################ function add_ServiceIP_Label { [[ "$VERBOSE_LOGGING" == "high" ]] && set -x #is ServiceIP already configured. ServiceIP_Defined $SERVICE_IP (( $? == 0 )) && { KLIB_SA_logmsg ERROR 1 23 wmq_sa.cat "service label %1\$s already defined in the PowerHA SystemMirror configuration\n" $SERVICE_IP exit 1 } # # Can the service IP label be resolved? # /usr/bin/host $SERVICE_IP >/dev/null 2>&1 (( $? != 0 )) && { KLIB_SA_logmsg ERROR 1 22 wmq_sa.cat "Service IP label %1\$s can not be resolved" $SERVICE_IP exit 1 } clvt query interface $SERVICE_IP > /dev/null 2>&1 if (( $? == 0 )); then clvt delete interface $SERVICE_IP fi clvt query service_ip $SERVICE_IP > /dev/null 2>&1 (( $? != 0 )) && { # Create the service IP label KLIB_SA_logmsg INFO 1 45 wmq_sa.cat "creating Service IP label %1\$s\n" $SERVICE_IP typeset hname= is= rem= /usr/bin/host $SERVICE_IP | read hname is addr rem addr=${addr%%,*} isipv6addr $addr if (( $? == 0 )) then Net_type="2" # Net_type will be specified in HACMPadapter ODM for IPv6=2, IPv4=1 else Net_type="1" fi network=$(getServiceNetwork $Net_type "$NODES") # There are no suitable networks defined to create [[ -z $network ]] && { KLIB_SA_logmsg ERROR 1 46 wmq_sa.cat "No suitable PowerHA SystemMirror network is defined to create service IP label\n" exit 1 } /usr/es/sbin/cluster/utilities/claddnode -T service -B "$SERVICE_IP" -P "$NETMASK" -w "$network" > /dev/null 2>&1 (( $? != 0 )) && { KLIB_SA_logmsg ERROR 1 47 wmq_sa.cat "Error while adding service IP label %1\$s to network %2\$s\n" $SERVICE_IP $network exit 1 } } return 0 } #---------------------------------------------------------------------------- # Function: # add_CVM # # Purpose: # adds custom verification method for the specified MQ RG. # # Arguments: # none # # Returns: # 0 on success # 1 on failure #---------------------------------------------------------------------------- function add_CVM { [[ "$VERBOSE_LOGGING" == "high" ]] && set -x typeset VM_NAME typeset VM_Dis typeset VM_Sh ERR=$(/usr/es/sbin/cluster/utilities/cllscustom) [[ $ERR == "" ]] && { VM_NAME="$MQM_NAME"_VM #custom verification method name : Replace special characters ".", "%", and "/" with "_", because : those characters are supported in the MQ manager name. VM_NAME=${VM_NAME//[\.%\/]/_} VM_Dis="Custom_Verification_Method_for_MQ:$MQM_NAME" # verification method discription. VM_Sh="/usr/es/sbin/cluster/sa/wmq/sbin/wmq_cvs" # custom verification script. #adding the custom verification method to cluster. KLIB_SA_logmsg INFO 1 76 wmq_sa.cat "adding the custom verification method for:%1\$s." $MQM_NAME /usr/es/sbin/cluster/utilities/claddcustom -t verify -n$VM_NAME -I$VM_Dis -m 0 -v$VM_Sh > /dev/null 2>&1 (( $? != 0 )) && { KLIB_SA_logmsg ERROR 1 74 wmq_sa.cat "Error while adding the custom verification method for:%1\$s.\n" $MQM_NAME cleanup_and_exit } #add this custom verification method name to HACMPsa_metadata claddsaapp -a $APP_NAME CUSTOM_VERIFICATION_LIBRARY="$VM_NAME" > /dev/null 2>&1 return 0 } return 0 } #---------------------------------------------------------------------------- # Function: # findLsnrs # # Purpose: # Find WebSphere MQ Listeners associated with the Queue Manager. # Note: In case Queue Manager is not up and running, discovery fails. # So, show a message to user to start the MQ server and exit. # # Arguments: # none # # Returns: # 0 on success # >0 on failure #---------------------------------------------------------------------------- function findLsnrs { [[ "$VERBOSE_LOGGING" == "high" ]] && set -x # Verify whether qmgr is already running to find the listeners echo "ping qmgr" | /usr/bin/su $mqm_user -c "/usr/mqm/bin/runmqsc $MQM_NAME > /dev/null 2>&1" if (( $? == 0 )); then # find listeners LISTENERS=$(echo "DISPLAY LISTENER(*)" | /usr/bin/su $mqm_user -c "/usr/mqm/bin/runmqsc $MQM_NAME" | \ grep -w LISTENER | grep -v DISPLAY | cut -d'(' -f2 | cut -d')' -f1) return 0 else # Since qmgr is not up and running, ask user to start it so that we can proceed with configuration. KLIB_SA_logmsg ERROR 2 31 wmq_sa.cat "Failed to find the WebSphere MQ listeners.\n\ Ensure that WebSphere MQ Server is up and running to discover the listeners." exit 1 fi } #---------------------------------------------------------------------------- # Function: # addLsnrs # # Purpose: # Configure application monitor for each WebSphere MQ Listener. # And, add them to PowerHA configuration # # Arguments: # none # # Returns: # 0 on success # 1 on failure #---------------------------------------------------------------------------- function addLsnrs { [[ "$VERBOSE_LOGGING" == "high" ]] && set -x KLIB_SA_logmsg INFO 2 20 wmq_sa.cat "Configuring application monitor for each WebSphere \ MQ listener associated with Queue Manager %1\$s" $MQM_NAME # configure a monitor for each listener for LSNR in $LISTENERS; do start_script="$WMQ_HA_SBIN/cl_wmq_startlsnr -u $mqm_user -m $MQM_NAME -l $LSNR" stop_script="$WMQ_HA_SBIN/cl_wmq_stoplsnr -u $mqm_user -m $MQM_NAME -l $LSNR" monitor_script="$WMQ_HA_SBIN/cl_wmq_monitorlsnr -u $mqm_user -m $MQM_NAME -l $LSNR" typeset lsnr_mon_name="$LSNR"_mon : Replace special characters ".", "%", and "/" with "_", because : those characters are supported in the WebSphere MQ listener name. lsnr_mon_name=${lsnr_mon_name//[\.%\/]/_} KLIB_SA_logmsg INFO 2 21 wmq_sa.cat "Adding listener monitor %1\$s to PowerHA SystemMirror configuration" $lsnr_mon_name claddappmon name=$lsnr_mon_name \ MONITOR_TYPE='user' \ RESOURCE_TO_MONITOR=$APP_NAME \ INVOCATION='longrunning' \ FAILURE_ACTION='fallover' \ RESTART_METHOD="$start_script" \ CLEANUP_METHOD="$stop_script" \ MONITOR_METHOD="$monitor_script" \ MONITOR_INTERVAL='120' \ HUNG_MONITOR_SIGNAL='9' \ STABILIZATION_INTERVAL='180' \ RESTART_COUNT='3' \ RESTART_INTERVAL='900' >/dev/null 2>&1 || { KLIB_SA_logmsg ERROR 2 22 wmq_sa.cat "Failed while adding listener monitor %1\$s \ to PowerHA SystemMirror configuration" $lsnr_mon_name cleanup_and_exit } # Update HACMPsa_metadata with listener monitor name associated with a specific listener. claddsaapp -a $APP_NAME LSNRMONITOR=$LSNR" "$lsnr_mon_name > /dev/null 2>&1 (( $? != 0 )) && cleanup_and_exit done KLIB_SA_logmsg INFO 2 23 wmq_sa.cat "Successfully configured application monitors for all the \ WebSphere MQ listeners associated with Queue Manager %1\$s" $MQM_NAME return 0 } ########################################### # MAIN ########################################### while getopts a:m:p:t:s:P:l:M,R opt do case $opt in a) # Application Name APP_NAME=$OPTARG APP_NAME=${APP_NAME%%+([[:space:]])} KLIB_SA_logmsg INFO 1 10 wmq_sa.cat "Validating Smart Assist for WebSphere MQ application id\n" validate_AppName "$APP_NAME" (( $? == 1 )) && { KLIB_SA_logmsg ERROR 1 11 wmq_sa.cat "smart assist for WebSphere MQ Application name=%1\$s is not in the range [a-z][A-z][0-9]_\n" "$APP_NAME" exit 1 } KLIB_SA_logmsg DEBUG 1 12 wmq_sa.cat "completion of validating smart Assist for WebSphere MQ id=%1\$s\n" "$APP_NAME" ;; m) # WebSphere MQM Instance name. MQM_NAME=$OPTARG ;; p) # Primary node for the MQM RG. PRI_NODE=$OPTARG ;; t) # Take over Node(s) for MQM RG TO_NODES=$OPTARG ;; s) # Service IP for client to connect to MQM SERVICE_IP=$OPTARG ;; P) # Netmask for the service_ip label NETMASK=$OPTARG ;; l) # Listeners passed through Manual discovery MANUAL_LSNRS=$OPTARG DISCOVERY_TYPE="MANUAL" # if ALL is provided in xml file, continue with auto discovery of mq listeners. if [[ $MANUAL_LSNRS == "ALL" ]]; then # Make MANUAL_LSNRS empty to proceed with auto discovery MANUAL_LSNRS="" fi ;; M) # modify WebSphere MQ server MODIFY="Y" ;; R) # Remove the WMQ PowerHA resources ACTION="REMOVE" ;; esac done #Validate the node names, if there are any Name duplication for Participating nodes TO_NODES=$(echo $TO_NODES | tr ',' ' ') NODES="$PRI_NODE $TO_NODES" KLIB_SA_logmsg INFO 1 13 wmq_sa.cat "Validating WebSphere MQ server nodes\n" validate_Nodes $PRI_NODE "$TO_NODES" (( $? != 0 )) && { KLIB_SA_logmsg ERROR 1 14 wmq_sa.cat "smart assist for WebSphere MQ server has nodes=%1\$s as repetitive\n" "$NODES" exit 1 } if [[ "$MODIFY" == "Y" ]] then KLIB_SA_logmsg INFO 1 15 wmq_sa.cat "Modify the WebSphere MQ server configuration %1\$s\n" $APP_NAME modify_server_Instance exit $? else if [[ $ACTION == "REMOVE" ]] then #Remove the powerha resouces. remove_HAresources exit $? else #check If the WebSphere MQ server is already configured to PowerHA SystemMirror. KLIB_SA_logmsg INFO 1 16 wmq_sa.cat "Checking if the WebSphere MQ server is already configured.\n" app_id=$(clodmget -q "name=APPLICATION_NAME" -f application_id -n HACMPsa_metadata) for app in $app_id do [[ $app == $APP_NAME ]] && { KLIB_SA_logmsg ERROR 1 17 wmq_sa.cat "WebSphere MQ server with application is %1\$s already configured\n" $APP_NAME exit 1 } done add_server_Instance exit $? fi fi