OpenTelemetry Bot d680729c09 [chore] Prepare release 0.90.0 (#29543) 1 년 전
..
internal 59504d5b61 [receiver/hostmetrics] Add optional system.linux.memory.available metric (#27247) 1 년 전
testdata 8d0ca3de00 [receiver/hostmetrics] make sure process scraper uses root_path config entry (#26479) 1 년 전
Makefile dc1e665ca7 Move hostmetricsreceiver from collector core to collector contrib (#4831) 3 년 전
README.md 2ebed0c8ca [receiver/hostmetrics] Add braydonk to hostmetricsreceiver codeowners (#29292) 1 년 전
config.go 36fc4261cb [receiver/hostmetrics] Remove the need to set environment variables (#23861) 1 년 전
config_test.go 36fc4261cb [receiver/hostmetrics] Remove the need to set environment variables (#23861) 1 년 전
doc.go f59b854a1c [chore][receiver/hostmetrics] create metadata (#21827) 1 년 전
example_config.yaml 4982f49841 [chore] update examples to use debugexporter (#26715) 1 년 전
factory.go 65b745f7c5 hostmetricsreceiver: remove unused function (#29075) 1 년 전
factory_test.go 5133f4ccd6 [chore] use license shortform (#22052) 1 년 전
go.mod d680729c09 [chore] Prepare release 0.90.0 (#29543) 1 년 전
go.sum 40b485f08a Update core for v0.90.0 release (#29539) 1 년 전
hostmetrics_linux.go 36fc4261cb [receiver/hostmetrics] Remove the need to set environment variables (#23861) 1 년 전
hostmetrics_linux_test.go 36fc4261cb [receiver/hostmetrics] Remove the need to set environment variables (#23861) 1 년 전
hostmetrics_others.go 36fc4261cb [receiver/hostmetrics] Remove the need to set environment variables (#23861) 1 년 전
hostmetrics_others_test.go 36fc4261cb [receiver/hostmetrics] Remove the need to set environment variables (#23861) 1 년 전
hostmetrics_receiver_test.go 36fc4261cb [receiver/hostmetrics] Remove the need to set environment variables (#23861) 1 년 전
integration_test.go 8d0ca3de00 [receiver/hostmetrics] make sure process scraper uses root_path config entry (#26479) 1 년 전
metadata.yaml 2ebed0c8ca [receiver/hostmetrics] Add braydonk to hostmetricsreceiver codeowners (#29292) 1 년 전

README.md

Host Metrics Receiver

Status
Stability beta: metrics
Distributions core, contrib, observiq, splunk, sumo
Issues Open issues Closed issues
Code Owners @dmitryax, @braydonk

The Host Metrics receiver generates metrics about the host system scraped from various sources. This is intended to be used when the collector is deployed as an agent.

Getting Started

The collection interval, root path, and the categories of metrics to be scraped can be configured:

hostmetrics:
  collection_interval: <duration> # default = 1m
  initial_delay: <duration> # default = 1s
  root_path: <string>
  scrapers:
    <scraper1>:
    <scraper2>:
    ...

The available scrapers are:

Scraper Supported OSs Description
cpu All except Mac[1] CPU utilization metrics
disk All except Mac[1] Disk I/O metrics
load All CPU load metrics
filesystem All File System utilization metrics
memory All Memory utilization metrics
network All Network interface I/O metrics & TCP connection metrics
paging All Paging/Swap space utilization and I/O metrics
processes Linux, Mac Process count metrics
process Linux, Windows, Mac Per process CPU, Memory, and Disk I/O metrics

Notes

[1] Not supported on Mac when compiled without cgo which is the default.

Several scrapers support additional configuration:

Disk

disk:
  <include|exclude>:
    devices: [ <device name>, ... ]
    match_type: <strict|regexp>

File System

filesystem:
  <include_devices|exclude_devices>:
    devices: [ <device name>, ... ]
    match_type: <strict|regexp>
  <include_fs_types|exclude_fs_types>:
    fs_types: [ <filesystem type>, ... ]
    match_type: <strict|regexp>
  <include_mount_points|exclude_mount_points>:
    mount_points: [ <mount point>, ... ]
    match_type: <strict|regexp>

Load

cpu_average specifies whether to divide the average load by the reported number of logical CPUs (default: false).

load:
  cpu_average: <false|true>

Network

network:
  <include|exclude>:
    interfaces: [ <interface name>, ... ]
    match_type: <strict|regexp>

Process

process:
  <include|exclude>:
    names: [ <process name>, ... ]
    match_type: <strict|regexp>
  mute_process_name_error: <true|false>
  mute_process_exe_error: <true|false>
  mute_process_io_error: <true|false>
  mute_process_user_error: <true|false>
  scrape_process_delay: <time>

Advanced Configuration

Filtering

If you are only interested in a subset of metrics from a particular source, it is recommended you use this receiver with the Filter Processor.

Different Frequencies

If you would like to scrape some metrics at a different frequency than others, you can configure multiple hostmetrics receivers with different collection_interval values. For example:

receivers:
  hostmetrics:
    collection_interval: 30s
    scrapers:
      cpu:
      memory:

  hostmetrics/disk:
    collection_interval: 1m
    scrapers:
      disk:
      filesystem:

service:
  pipelines:
    metrics:
      receivers: [hostmetrics, hostmetrics/disk]

Collecting host metrics from inside a container (Linux only)

Host metrics are collected from the Linux system directories on the filesystem. You likely want to collect metrics about the host system and not the container. This is achievable by following these steps:

1. Bind mount the host filesystem

The simplest configuration is to mount the entire host filesystem when running the container. e.g. docker run -v /:/hostfs ....

You can also choose which parts of the host filesystem to mount, if you know exactly what you'll need. e.g. docker run -v /proc:/hostfs/proc.

2. Configure root_path

Configure root_path so the hostmetrics receiver knows where the root filesystem is. Note: if running multiple instances of the host metrics receiver, they must all have the same root_path.

Example:

receivers:
  hostmetrics:
    root_path: /hostfs

Resource attributes

Currently, the hostmetrics receiver does not set any Resource attributes on the exported metrics. However, if you want to set Resource attributes, you can provide them via environment variables via the resourcedetection processor. For example, you can add the following resource attributes to adhere to Resource Semantic Conventions:

export OTEL_RESOURCE_ATTRIBUTES="service.name=<the name of your service>,service.namespace=<the namespace of your service>,service.instance.id=<uuid of the instance>"