Skip to content
This repository has been archived by the owner on Sep 19, 2022. It is now read-only.

Latest commit

 

History

History
 
 

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 

New Relic Infrastructure

This Docker image contains the New Relic Infrastructure agent capable of monitoring an underlying Docker host.

Why

Many new operating systems don't provide package managers and exclusively utilize containers for application deployment. This Docker image allows you to deploy the Infrastructure agent as a container that will monitor its underlying host.

Usage

Pulling

docker pull newrelic/infrastructure:latest

Simple Setup

  1. Run the container with the required run flags:

    docker run \
        -d \
        --name newrelic-infra \
        --network=host \
        --cap-add=SYS_PTRACE \
        -v "/:/host:ro" \
        -v "/var/run/docker.sock:/var/run/docker.sock" \
        -e NRIA_LICENSE_KEY="YOUR_LICENSE_KEY" \
        newrelic/infrastructure:latest

    Replacing "YOUR_LICENSE_KEY" with your license key.

Custom Setup (Recommended)

It's recommended that you extend the newrelic/infrastructure image and provide your own newrelic-infra.yml agent config file.

Building

  1. Create your newrelic-infra.yml agent config file, ex.

    license_key: YOUR_LICENSE_KEY

    See the Infrastructure config docs for more info.

  2. Create your Dockerfile extending the newrelic/infrastructure image and add your config to /etc/newrelic-infra.yml, ex.

    FROM newrelic/infrastructure:latest
    ADD newrelic-infra.yml /etc/newrelic-infra.yml
  3. Build and tag your image, ex.

    docker build -t your-image .

Running

Run the container from the image you built with the required run flags, ex.

docker run \
    -d \
    --name newrelic-infra \
    --net=host \
    --cap-add=SYS_PTRACE \
    -v "/:/host:ro" \
    -v "/var/run/docker.sock:/var/run/docker.sock" \
    your-image

Where your-image is the name you tagged your image with.

Why the required container privileges?

Due to resource isolation from the host and other containers via Linux namespaces, by default, a container has a very restricted view and control of its underlying host's resources. Without these extra privileges the Infrastructure agent would not be able to monitor the host and its containers.

The Infrastructure agent collects data about its host using system files and system calls. For more information about how the Infrastructure agent collects data see Infrastructure and security.

Required run flags

--network=host

Sets the container's network namespace to the host's network namespace. This allows the agent to collect the network metrics about the host.

-v "/:/host:ro"

Bind mounts the host's root volume to the container. This read-only access to the host's root allows the agent to collect process and storage metrics as well as Inventory data from the host.

--cap-add=SYS_PTRACE

Adds the linux capability to trace system processes. This allows the agent to gather data about processes running on the host. Read more here

-v "/var/run/docker.sock:/var/run/docker.sock"

Bind mounts the host's Docker daemon socket to the container. This allows the agent to connect to the Engine API via the Docker daemon socket to collect the host's container data.

Changelog

0.0.27

Added

  • NewRelic infrastructure agent runs under a init-process called Tini in order to avoid leaking defunct processes when running some integrations like Cassandra.