Host Metrics | Honeycomb

Host Metrics

OpenTelemetry Collector can be deployed as an agent running on individual hosts, where it will regularly collect and forward diagnostic information about the system it runs on. For example, it can collect regular samples of CPU, memory, disk, and network utilization so that this data can be visualized in a Honeycomb query. These instructions describe how to install and run OpenTelemetry Collector in this way, and send the data it collects into Honeycomb.

How It Works 

OpenTelemetry Collector can be widely deployed across all your hosts as an agent. It can then be configured to scrape a specific set of system metrics at a regular interval (for example, once every 10 seconds), batch that data, and forward it to Honeycomb for querying and display. Each data point will be tagged with information about the host it was collected from, so that you can calculate aggregations across arbitrary subsets of production hosts.

An architecture diagram depicting OpenTelemetry Collector running on a host, scraping metrics and sending data to Honeycomb over OTLP.

Installing and Running OpenTelemetry Collector Agents 

The easiest way to get started collecting host metrics is by using one of our Collector binaries.

Download a binary that is compatible with your system, along with the honeycomb-metrics-config.yaml file. Run the binary with the command below. Substitute xxxxx with your API key, hostmetrics with the name of the dataset you would like to send metrics to, otelcol_hny_linux_amd64 with the path to the binary you are using, foozle with your service name, and production with your environment:

HNY_API_KEY=xxxxx \
HNY_DATASET=hostmetrics \
OTEL_RESOURCE_ATTRIBUTES=',deployment.environment=production' \
./otelcol_hny_linux_amd64 --config ./honeycomb-metrics-config.yaml

A process will start and begin sending metrics to your dataset every 10 seconds.

Customizing the Agent Configuration 

You can add custom resource attributes to all your data points by changing the OTEL_RESOURCE_ATTRIBUTES environment variable. Attributes are separated by the comma character (,). (See more information about attributes and this environment variable.)

If your host is deployed using Docker, Google Cloud, Google Kubernetes Engine, Amazon EC2, Amazon ECS, Amazon Elastic Beanstalk, Amazon EKS, or Azure, you can utilize the resource detection processor to automatically add metadata about the host to every metric data point. (See more information about the resource detection processor.) To enable the resource detection processor, edit the configuration file and add a value from the list below to processors.resourcedetection.detectors:

  • Docker: docker
  • Google Cloud: gce
  • EC2: ec2
  • ECS: ecs
  • Azure: azure

You can change the log level by editing the config file and adjusting exporters.logging.logLevel to debug, info, warn, or error. See more information about the logging exporter.

You can tweak the collection interval of your hostmetrics by adjusting receivers.hostmetrics.collection_interval. You can also disable specific scrapers by removing them from the list in receivers.hostmetrics.scrapers. See more information about the hostmetrics receiver.

Using a Custom Build of OpenTelemetry Collector 

It is possible to use a different build of OpenTelemetry Collector to send host metrics to Honeycomb. If you do this, we still recommend using our honeycomb-metrics-config.yaml file as a basis for your configuration, since it is designed to keep your event volume low while providing you with as much data as possible in each event.

See more about managing your metrics data volume, and about using your own collector with this configuration.