If you are installing SAS Environment Manager in a grid environment where more than one grid machine shares a configuration directory, you must perform additional configuration steps so that the SAS Environment Manager agents point to the correct machine. As of SAS 9.4 Maint 6, you should use the SAS Environment Manager Smart Agent to accomplish this.
For releases prior to SAS 9.4 Maint 6, we provide a script you can run manually. To run the configuration process, use the script deploy-ev-agents.sh, included inline here:
For a full set of instructions to help you use this script, see “Installing and Configuring SAS® Environment Manager in a SAS® Grid Environment with a Shared Configu...."
#!/usr/bin/env sh
# exit on error
set -e
MODULE="deploy-ev-agents"
VERSION='9.4M2'
#-----------------------------------------------------------------------------#
# Default values can be overridden by defining the following environment
# variables prior to running this script.
#-----------------------------------------------------------------------------#
GRID_BACKUP_EXTENSION="${GRID_BACKUP_EXTENSION:-.orig}"
GRID_EV_AGENT_CONTROL_SCRIPT="${GRID_EV_AGENT_CONTROL_SCRIPT:-bin/hq-agent.sh}"
GRID_EV_AGENT_DATA_DIRECTORY="${GRID_EV_AGENT_DATA_DIRECTORY:-data}"
GRID_EV_AGENT_DEPLOY_ROOT="${GRID_EV_AGENT_DEPLOY_ROOT:-grid}"
GRID_EV_AGENT_ID="${GRID_EV_AGENT_ID:-agent-5.8.0-EE}"
GRID_EV_AGENT_IP_PROPERTY="${GRID_EV_AGENT_IP_PROPERTY:-agent.setup.agentIP}"
GRID_EV_AGENT_PLUGINS_EXCLUDE_PROPERTY="${GRID_EV_AGENT_PLUGINS_EXCLUDE_PROPERTY:-plugins.exclude}"
GRID_EV_AGENT_PLUGINS_INCLUDE_PROPERTY="${GRID_EV_AGENT_PLUGINS_INCLUDE_PROPERTY:-plugins.include}"
GRID_EV_AGENT_LOG_DIRECTORY="${GRID_EV_AGENT_LOG_DIRECTORY:-log}"
GRID_EV_AGENT_PROPERTY_FILE="${GRID_EV_AGENT_PROPERTY_FILE:-conf/agent.properties}"
GRID_EV_AGENT_SAS_PROPERTY_FILE="${GRID_EV_AGENT_SAS_PROPERTY_FILE:-conf/sas.properties}"
GRID_EV_AGENT_START_COMMAND="${GRID_EV_AGENT_START_COMMAND:-start}"
GRID_EV_AGENT_STOP_COMMAND="${GRID_EV_AGENT_STOP_COMMAND:-stop}"
GRID_EV_CONFIG_DIRECTORY="${GRID_EV_CONFIG_DIRECTORY:-Web/SASEnvironmentManager}"
# print a usage statement to stdout
print_usage() {
echo "--------------------------------------------------"
# echo "Usage: $0 -i SAS_INSTALL_DIRECTORY -c SAS_CONFIG_DIRECTORY NODE1 [NODE2 ... NODEN]"
echo "Usage:"
echo " $0 [-n] [-q] -c SAS_CONFIG_DIRECTORY NODE1 [NODE2 ... NODEN]"
echo " $0 -V"
echo " $0 -h"
echo "--------------------------------------------------"
}
# print an info message to stdout
print_info() {
[ -n "$QUIET_MODE" ] || echo "INFO: $@"
}
# print an error message to stderr, print a usage statement, and exit with a non-zero return code
print_error() {
echo "ERROR: $@" >&2
print_usage
exit 1
}
# print the version information
print_version() {
echo "$MODULE $VERSION"
}
# print any header information
print_header() {
if [ -n "$DRY_RUN" ]; then
echo "----------------------------------------------------------------------------------------------------"
echo " D R Y R U N "
echo "----------------------------------------------------------------------------------------------------"
fi
}
# print a summary of what we did and information about any post-deployment steps that need to occur
print_summary() {
[ -n "$1" ] || print_error "print_summary() called with zero arguments"
[ -n "$2" ] || print_error "print_summary() called with one argument: $1"
echo
echo "----------------------------------------------------------------------------------------------------"
echo "Grid deployment of SAS Environment Manager Agents complete!"
echo
echo "SAS Environment Manager Agents have been configured for the following grid nodes:"
for grid_node in $GRID_NODES; do
echo " $grid_node"
done
echo
echo "Please run the following commands on the following grid nodes:"
for grid_node in $GRID_NODES; do
THIS_AGENT=$1/$grid_node/$2
echo " $grid_node:"
echo " $THIS_AGENT/$GRID_EV_AGENT_CONTROL_SCRIPT $GRID_EV_AGENT_START_COMMAND"
echo
done
echo "----------------------------------------------------------------------------------------------------"
}
# wrapper function for executing commands with support for dry-run mode
exec_command() {
[ -z "$1" ] || $DRY_RUN "$@"
}
# parse the command line options
while getopts "hVnqc:" arg; do
case $arg in
h) # help
print_usage
exit 0;
;;
V) # print the version information and exit
print_version
exit 0;
;;
n) # dry run or "no execute" mode
DRY_RUN=echo
;;
q) # quiet mode
QUIET_MODE=1
;;
# i) # path to SAS Home directory; this command line option overrides the environment variable $GRID_SAS_HOME
# GRID_SAS_HOME="${OPTARG:-$GRID_SAS_HOME}"
# ;;
c) # path to SAS Config Lev directory; this command line option overrides the environment variable $GRID_SAS_CONFIG
GRID_SAS_CONFIG="${OPTARG:-$GRID_SAS_CONFIG}"
;;
?) # catch-all for any invalid command line options
print_usage
exit 1
;;
esac
done
# any remaining arguments are grid node names
shift $(($OPTIND - 1))
GRID_NODES="$@"
# error checking; ensure everything needed was specified
#[ -n "$GRID_SAS_HOME" ] || print_error "SAS Home/Install directory was not specified"
[ -n "$GRID_SAS_CONFIG" ] || print_error "SAS Configuration directory was not specified"
[ -n "$GRID_NODES" ] || print_error "No nodes were specified"
# define additional variables for use below
EV_AGENT_PATH="$GRID_SAS_CONFIG/$GRID_EV_CONFIG_DIRECTORY/$GRID_EV_AGENT_ID"
EV_AGENT_CONTROL_SCRIPT_PATH="$EV_AGENT_PATH/$GRID_EV_AGENT_CONTROL_SCRIPT"
EV_AGENT_DEPLOY_ROOT_PATH="$GRID_SAS_CONFIG/$GRID_EV_CONFIG_DIRECTORY/$GRID_EV_AGENT_DEPLOY_ROOT"
# print any header information before getting started
print_header
# stop the original SAS EV Agent
print_info "Stopping SAS Environment Manager Agent on localhost: $EV_AGENT_PATH"
exec_command $EV_AGENT_CONTROL_SCRIPT_PATH $GRID_EV_AGENT_STOP_COMMAND
for grid_node in $GRID_NODES; do
THIS_AGENT=$EV_AGENT_DEPLOY_ROOT_PATH/$grid_node/$GRID_EV_AGENT_ID
# create a directory to copy the agent directory structure to
print_info "Creating target directory for grid node $grid_node: $EV_AGENT_DEPLOY_ROOT_PATH/$grid_node"
exec_command mkdir -p $EV_AGENT_DEPLOY_ROOT_PATH/$grid_node
# copy the agent directory structure
print_info "Replicating agent directory structure for grid node $grid_node: $EV_AGENT_PATH => $EV_AGENT_DEPLOY_ROOT_PATH/$grid_node"
exec_command cp -pr $EV_AGENT_PATH $EV_AGENT_DEPLOY_ROOT_PATH/$grid_node
# clean up the data directory
print_info "Removing agent data directory for grid node $grid_node: $THIS_AGENT/$GRID_EV_AGENT_DATA_DIRECTORY"
exec_command rm -rf $THIS_AGENT/$GRID_EV_AGENT_DATA_DIRECTORY
# clean up the log directory
print_info "Removing agent log directory for grid node $grid_node: $THIS_AGENT/$GRID_EV_AGENT_LOG_DIRECTORY"
exec_command rm -rf $THIS_AGENT/$GRID_EV_AGENT_LOG_DIRECTORY
# back up the original agent properties file
print_info "Creating backup of agent property file for grid node $grid_node: $THIS_AGENT/$GRID_EV_AGENT_PROPERTY_FILE => $THIS_AGENT/$GRID_EV_AGENT_PROPERTY_FILE$GRID_BACKUP_EXTENSION"
exec_command mv $THIS_AGENT/$GRID_EV_AGENT_PROPERTY_FILE $THIS_AGENT/$GRID_EV_AGENT_PROPERTY_FILE$GRID_BACKUP_EXTENSION
# replace the agent node name in the agent properties file with the grid node name
print_info "Updating agent properties for grid node $grid_node"
if [ -n "$DRY_RUN" ]; then
exec_command sed "s/^${GRID_EV_AGENT_IP_PROPERTY}=.*/${GRID_EV_AGENT_IP_PROPERTY}=$grid_node/" $THIS_AGENT/$GRID_EV_AGENT_PROPERTY_FILE$GRID_BACKUP_EXTENSION
else
exec_command sed "s/^${GRID_EV_AGENT_IP_PROPERTY}=.*/${GRID_EV_AGENT_IP_PROPERTY}=$grid_node/" $THIS_AGENT/$GRID_EV_AGENT_PROPERTY_FILE$GRID_BACKUP_EXTENSION > $THIS_AGENT/$GRID_EV_AGENT_PROPERTY_FILE
fi
# add the plugins exclude property to the agent properties file in order to exclude the plugin that discovers the SAS Deployment Agent
GRID_EV_AGENT_INCLUDED_PLUGINS="sas-servers,hqagent,sas-deploy-agent"
print_info "Creating whitelist of included plugins: ${GRID_EV_AGENT_INCLUDED_PLUGINS}"
if [ -n "$DRY_RUN" ]; then
exec_command echo ""
exec_command echo "# Include only Environment Manager plugins for SAS Grid nodes"
exec_command echo "${GRID_EV_AGENT_PLUGINS_INCLUDE_PROPERTY}=${GRID_EV_AGENT_INCLUDED_PLUGINS}"
else
exec_command echo "" >> $THIS_AGENT/$GRID_EV_AGENT_PROPERTY_FILE
exec_command echo "# Include only Environment Manager plugins for SAS Grid nodes" >> $THIS_AGENT/$GRID_EV_AGENT_PROPERTY_FILE
exec_command echo "${GRID_EV_AGENT_PLUGINS_INCLUDE_PROPERTY}=${GRID_EV_AGENT_INCLUDED_PLUGINS}" >> $THIS_AGENT/$GRID_EV_AGENT_PROPERTY_FILE
fi
# back up the original sas properties file
print_info "Creating backup of SAS custom agent property file for grid node $grid_node: $THIS_AGENT/$GRID_EV_AGENT_SAS_PROPERTY_FILE => $THIS_AGENT/$GRID_EV_AGENT_SAS_PROPERTY_FILE$GRID_BACKUP_EXTENSION"
exec_command mv $THIS_AGENT/$GRID_EV_AGENT_SAS_PROPERTY_FILE $THIS_AGENT/$GRID_EV_AGENT_SAS_PROPERTY_FILE$GRID_BACKUP_EXTENSION
# link the sas properties file to the sas properties file in the original agent
print_info "Linking SAS custom agent property file for grid node $grid_node: $THIS_AGENT/$GRID_EV_AGENT_SAS_PROPERTY_FILE => $EV_AGENT_PATH/$GRID_EV_AGENT_SAS_PROPERTY_FILE"
exec_command ln -s $EV_AGENT_PATH/$GRID_EV_AGENT_SAS_PROPERTY_FILE $THIS_AGENT/$GRID_EV_AGENT_SAS_PROPERTY_FILE
done
# start the original SAS EV Agent
print_info "Starting SAS Environment Manager Agent on localhost: $EV_AGENT_PATH"
exec_command $EV_AGENT_CONTROL_SCRIPT_PATH $GRID_EV_AGENT_START_COMMAND
# print a summary of what we did and information about any post-deployment steps that need to occur
print_summary $EV_AGENT_DEPLOY_ROOT_PATH $GRID_EV_AGENT_ID
Join us for SAS Innovate 2025, our biggest and most exciting global event of the year, in Orlando, FL, from May 6-9.
Early bird rate extended! Save $200 when you sign up by March 31.
Data Literacy is for all, even absolute beginners. Jump on board with this free e-learning and boost your career prospects.