Host metrics

Collect metric data from the local system

status: beta role: daemon delivery: at-least-once egress: batch state: stateless output: metrics
Examines system data sources on the local system and generates metrics describing utilization of various system resources, such as CPU, memory, disk, and network utilization.

Warnings

When vector is run under kubernetes, you may experience an error when loading the partition usage data: Failed to load partition usage data. mount_point="/host/proc/sys/fs/binfmt_misc" error=FFI function "statvfs" call failed: Too many levels of symbolic links (os error 40) To work around this configuration issue, add one of the following lines to the host_metrics configuration section: filesystem.devices.excludes = ["binfmt_misc"], filesystem.filesystems.excludes = ["binfmt_misc"], or filesystem.mountpoints.excludes = ["*/proc/sys/fs/binfmt_misc"]. This workaround is included by default in the Helm chart distributed with Vector.

Configuration

Example configurations

{
  "sources": {
    "my_source_id": {
      "type": "host_metrics",
      "collectors": [
        "cgroups"
      ],
      "scrape_interval_secs": 15
    }
  }
}
[sources.my_source_id]
type = "host_metrics"
collectors = [ "cgroups" ]
scrape_interval_secs = 15
---
sources:
  my_source_id:
    type: host_metrics
    collectors:
      - cgroups
    scrape_interval_secs: 15
{
  "sources": {
    "my_source_id": {
      "type": "host_metrics",
      "collectors": [
        "cgroups"
      ],
      "namespace": "host",
      "scrape_interval_secs": 15
    }
  }
}
[sources.my_source_id]
type = "host_metrics"
collectors = [ "cgroups" ]
namespace = "host"
scrape_interval_secs = 15
---
sources:
  my_source_id:
    type: host_metrics
    collectors:
      - cgroups
    namespace: host
    scrape_interval_secs: 15
    cgroups: null
    disk: null
    filesystem: null
    network: null

cgroups

optional object

Options for the “cgroups” (controller groups) metrics collector.

Note: this collector is only available on Linux systems, and only supports either version 2 or hybrid cgroups.

cgroups.base

optional string literal
The base cgroup name to provide metrics for
Examples
"/"
"system.slice/snapd.service"

cgroups.groups

optional object
Lists of group name patterns to include or exclude.
cgroups.groups.excludes
optional [string]

The list of cgroup name patterns for which to gather metrics.

Defaults to excluding no cgroups.

The patterns are matched using globbing.

cgroups.groups.includes
optional [string]

The list of cgroup name patterns for which to gather metrics.

Defaults to including all cgroups.

The patterns are matched using globbing.

default: [*]

cgroups.levels

optional uint
The number of levels of the cgroups hierarchy for which to report metrics. A value of 1 means just the root or named cgroup.
Examples
1
3
default: 100

collectors

common optional [string]
The list of host metric collector services to use. Defaults to all collectors.
Array string literal
Examples
[
  "cgroups",
  "cpu",
  "disk",
  "filesystem",
  "load",
  "host",
  "memory",
  "network"
]
default: [cgroups cpu disk filesystem load host memory network]

disk

optional object
Options for the “disk” metrics collector.

disk.devices

optional object
Lists of device name patterns to include or exclude.
disk.devices.excludes
optional [string]

The list of device name patterns for which to gather I/O utilization metrics.

Defaults to excluding no devices.

The patterns are matched using globbing.

disk.devices.includes
optional [string]

The list of device name patterns for which to gather I/O utilization metrics.

Defaults to including all devices.

The patterns are matched using globbing.

default: [*]

filesystem

optional object
Options for the “filesystem” metrics collector.

filesystem.devices

optional object
Lists of device name patterns to include or exclude.

The list of device name patterns for which to gather usage metrics.

Defaults to excluding no devices.

The patterns are matched using globbing.

The list of device name patterns for which to gather usage metrics.

Defaults to including all devices.

The patterns are matched using globbing.

default: [*]

filesystem.filesystems

optional object
Lists of filesystem name patterns to include or exclude.

The list of filesystem name patterns for which to gather usage metrics.

Defaults to excluding no filesystems.

The patterns are matched using globbing.

The list of filesystem name patterns for which to gather usage metrics.

Defaults to including all filesystems.

The patterns are matched using globbing.

default: [*]

filesystem.mountpoints

optional object
Lists of mount point path patterns to include or exclude.

The list of mount point path patterns for which to gather usage metrics.

Defaults to excluding no mount points.

The patterns are matched using globbing.

The list of mount point path patterns for which to gather usage metrics.

Defaults to including all mount points.

The patterns are matched using globbing.

default: [*]

namespace

optional string literal
The namespace of metrics. Disabled if empty.
default: host

network

optional object
Options for the “network” metrics collector.

network.devices

optional object
Lists of device name patterns to include or exclude.
network.devices.excludes
optional [string]

The list of device name patterns for which to gather network utilization metrics.

Defaults to excluding no devices.

The patterns are matched using globbing.

network.devices.includes
optional [string]

The list of device name patterns for which to gather network utilization metrics.

Defaults to including all devices.

The patterns are matched using globbing.

default: [*]

scrape_interval_secs

common optional uint
The interval between metric gathering, in seconds.
default: 15 (seconds)

Environment variables

PROCFS_ROOT

common optional string literal
Sets an arbitrary path to the system’s Procfs root. Can be used to expose host metrics from within a container. Unset and uses system /proc by default.
Examples
/mnt/host/proc

SYSFS_ROOT

common optional string literal
Sets an arbitrary path to the system’s Sysfs root. Can be used to expose host metrics from within a container. Unset and uses system /sys by default.
Examples
/mnt/host/sys

Output

Metrics

boot_time

gauge
The UNIX timestamp of the last boot.
collector required
Which collector this metric comes from.
host required
The hostname of the originating system.

cgroup_cpu_system_seconds_total

counter
The total amount of CPU time spent by this cgroup in system tasks, in seconds.
cgroup required
The control group name.
collector required
Which collector this metric comes from.
host required
The hostname of the originating system.

cgroup_cpu_usage_seconds_total

counter
The total amount CPU time used by this cgroup and its descendants, in seconds.
cgroup required
The control group name.
collector required
Which collector this metric comes from.
host required
The hostname of the originating system.

cgroup_cpu_user_seconds_total

counter
The total amount of CPU time spent by this cgroup in user space, in seconds.
cgroup required
The control group name.
collector required
Which collector this metric comes from.
host required
The hostname of the originating system.

cgroup_memory_anon_bytes

gauge
The total amount of memory used by this cgroup in anonymous mappings (normal program allocation), in bytes.
cgroup required
The control group name.
collector required
Which collector this metric comes from.
host required
The hostname of the originating system.

cgroup_memory_current_bytes

gauge
The total amount of memory currently being used by this cgroup and its descendants, in bytes.
cgroup required
The control group name.
collector required
Which collector this metric comes from.
host required
The hostname of the originating system.

cgroup_memory_file_bytes

gauge
The total amount of memory used by this cgroup to cache filesystem data, including tmpfs and shared memory, in bytes.
cgroup required
The control group name.
collector required
Which collector this metric comes from.
host required
The hostname of the originating system.

disk_read_bytes_total

counter
The accumulated number of bytes read in.
collector required
Which collector this metric comes from.
device required
The disk device name.
host required
The hostname of the originating system.

disk_reads_completed_total

counter
The accumulated number of read operations completed.
collector required
Which collector this metric comes from.
device required
The disk device name.
host required
The hostname of the originating system.

disk_writes_completed_total

counter
The accumulated number of write operations completed.
collector required
Which collector this metric comes from.
device required
The disk device name.
host required
The hostname of the originating system.

disk_written_bytes_total

counter
The accumulated number of bytes written out.
collector required
Which collector this metric comes from.
device required
The disk device name.
host required
The hostname of the originating system.

filesystem_free_bytes

gauge
The number of bytes free on the named filesystem.
collector required
Which collector this metric comes from.
device required
The disk device name.
filesystem required
The name of the filesystem type.
host required
The hostname of the originating system.

filesystem_total_bytes

gauge
The total number of bytes in the named filesystem.
collector required
Which collector this metric comes from.
device required
The disk device name.
filesystem required
The name of the filesystem type.
host required
The hostname of the originating system.

filesystem_used_bytes

gauge
The number of bytes used on the named filesystem.
collector required
Which collector this metric comes from.
device required
The disk device name.
filesystem required
The name of the filesystem type.
host required
The hostname of the originating system.

filesystem_used_ratio

gauge
The ratio between used and total bytes on the named filesystem.
collector required
Which collector this metric comes from.
device required
The disk device name.
filesystem required
The name of the filesystem type.
host required
The hostname of the originating system.

host_cpu_seconds_total

counter
The number of CPU seconds accumulated in different operating modes.
collector required
Which collector this metric comes from.
cpu required
The index of the CPU core or socket.
host required
The hostname of the originating system.
mode required
Which mode the CPU was running in during the given time.

load1

gauge
System load averaged over the last 1 second.
collector required
Which collector this metric comes from.
host required
The hostname of the originating system.

load15

gauge
System load averaged over the last 15 seconds.
collector required
Which collector this metric comes from.
host required
The hostname of the originating system.

load5

gauge
System load averaged over the last 5 seconds.
collector required
Which collector this metric comes from.
host required
The hostname of the originating system.

memory_active_bytes

gauge
The number of bytes of active main memory.
collector required
Which collector this metric comes from.
host required
The hostname of the originating system.

memory_available_bytes

gauge
The number of bytes of main memory available.
collector required
Which collector this metric comes from.
host required
The hostname of the originating system.

memory_buffers_bytes

gauge
The number of bytes of main memory used by buffers.
collector required
Which collector this metric comes from.
host required
The hostname of the originating system.

memory_cached_bytes

gauge
The number of bytes of main memory used by cached blocks.
collector required
Which collector this metric comes from.
host required
The hostname of the originating system.

memory_free_bytes

gauge
The number of bytes of main memory not used.
collector required
Which collector this metric comes from.
host required
The hostname of the originating system.

memory_inactive_bytes

gauge
The number of bytes of main memory that is not active.
collector required
Which collector this metric comes from.
host required
The hostname of the originating system.

memory_shared_bytes

gauge
The number of bytes of main memory shared between processes.
collector required
Which collector this metric comes from.
host required
The hostname of the originating system.

memory_swap_free_bytes

gauge
The number of free bytes of swap space.
collector required
Which collector this metric comes from.
host required
The hostname of the originating system.

memory_swap_total_bytes

gauge
The total number of bytes of swap space.
collector required
Which collector this metric comes from.
host required
The hostname of the originating system.

memory_swap_used_bytes

gauge
The number of used bytes of swap space.
collector required
Which collector this metric comes from.
host required
The hostname of the originating system.

memory_swapped_in_bytes_total

counter
The number of bytes that have been swapped in to main memory.
collector required
Which collector this metric comes from.
host required
The hostname of the originating system.

memory_swapped_out_bytes_total

counter
The number of bytes that have been swapped out from main memory.
collector required
Which collector this metric comes from.
host required
The hostname of the originating system.

memory_total_bytes

gauge
The total number of bytes of main memory.
collector required
Which collector this metric comes from.
host required
The hostname of the originating system.

memory_used_bytes

gauge
The number of bytes of main memory used by programs or caches.
collector required
Which collector this metric comes from.
host required
The hostname of the originating system.

memory_wired_bytes

gauge
The number of wired bytes of main memory.
collector required
Which collector this metric comes from.
host required
The hostname of the originating system.

network_receive_bytes_total

gauge
The number of bytes received on this interface.
collector required
Which collector this metric comes from.
device required
The network interface device name.
host required
The hostname of the originating system.

network_receive_errs_total

gauge
The number of errors encountered during receives on this interface.
collector required
Which collector this metric comes from.
device required
The network interface device name.
host required
The hostname of the originating system.

network_receive_packets_total

gauge
The number of packets received on this interface.
collector required
Which collector this metric comes from.
device required
The network interface device name.
host required
The hostname of the originating system.

network_transmit_bytes_total

gauge
The number of bytes transmitted on this interface.
collector required
Which collector this metric comes from.
device required
The network interface device name.
host required
The hostname of the originating system.

network_transmit_errs_total

gauge
The number of errors encountered during transmits on this interface.
collector required
Which collector this metric comes from.
device required
The network interface device name.
host required
The hostname of the originating system.

network_transmit_packets_drop_total

gauge
The number of packets dropped during transmits on this interface.
collector required
Which collector this metric comes from.
device required
The network interface device name.
host required
The hostname of the originating system.

network_transmit_packets_total

gauge
The number of packets transmitted on this interface.
collector required
Which collector this metric comes from.
device required
The network interface device name.
host required
The hostname of the originating system.

uptime

gauge
The number of seconds since the last boot.
collector required
Which collector this metric comes from.
host required
The hostname of the originating system.

Telemetry

Metrics

link

component_sent_event_bytes_total

counter
The total number of event bytes emitted by this component.
component_id required
The Vector component ID.
component_kind required
The Vector component kind.
component_name required
Deprecated, use component_id instead. The value is the same as component_id.
component_type required
The Vector component type.
host required
The hostname of the system Vector is running on.
pid required
The process ID of the Vector instance.

component_sent_events_total

counter
The total number of events emitted by this component.
component_id required
The Vector component ID.
component_kind required
The Vector component kind.
component_name required
Deprecated, use component_id instead. The value is the same as component_id.
component_type required
The Vector component type.
host required
The hostname of the system Vector is running on.
pid required
The process ID of the Vector instance.

events_out_total

counter
The total number of events emitted by this component. This metric is deprecated and will be removed in a future version. Use component_sent_events_total instead.
component_id required
The Vector component ID.
component_kind required
The Vector component kind.
component_name required
Deprecated, use component_id instead. The value is the same as component_id.
component_type required
The Vector component type.
host required
The hostname of the system Vector is running on.
pid required
The process ID of the Vector instance.

processed_events_total

counter
The total number of events processed by this component. This metric is deprecated in place of using component_received_events_total and component_sent_events_total metrics.
component_id required
The Vector component ID.
component_kind required
The Vector component kind.
component_name required
Deprecated, use component_id instead. The value is the same as component_id.
component_type required
The Vector component type.
host required
The hostname of the system Vector is running on.
pid required
The process ID of the Vector instance.

How it works

Context

By default, the host_metrics source augments events with helpful context keys.

State

This component is stateless, meaning its behavior is consistent across each input.