Install for other Linux (New Relic Servers)

For the latest, most advanced host monitoring, check out New Relic Infrastructure.

This document describes how to install Servers for Linux using:

  • A binary tarball that can be installed manually on any modern Linux-based operating system with glibc 2.5+
  • Configuration management software, including a Puppet manifest example
  • Docker container monitoring

These instructions are for advanced Linux users. If you are a Debian, Ubuntu, RedHat or CentOS user, refer to the procedures for Ubuntu and Debian or RedHat and CentOS for easier installation and long-term maintenance.

Tarball installation procedures

To install Servers for Linux via binary tarball:

1. Recommended: Set up the newrelic user.

New Relic recommends running the monitor as its own user; for example, on supported platforms New Relic has a user named newrelic. To create and configure a user of the same name.

  1. Create the home, config and log locations:

    mkdir /opt/newrelic
    mkdir /etc/newrelic
    mkdir /var/log/newrelic
    
  2. Add the group and user:

    groupadd -r newrelic
    useradd -r -g newrelic -d /opt/newrelic -s /sbin/nologin -c "New Relic monitoring daemon" newrelic
    
  3. Set ownership on these locations for the new user and group:

    chown newrelic:newrelic /opt/newrelic
    chown newrelic:newrelic /etc/newrelic/
    chown newrelic:newrelic /var/log/newrelic
    chmod 600 /etc/newrelic/
    
  4. Configure startup to use this user; for example:

    • Debian: Use the RUNAS command in /etc/default/newrelic-sysmond.
    • RedHat: Use /etc/sysconfig/newrelic-sysmond.
2. Download and extract the binary tarball.
  1. Download the tarball from https://download.newrelic.com/server_monitor/release/.
  2. Replace X.X.X.X with the correct version number when extracting the tarball:

    tar xvfz newrelic-sysmond-X.X.X.X-linux.tar.gz
3. Copy program files.

Copy nrsysmond-config and the appropriate nrsysmond binary to /usr/local/sbin. Replace X.X.X.X with the correct version number.

32-bit architectures:

cp newrelic-sysmond-X.X.X.X-linux/daemon/nrsysmond.x86 /usr/local/sbin/nrsysmond
cp newrelic-sysmond-X.X.X.X-linux/scripts/nrsysmond-config /usr/local/sbin

64-bit architectures:

cp newrelic-sysmond-X.X.X.X-linux/daemon/nrsysmond.x64 /usr/local/sbin/nrsysmond
cp newrelic-sysmond-X.X.X.X-linux/scripts/nrsysmond-config /usr/local/sbin

Copy the configuration file to /etc/newrelic as root:

cp newrelic-sysmond-X.X.X.X-linux/nrsysmond.cfg /etc/newrelic/nrsysmond.cfg

You may also chmod 600 the configuration file and chown it to the user the nrsysmond process will run as.

4. Configure your license key.

Use nrsysmond-config to specify your New Relic license key when you run the following as root:

/usr/local/sbin/nrsysmond-config --set license_key=YOUR_LICENSE_KEY

Alternatively, you can edit /etc/newrelic/nrsysmond.cfg and identify the license_key setting there.

5. Optional: Install startup scripts.

New Relic provides the RedHat and Debian startup scripts as a base for your own startup scripts. Edit the scripts as needed, then copy them to the appropriate location on your system; for example, /etc/init.d. Be sure to run any commands required to ensure the server monitor restarts after a system shutdown.

6. Start Servers for Linux.

Start Servers for Linux by using either of these methods:

  • Startup script; for example:

    /etc/init.d/newrelic-sysmond start
  • Command line: Run the nrsysmond command from the command prompt:

    /usr/local/sbin/nrsysmond -c /etc/newrelic/nrsysmond.cfg

Verify that a message indicates that nrsysmond has started successfully. Wait a few minutes, then view your server in the Servers UI.

7. Optional: Rotate your logs.

New Relic uses logrotate to handle log files. Here is an example script that can be saved to /etc/logrotate.d/newrelic-sysmond:

/var/log/newrelic/nrsysmond.log {
    rotate 7
    daily
    missingok
    notifempty
    sharedscripts
    copytruncate
    compress
}

Uninstall procedures

New Relic recommends that you follow standard procedures to uninstall Servers for Linux. For more information, refer to the procedures for Ubuntu and Debian or RedHat and CentOS as applicable.

Advanced users who used the tarball installation method may want to stop the service and remove the files. This includes:

  • Stopping the nrsymond service; for example:

    etc/init.d/newrelic-sysmond stop
  • Removing program files; for example:

    rm /etc/newrelic/nrsysmond.cfg /var/log/newrelic/nrsysmond.*
  • Removing other files from the location where you stored them, including nrsysmond and nrsysmond-config

  • Removing the directories where nrsysmond config and log files were stored, if they are empty; for example:

    rmdir /etc/newrelic /var/log/newrelic

Configuration management software

Servers for Linux needs very few files on the file system. The minimum requirements are the agent binary nrsysmond and the configuration file nrsysmond.cfg. If you want to use configuration management software, use a startup script that fits into your host's startup system (such as init or upstart). You will also need to store log files and a PID file.

The binary and the config file do not need to be different for each server. They can be stored on shared storage, and the log file and PID file locations can be specified by using the command line.

Puppet manifest example
class server_agent {
  package {
    "newrelic-sysmond":
      ensure => latest;
  }

  service {
    "newrelic-sysmond":
      enable => true,
      ensure => running,
      hasstatus => true,
      require => [ Package["newrelic-sysmond"], File["/etc/newrelic/nrsysmond.cfg"] ];
  }

  file {
    "/etc/newrelic/nrsysmond.cfg":
      mode => 640,
      owner => root,
      group => newrelic,
      require => Package['newrelic-sysmond'],
      notify => Service['newrelic-sysmond'],
      source => "puppet:///files/newrelic/nrsysmond.cfg";
  }
}

Docker monitoring with Servers

New Relic Servers for Linux includes integrated Docker monitoring features, which provide detailed insight into your running Docker containers and images. These features allow you to view connections between apps and containers, as well as between containers and servers.

If you are using New Relic Servers, Docker monitoring requires New Relic Servers for Linux version 2.1.0 or higher, and is only available for 64-bit systems. To take advantage of enhanced Docker monitoring capabilities, use New Relic Infrastructure.

Installation

Enable Docker monitoring after installing New Relic Servers.

  1. Install and configure Docker.
  2. Install New Relic Servers for Linux on your Docker server, not on your Docker container.
  3. If a docker group does not already exist, create a new group named docker:

    groupadd -r docker
  4. Add the newrelic user to the docker group with a command similar to:

    usermod -a -G docker newrelic
  5. Restart Docker.
  6. Restart the New Relic Servers for Linux agent.
  7. Wait a few minutes, then view your Docker metrics from the New Relic Servers Virtualization page.
Container file location

Most installations require no additional configuration. However, some older Linux distributions store their Docker container data files in non-standard locations.

Container files Comments
CGroup Root

If your distribution stores its CGroup files in a non-default location, you can specify the location in nrsysmond.cfg. Add the following command to nrsysmond.cfg, customizing the root directory for your system if necessary:

cgroup_root="/sys/fs/cgroup"
Path to the Stat files

By default, the CPU and Memory stats collected per container are recorded from:

/sys/fs/cgroup/cpu/system.slice/docker-{container_id}/cpu.stat
/sys/fs/cgroup/memory/system.slice/docker-{container_id}/memory.stat

However, some Linux distributions customize this path, typically at:

/sys/fs/cgroup/memory/docker/{container_id}/memory.stat
/sys/fs/cgroup/cpu/docker/{container_id}/cpu.stat

To use this path instead, add the following command to nrsysmond.cfg, then restart the server monitor to apply the change:

cgroup_style=0
Memory usage metrics

On some Linux distributions, memory metric collection is disabled by default. To capture memory metrics with New Relic Servers, enable memory metric collection by adding kernel command-line parameters. For more information, see the Docker runtime metrics documentation.

Metrics in APM

Docker metrics are integrated into the APM Overview page for individual applications. Each row displays performance metrics specific to that container. If Servers for Linux is installed on the target server, Docker containers are labeled with a container docker-container-icon.png icon and rolled up by their host server.

screen-docker-instances-explanation.png
APM > (selected app) > Overview: The APM Overview page lists each server on which the app is running. Apps in Docker containers are rolled up by host server when Servers for Linux is installed.
Metrics in Servers

To analyze your Docker container's impact on your server, use the Docker page at Servers > (selected server) > Docker:

  • Sort the list of images by CPU or Memory usage with the Sort By dropdown.
  • View summary metrics for each image, including number of containers per image, by selecting View as table.
  • Select an individual image name to drill down to charts and metrics for only that image.

The Servers product aggregates Docker data for all Docker images of the same type. Data is not available at the Docker container level.

screen-docker-page.png
Servers > (selected server) > Server > Docker: Use the Docker page to view metrics for individual Docker images, including drill-down details accessible by selecting a particular image from the list.

For more help

Additional documentation resources include:

Discuss New Relic Servers in the New Relic Online Technical Community! Troubleshoot and ask questions, or discuss Servers for Linux or Servers for Windows in detail.

If you need additional help, get support at support.newrelic.com.