Skip to content

Agent as a Service

systemd

For RHEL7+, Ubuntu 16.04+, and other modern Linux distributions, the systemd service manager is used.

Install Service

Values to update

Remember to change the references to ##ESMHOME## below to point to real install path (eg. /opt/esm/esm-agent)

  1. As root or using sudo, create a file called esm-agent.service in /etc/systemd/system with the below contents modifying:
    [Unit]
    Description=SAS Enterprise Session Monitor Agent
    After=network.target
    
    [Service]
    ExecStart=##ESMHOME##/bin/esm-agent-nonforking.sh start
    Restart=on-failure
    Type=simple
    TimeoutStartSec=10
    TimeoutStopSec=5
    RestartSec=2
    ExecStop=##ESMHOME##/bin/esm-agent-nonforking.sh stop
    SuccessExitStatus=143
    
    [Install]
    WantedBy=multi-user.target
    
  2. As root or using sudo, run systemctl daemon-reload to pickup the newly created service.

Enable Startup at Boot

  1. As root or using sudo, run systemctl enable esm-agent

Service Commands

Status

  1. As root or using sudo, run systemctl status esm-agent

Start

  1. As root or using sudo, run systemctl start esm-agent

Stop

  1. As root or using sudo, run systemctl stop esm-agent

Restart

It is possible to issue sequential stop and start command with a single "restart" command.

  1. As root or using sudo, run systemctl restart esm-agent

upstart

For RHEL6 systems, the upstart service manager is used.

Install Service

Values to update

Remember to change the references to ##ESMHOME## below to point to real install path (eg. /opt/esm/esm-agent)

  1. As root or using sudo, create a file called esm-agent.conf in /etc/init with the below contents modifying:
    #!upstart
    description "SAS Enterprise Session Monitor agent"
    
    # Set this to location of installed agent
    env ESMHOME=##ESMHOME##
    
    start on runlevel [2345]
    stop on runlevel [!2345]
    
    # Be nice and set some limits on open file handles
    limit nofile 4096 4096
    
    # But also make sure data gets collected when needed most
    nice -15
    
    # Return output about connecting to the SAS Enterprise Session Monitor server to the console
    console output
    
    # Restart automatically if agent stops but no more than 3x in the space of a minute
    respawn
    respawn limit 3 60
    
    # Go
    exec $ESMHOME/bin/esm-agent-nonforking.sh start
    
  2. As root or using sudo, run initctl --verbose reload-configuration to pickup the newly created service.

Enable Startup at Boot

Services running with upstart are automatically configured to start on boot.

Service Commands

Status

  1. As root or using sudo, run status esm-agent

Start

  1. As root or using sudo, run start esm-agent

Stop

  1. As root or using sudo, run stop esm-agent

Restart

It is possible to issue sequential stop and start command with a single "restart" command.

  1. As root or using sudo, run restart esm-agent

Windows

The Enterprise Session Monitor Agent is automatically installed as Windows Service via the installation Wizard.

The Enterprise Session Monitor Agent Service can be controlled and configured via the Windows Services application.


Last update: April 24, 2023
Created: April 24, 2023