Configuring SAS Viya for ESM

Once the ESM Server and Agent components are installed, some additional configuration is required to integrate ESM monitoring with the various SAS Viya components.

Ansible playbooks

To assist with the configuration changes required for ESM integration with SAS Viya, Boemska provide a set of Ansible playbooks. We recommend that these are used with the assistance of Boemska Support. For basic integration with the SAS Viya microservices and SPRE runtimes, follow the steps below.

Viya Microservices

Instances of microservices can be configured to report in to ESM automatically by modifying the sas_check_pid() function in /opt/sas/viya/home/lib/envesntl/sas-init-functions. Add the following code after the result=0 # is running (typically line 125):

Values need to be updated

The snippet below contains an incomplete path starting with ###. Please update this line for your environment.

# ESM CONFIG START
export ESMHOME=###/path/to/esm-agent
export esmfuncfile=$ESMHOME/addPid.sh
if [ -f "$esmfuncfile" ]; then
  source $esmfuncfile

  esmthislogloc=${SASLOGROOT}/${SASPRODNAME}/${SASINSTANCE}/
  # uncomment this for logfile tracking
  esmservicelogfile="${esmthislogloc}$(ls -t $esmthislogloc | head -n1)"

  esmReportPid $pid "${SASPRODNAME}" "viya" "${esmservicelogfile}" "${SASINSTANCE}"
fi
# ESM CONFIG END

SPRE and Compute Service Sessions

Configuring SPRE workspace servers is similar to configuring a SAS9 Workspace Server instance.

In order to associate SAS sessions to their parent server types we need to configure some ESM environment variables. Add the following snippet to the following files:

  • /opt/sas/viya/config/etc/workspaceserver/default/workspaceserver_usermods.sh
  • /opt/sas/viya/config/etc/connectserver/default/connectserver_usermods.sh
  • /opt/sas/viya/config/etc/compsrv/default/compsrv_usermods.sh
  • /opt/sas/viya/config/etc/batchserver/default/batchserver_usermods.sh

Update values

The snippet below contains an incomplete path starting with ###. Please update this line for your environment.

# ESM CONFIG START

export ESMBASEDIR=###/pub/esm/esm-agent
. $ESMBASEDIR/conf/esmconfig.sh

# set the active flag as 1 for active, 0 for inactive
export ESMACTIVE=1

# This is the name given to non-job sessions (for example)
export ESMSESSIONNAME=SAS-Studio

export ESMSESSIONTYPE=###ws|cs|cmp|batch 

# ESM CONFIG END

And then source the integration macros via each server's autoexec_usermods.sas:

/* ESM CONFIG START */
%let ESMBASEDIR=%SYSGET(ESMHOME);
%include "&ESMBASEDIR/sasautos/esmtags.sas";
/* ESM CONFIG END */