Viya 3 on Linux
Having successfully installed the SAS Enterprise Monitor Server component and Agent component, SAS configuration changes are now required to enable SAS Enterprise Monitor to monitor the various components of your SAS Viya 3 installation.
Viya Microservices¶
- Append the following code block the end of
/opt/sas/viya/home/lib/envesntl/sas-init-functions
updating the values ofESMHOME
variable to the location of your SAS Enterprise Monitor agent, and theviyalogroot
(if required):# ESM CONFIG BLOCK START ESMHOME=/opt/esm/esm-agent source $ESMHOME/conf/esmconfig.sh viyalogroot=/opt/sas/viya/config/var/log viyaname=sas-viya viyapidfiles=/var/run/sas # format here is reportPid [pid] [pidfile] function reportViyaPid () { esmpidno=$1 esmfileshort=$(basename $2) esmservicename=$(echo ${esmfileshort} | cut -d '.' -f 1) esmfds=$(ls -latr /proc/${esmpidno}/fd | grep ${viyalogroot} | sed 's/.*> //' | sort | uniq) for fd in $esmfds; do # if there happen to be multiple open get the latest lastLogfile=${fd} done esmpidowner=$(ps -o user= -p $esmpidno) eventString=[{\"pid\":$esmpidno\,\"owner\":\"$esmpidowner\"\,\"esmType\":\"viya\"\,\"jobName\":\"$esmservicename\"\,\"logFile\":\"$lastLogfile\"\,\"hostname\":\"$ESMNODENAME\"}] echo $eventString > $ESMEVENTS/new'_'$esmpidno'_'$ESMNODENAME } # ESM CONFIG BLOCK END
- Add the following code after the
result=0 # is running
line (roughtly, this will be on line 117):# ESM CONFIG BLOCK START reportViyaPid ${pid} ${pidfile} # ESM CONFIG BLOCK END
- If your SAS Microservices are running while these changes are made you can run the following commands to add running Microservices to SAS Enterprise Session Monitor. The below script can take a few seconds to run:
cd /var/run/sas source /opt/sas/viya/home/lib/envesntl/sas-init-functions for i in *.pid; do p=`cat $i`; reportViyaPid $p $i 2>/dev/null; done
Workload Execution Servers¶
The steps documented below show how to modify each of the different SAS execution server types in a Viya 3 deployment. If you are running a multi-tenant environment, the below steps should be replicated across each tenant in your deployment.
Compute Server¶
- Add the following lines to
/opt/sas/viya/config/etc/compsrv/<tenant>/autoexec_usermods.sas
modifying the following:<tenant>
in the path above to the appropriate folderESMBASEDIR
to the location of youresm-agent
folderESMNODENAME
to the name of the server as specified in$ESMBASEDIR/conf/esmconfig.sh
ESMVIYATENANT
to the name of the tenant if configuring a multi-tenant environmentESMLOGPATH
to the directory where logs for the compute server are stored. You must keep the trailing slash on this path/* START ESM BOOTSTRAP */ %let ESMBASEDIR="/opt/sas/esm/esm-agent"; %let ESMNODENAME="&SYSHOSTNAME."; %let ESMVIYATENANT=default; %let ESMLOGPATH="/opt/sas/viya/config/var/log/compsrv/&ESMVIYATENANT./"; %if %sysfunc(fileexist(&ESMBASEDIR./sasautos/esmtags.sas)) %then %do; options set = ESMHOME &ESMBASEDIR.; options set = ESMACTIVE = 1; options set = ESMSESSIONTYPE="CMP"; options set = ESMSESSIONNAME="compsrv_default"; options set = ESMNODENAME=&ESMNODENAME.; options set = LSB_QUEUE=&ESMVIYATENANT; options set = LOGPATH=&ESMLOGPATH.; %let esmh=%sysget(ESMHOME); %include "&esmh./sasautos/esmtags.sas"; %end; /* END ESM BOOTSTRAP */
Job Execution Service Job Name¶
- Complete the Compute Server configuration above.
- After making a backup, modify
jesbegin.sas
in/opt/sas/spre/home/SASFoundation/sasautos
putting the following lines just before the closing%mend
tag:/* ESM CONFIG START */ %include "%sysget(ESMHOME)/sasautos/startjes.sas"; /* ESM CONFIG END */
- After making a backup, modify
jesend.sas
in/opt/sas/spre/home/SASFoundation/sasautos
putting the following lines just before theoptions nonotes;
(circa line 51)/* ESM CONFIG START */ %include "%sysget(ESMHOME)/sasautos/endjes.sas"; /* ESM CONFIG END */
CAS Server¶
Download the latest version of the sas-cas-mon module. The credentials for the downloads site can be found in the email with the SAS Enterprise Session Monitor license key.
The following steps should be completed for each CAS Server in your environment which has an Agent deployed to it.
- Unzip the downloaded sas-cas-mon.zip file into the
modules
folder of your Agent installation. - Update the
vars.yml
file changing the following items1:- logDirectories - The path(s) in which the module should look for CAS logs.
- offsetFilesLocation - The full path to the folder that is use to store the offset files for read log files. You should just need to update the path to your ESM agent folder.
- Create the sas-cas-mon service:
- Update line 6 of the
sas-cas-mon.service
file updating the values ofESMHOME
,ESMEVENTS
,ESMNODENAME
for your environment including replacing<HOSTNAME>
with the name configured during the installation of the agent. - Update line 9 for the path to your modules folder
- As root or using sudo, copy the updated
sas-cas-mon.service
file to/etc/systemd/system
- As root or using sudo, run
systemctl daemon-reload
- Update line 6 of the
- Start the Module service by executing (as root):
systemctl start sas-cas-mon
The sas-cas-mon
uses CAS Action SAS logging to collect data. CAS logging will need to be enabled in order for the module to work correctly.
For complete information about the module, please review the reference guide.
Workspace Server¶
- Add the following lines to
/opt/sas/viya/config/etc/workspaceserver/<tenant>/workspaceserver_usermods.sh
modifying the following:<tenant>
in the path above to the appropriate folderESMBASEDIR
to the location of youresm-agent
folder# ESM CONFIG START export ESMBASEDIR=/opt/esm/esm-agent if [[ -f $ESMBASEDIR/conf/esmconfig.sh ]]; then . $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 fi # ESM CONFIG END
- Add the following snippet to
/opt/sas/viya/config/etc/workspaceserver/<tenant>/autoexec_usermods.sas
modifying<tenant>
in the path to the appropriate folder:/* ESM CONFIG START */ %if %sysfunc(envlen(ESMHOME)) > 0 %then %do; %let ESMHOME=%sysfunc(sysget(ESMHOME)); %include "&ESMHOME/sasautos/esmtags.sas"; %end; /* ESM CONFIG END */
Connect Server¶
- Add the following lines to
/opt/sas/viya/config/etc/connectserver/<tenant>/connectserver_usermods.sh
modifying the following:<tenant>
in the path above to the appropriate folderESMBASEDIR
to the location of youresm-agent
folder# ESM CONFIG START export ESMBASEDIR=/opt/esm/esm-agent if [[ -f $ESMBASEDIR/conf/esmconfig.sh ]]; then . $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-Connect export ESMSESSIONTYPE=CS fi # ESM CONFIG END
- Add the following snippet to
/opt/sas/viya/config/etc/connectserver/<tenant>/autoexec_usermods.sas
modifying<tenant>
in the path to the appropriate folder:/* ESM CONFIG START */ %if %sysfunc(envlen(ESMHOME)) > 0 %then %do; %let ESMHOME=%sysfunc(sysget(ESMHOME)); %include "&ESMHOME/sasautos/esmtags.sas"; %end; /* ESM CONFIG END */
Batch Server¶
- Add the following lines to
/opt/sas/viya/config/etc/batchserver/<tenant>/batchserver_usermods.sh
modifying the following:<tenant>
in the path above to the appropriate folderESMBASEDIR
to the location of youresm-agent
folder# ESM CONFIG START export ESMBASEDIR=/opt/esm/esm-agent if [[ -f $ESMBASEDIR/conf/esmconfig.sh ]]; then . $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=Interactive export ESMSESSIONTYPE=Batch fi # ESM CONFIG END
- Add the following snippet to
/opt/sas/viya/config/etc/batchserver/<tenant>/autoexec_usermods.sas
modifying<tenant>
in the path to the appropriate folder:/* ESM CONFIG START */ %if %sysfunc(envlen(ESMHOME)) > 0 %then %do; %let ESMHOME=%sysfunc(sysget(ESMHOME)); %include "&ESMHOME/sasautos/esmtags.sas"; %end; /* ESM CONFIG END */
-
For information about all of the configuration options available for the sas-proc-mon module, please see the module's reference guide. ↩
Created: April 24, 2023