#!/bin/ksh93 # IBM_PROLOG_BEGIN_TAG # This is an automatically generated prolog. # # 61haes_r720 src/43haes/usr/sbin/cluster/haws/sbin/subsys/dm/monitor_dm.sh 1.8 # # Licensed Materials - Property of IBM # # COPYRIGHT International Business Machines Corp. 2004,2015 # 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 # @(#)32 1.8 src/43haes/usr/sbin/cluster/haws/sbin/subsys/dm/monitor_dm.sh, hacmp.assist, 61haes_r720, 1522B_hacmp720 5/29/15 09:22:11 # ############################################################################### # # This script is used to monitor a Websphere Deployment Manager instance # The DM is monitored by calling into the "serverStatus.sh" shell # script provided by Websphere. The following is an example of what # this script will return if Deployment Manager is healthy: # # root@bede/usr/es/sbin/cluster/haws/sbin> /serverStatus.sh dmgr # ADMU0116I: Tool information is being logged in file # /usr/WebSphere/DeploymentManager/logs/dmgr/serverStatus.log # ADMU0500I: Retrieving server status for dmgr # ADMU0508I: The Deployment Manager "dmgr" is STARTED # # This script will look for the string: # "The Deployment Manager is STARTED" # Failure to detect this string will assume the worst and return the # a failure status. If the string is detected, then a zero is returned # # This script must return one of the following values: # 0: If the application is healthy # 1: If the application is dead or otherwise unhealthy # ############################################################################### # These are the exit status codes. No other values are useful so we break # down the possible returns as either Healthy or Dead. EXIT_DEAD=1 EXIT_HEALTHY=0 STATUS="" # Determine where Deployment Manager is installed WAS_INSTALL_DIR="" DM_SCRIPT="" # This will be filled in by sourcing a config file WAS_SERVER_NAME="" ############################################################################### # Function: init ############################################################################### # # Initialize this script ############################################################################### init() { if [[ $VERBOSE_LOGGING == 'high' ]] then PS4_FUNC=init set -x fi # The standard directory for the HAWS software is in # /usr/es/sbin/cluster/haws. But this can be changed by setting the # environment string HAWS_HOME. if [[ -z $HAWS_HOME ]]; then HAWS_HOME=/usr/es/sbin/cluster/haws fi # Source function library. This is standard for all scripts clhaws_functions=$HAWS_HOME/sbin/clhaws_functions if [[ ! -s "$clhaws_functions" ]]; then echo "The file '$clhaws_functions' is missing! Unable to continue. Bye" exit 1 fi . $clhaws_functions # We now call into the generic initialization routine. This will # complete the initialization process generic_init # once the above clhaws_functions complete, we have all our variables and # functions defined. We can now safely log messages and begin processing. logmsg HAWS_TRACE "$MSG_BEGIN" "Begin\n" } ############################################################################### # Function: check_server_status ############################################################################### # # Check the status of the server ############################################################################### check_server_status() { if [[ $VERBOSE_LOGGING == 'high' ]] then PS4_FUNC=check_server_status set -x fi logmsg HAWS_TRACE "$MSG_DM_MON_CHECKING" "Checking the status of the DM Server...\n" logmsg HAWS_TRACE "$MSG_CALLING_SCRIPT" "Calling script: %s %s\n" $DM_SCRIPT $WAS_SERVER_NAME if $DM_SCRIPT $WAS_SERVER_NAME | grep -q "The Deployment Manager \"$WAS_SERVER_NAME\" is STARTED" then logmsg HAWS_INFO "$MSG_DM_MON_IS_HEALTHY" "The Deployment Manager is healthy.\n" STATUS=$EXIT_HEALTHY else logmsg HAWS_INFO $MSG_DM_MON_IS_DEAD "The Deployment Manager is not healthy.\n" STATUS=$EXIT_DEAD fi echo $STATUS } ############################################################################### # Function: read_config ############################################################################### # # Read our configuration file. This will contain the following # variables: # SERVER_NAME - The server name we need to monitor # ############################################################################### read_config() { if [[ $VERBOSE_LOGGING == 'high' ]] then PS4_FUNC=read_config set -x fi cfgfile=$1 logmsg HAWS_TRACE $MSG_READING_CONFIG "Reading configuration file: %s\n" $cfgfile . $cfgfile DM_SCRIPT=$WAS_INSTALL_DIR/bin/serverStatus.sh } # ############################################################################### # # SCRIPT EXECUTION SECTION # ############################################################################### # This section of the script is used to call into the various predefined # functions composed of the common code, and the script-specific functions. # # The intent of this section is to provide a high-level view of how this # script operates. ############################################################################### eval export $(cllsparam -n $(clodmget -f nodename HACMPcluster)) if [[ $VERBOSE_LOGGING == 'high' ]] then PS4_TIMER=true set -x version='1.8' fi init generic_process_arguments $* read_config $* check_server_status exit $STATUS