Configuring the Ruby agent

To have the Ruby agent monitor your applications, specify the Ruby run time. As a result, you use the run time to gather data from the Ruby applications and to configure the agent.

Before you begin

Determine the server that you use to start Ruby applications, and the qualified bin directory for the Ruby or Rake executable that the agent uses:
  1. To determine the application server that you are using, run the following command:
    ps -ef | grep ruby
    You see the name of the server that is used to start your application. The possible server names are listed as follows:
    • Passenger
    • Unicorn
    • Puma
    • Thin

    If the command output does not indicate the server names that are shown in the preceding list, the server that you use to start the application might be WEBrick.

    Important: If you use multiple web servers to start your Ruby applications, you must create one agent instance for each application web server, for example, one instance for PUMA and one for Unicorn.
  2. To determine the qualified bin directory for the Ruby or Rake executable that the Ruby agent uses, run the following command:
    which ruby

About this task

You can repeat this task to configure multiple agent instances according to your needs.

Procedure

  1. To configure the agent, run the following command:
    install_dir/bin/ruby-agent.sh config instance_name
    where instance_name is the name you want to give to the instance, and install_dir is the installation directory of the Ruby agent. The default installation directory is /opt/ibm/apm/agent.
    Important: Do not specify a long instance name. The total length of your host name and the agent instance name must not exceed 28 characters. If the length exceeds the limit, the Managed System Name is truncated, and the product code for the Ruby agent does not display correctly.

    The Managed System Name includes the instance name that you specify, for example, instance_name:host_name:pc, where pc is your two character product code for the agent. For example, if you specify Ruby2 as your instance name, your managed system name is Ruby2:hostname:KM, where KM is the two character product code for the Ruby agent.

  2. When you are prompted with Edit 'Monitoring Agent for Ruby' settings, enter 1 to continue.
  3. When you are prompted with Fully Qualified Rubies Bin Directory, specify the binary directory. for example, if you use Ruby Version Manager (RVM), enter /usr/local/rvm/rubies/ruby-2.0.0-p247/bin.
  4. When prompted with Auto Detect Ruby Applications Flag, enter Y to continue. The agent receives the data that the agent data collector sends.
  5. When you are prompted with Application Server Process name, press Enter to accept the default of ruby, or specify the value for the server that you use according to the following list:
    • For WEBrick servers, accept the default or specify ruby; if Rails is installed by Ruby Stack, specify .ruby.bin.
    • For Passenger servers, specify passenger.
    • For Unicorn servers, specify unicorn.
    • For Puma servers, specify puma.
    • For Thin servers, if the applications are started by running the command thin start, accept the default to use ruby; if the applications are started by running the command thin start -d, specify thin; if Rails is installed by Ruby Stack and the applications are started by running the command thin start, specify .ruby.bin.
  6. When you are prompted with Socket Data Source, press Enter to accept the default of 0 to use the ephemeral port.
  7. When you are prompted with Edit 'Application' settings, enter 5 to exit the setting.
  8. To start the agent, run the following command:
    install_dir/bin/ruby-agent.sh start instance_name

What to do next

Install the data collector for the Ruby agent to work properly and for the data to display in Cloud APM UI. For instructions, see Installing the data collector