You can collect metrics and logs from your infrastructure hosts with OpenTelemetry and leverage the same infrastructure experiences that are available for New Relic agents. Specific receivers and processors are required in the OTel collector to collect and report host telemetry.
If you're looking for help with other collector use cases, see the newrelic-opentelemetry-examples repository.
Make sure you've completed the following before going further:
- If you haven't already done so, sign up for a free New Relic account.
- Get the for the New Relic account to which you want to report data.
To do a basic installation for single hosts in the cloud or on-premises, see OpenTelemetry's instructions for up-to-date installation steps from the community. Instructions are available for the following:
- Linux: Debian systems
- Linux: Red Hat
- Docker, Kubernetes, and other options
Your deployment experience might vary depending on which vendor-specific distributions you use. For example, installation via a package manager might be available for Linux hosts.
To set up infrastructure monitoring, you need to install and configure components that are included in the
collector-contrib release. For example, the host receiver is required to collect basic host metrics such as CPU, memory, disk, and network stats and is only available in the OpenTelemetry Collector-contrib release.
This collector example is meant to serve as a starting point from which you can extend, customize, and validate configurations before using them in production.
collector-contrib release includes:
hostreceiverthat generates metrics about the system scraped from various sources. Deploy the collector as an agent when you use a
filelogreceiverthat tails and parses logs from files.
When using the host receiver as part of the collector configuration, New Relic automatically detects host metrics as part of a
Host entity and will synthesize its golden metrics providing the same experience as with the New Relic infrastructure agent. The following are the configuration requirements to enable the
Host entity experience in New Relic UI:
host.idattribute is present in host metrics.
container.idattributes are not present in host metrics.
Learn more about available metrics and advanced configurations from the OpenTelemetry documentation in GitHub.
Here is a sample configuration YAML file for a linux host. Be sure to do the following:
OTLP_ENDPOINT_HEREwith the appropriate endpoint.
YOUR_KEY_HEREwith your .
- Adjust the target log files in the filelog receiver section based on your requirements.
- Adjust the
memory_limiterdefault values based on your environment requirements.
extensions:health_check:receivers:hostmetrics:collection_interval: 20sscrapers:cpu:metrics:system.cpu.utilization:enabled: trueload:memory:metrics:system.memory.utilization:enabled: truedisk:filesystem:metrics:system.filesystem.utilization:enabled: truenetwork:paging:metrics:system.paging.utilization:enabled: trueprocesses:process:metrics:process.cpu.utilization:enabled: trueprocess.cpu.time:enabled: falsefilelog:include:- /var/log/alternatives.log- /var/log/cloud-init.log- /var/log/auth.log- /var/log/dpkg.log- /var/log/syslog- /var/log/messages- /var/log/secure- /var/log/yum.logprocessors:transform/truncate:trace_statements:- context: spanstatements:- truncate_all(attributes, 4095)- truncate_all(resource.attributes, 4095)log_statements:- context: logstatements:- truncate_all(attributes, 4095)- truncate_all(resource.attributes, 4095)memory_limiter:check_interval: 1slimit_mib: 1000spike_limit_mib: 200batch:resourcedetection:detectors: [env, system]system:hostname_sources: ["os"]resource_attributes:host.id:enabled: trueresourcedetection/cloud:detectors: ["gcp", "ec2", "azure"]timeout: 2soverride: falseexporters:otlp:endpoint: OTLP_ENDPOINT_HEREheaders:api-key: YOUR_KEY_HEREservice:pipelines:metrics:receivers: [hostmetrics]processors: [memory_limiter, resourcedetection, resourcedetection/cloud, batch]exporters: [logging, otlp]traces:receivers: [otlp]processors: [memory_limiter, transform/truncate, resourcedetection, resourcedetection/cloud, batch]exporters: [logging, otlp]logs:receivers: [otlp, filelog]processors: [memory_limiter, transform/truncate, resourcedetection, resourcedetection/cloud, batch]exporters: [logging, otlp]extensions: [health_check]
You can view your collector data in a variety of places in the New Relic UI.
By using the recommended configuration in the collector, you can view data through the standard features in the Infrastructure UI experience.
The following NRQL queries show examples to help you explore the metrics you received:
Listing number of metric updates ingested by metric nameSELECT count(*) FROM Metric WHERE metricName LIKE 'system.%' FACET metricName LIMIT max
Querying specific metrics faceted by hostSELECT average(system.disk.operations) FROM Metric FACET host.name TIMESERIES
Listing dimensions available for a given metricSELECT keyset() FROM Metric WHERE metricName = 'system.disk.operations'
Querying number of log events per hostSELECT count(*) FROM Log FACET host.name TIMESERIES
Learn more about querying the metric data type.
After you set up your collector, check out our best practices guide for tips to improve your use of OpenTelemetry and New Relic.