• EnglishEspañol日本語한국어Português
  • Log inStart now

Collector for docker containers

You can collect metrics about your Docker containers with the OpenTelemetry collector. The collector is a component of OpenTelemetry that collects, processes, and exports telemetry data to New Relic (or any observability backend).

You can view this metric data in pre-built dashboards, create alert policies, and create custom queries and charts.

Complete the steps below to collect metrics from docker containers:

Step 1: Sign up for your free account if you haven't already

Step 2: Prerequisites

The collector will use the dockerstats receiver component (minimum version recommended v0.81.0), and it requires access to the docker daemon through an endpoint:

  • By default unix:///var/run/docker.sock endpoint is used. Therefore, the collector should be executed with a user able to read the docker socket.

Step 3: Install Opentelemetry collector

Download and install the Opentelemetry collector following Opentelemetry docs.

You will need to install OpenTelemetry Collector Contrib Distro or other distribution including, at least, the following components:

Step 4: Configure Opentelemetry collector

Update or create a new file called config.yaml from the example below.

Replace the NEW_RELIC_LICENSE_KEY in the file with your own values. For more info, see the New Relic License key.

receivers:
docker_stats:
metrics:
container.cpu.usage.total:
enabled: true
container.cpu.throttling_data.periods:
enabled: true
container.cpu.throttling_data.throttled_periods:
enabled: true
# `container.cpu.percent` is deprecated in favor of `container.cpu.utilization` in opentelemetry-collector-contrib v0.79.0
container.cpu.utilization:
enabled: true
container.cpu.percent:
enabled: false
container.memory.usage.limit:
enabled: true
container.memory.usage.total:
enabled: true
container.memory.percent:
enabled: true
container.blockio.io_service_bytes_recursive:
enabled: true
container.network.io.usage.rx_bytes:
enabled: true
container.network.io.usage.tx_bytes:
enabled: true
container.network.io.usage.rx_dropped:
enabled: true
container.network.io.usage.tx_dropped:
enabled: true
container.network.io.usage.rx_errors:
enabled: true
container.network.io.usage.tx_errors:
enabled: true
container.network.io.usage.rx_packets:
enabled: true
container.network.io.usage.tx_packets:
enabled: true
container.pids.count:
enabled: true
processors:
# resource and resource-detection processors allow decorating the metrics with host attributes
resource:
attributes:
- key: host.id
from_attribute: host.name
action: insert
resourcedetection:
detectors: ["env", "system"]
resourcedetection/cloud:
detectors: ["gcp", "ec2", "azure"]
timeout: 2s
override: false
exporters:
otlphttp:
endpoint: https://otlp.nr-data.net
headers:
api-key: NEW_RELIC_LICENSE_KEY
service:
telemetry:
logs:
pipelines:
metrics:
receivers: [docker_stats]
processors:
- resourcedetection
- resourcedetection/cloud
- resource
exporters: [otlphttp]

For further configuration options, please review:

Step 4: Run the collector

Run the Opentelemetry collector (the way to run it may vary depending on the chosen installation method). Example:

/usr/bin/otelcol-contrib --config ./config.yaml

Step 5: Find and use your data

Browse containers data in infrastructure UI

By using the recommended configuration for the Docker receiver, you can explore containers running on a host in the new Infrastructure UI (New Host UI) experience.

Take advantage of our entities driven experiences

The container's telemetry data originating from the Open Telemetry Docker receiver generates container entities. Entities are anything that reports data to New Relic and is identified by an unique entity ID.

Your monitored entities are the drivers of features like Entity Explorer, Workloads, and Lookout. Check this document for more information on how to get benefited from these experiences.

Explore and query your data

You may use the metrics explorer to check the metrics being ingested. All metrics reported by the docker stats receiver start by the "container." prefix.

The following NRQL queries show examples to help you query the metrics you received:

  • Listing number of metric updates ingested by metric name:

    SELECT count(*) FROM Metric WHERE metricName LIKE 'container.%' and instrumentation.provider='opentelemetry' facet metricName LIMIT max
  • Querying a specific metric faceted by host:

    SELECT average(container.cpu.percent) FROM Metric WHERE instrumentation.provider='opentelemetry' FACET host.name TIMESERIES
  • Listing dimensions available for a given metric:

    SELECT keyset() FROM Metric WHERE metricName = 'container.cpu.percent'

Install quickstart

Take advantage of the Docker dashboard included in the Docker Open Telemetry Quickstart to easily monitor your Docker infrastructure thanks to the predefined graphs and filters.

Metric data

For a list of all the supported metrics, please refer to the dockerstats receiver metrics reference.

Copyright © 2024 New Relic Inc.

This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.