Menu

Important: This documentation is about an older version. It's relevant only to the release noted, many of the features and functions have been updated or replaced. Please view the current version.

Open source

prometheus.exporter.unix

The prometheus.exporter.unix component uses node_exporter to expose a wide variety of hardware and OS metrics for *nix-based systems.

The node_exporter itself is comprised of various collectors, which can be enabled and disabled at will. For more information on collectors, refer to the collectors-list section.

You can specify multiple prometheus.exporter.unix components by giving them different labels.

Usage

alloy
prometheus.exporter.unix "LABEL" {
}

Arguments

You can use the following arguments to configure the exporter. All arguments are optional. Omitted fields take their default values.

NameTypeDescriptionDefaultRequired
set_collectorslist(string)Overrides the default set of enabled collectors with the collectors listed.no
enable_collectorslist(string)Collectors to mark as enabled.no
disable_collectorslist(string)Collectors to mark as disabled.no
include_exporter_metricsbooleanWhether metrics about the exporter itself should be reported.falseno
procfs_pathstringThe procfs mount point./procno
sysfs_pathstringThe sysfs mount point./sysno
rootfs_pathstringSpecify a prefix for accessing the host filesystem./no
udev_data_pathstringThe udev data path./run/udev/datano

set_collectors defines a hand-picked list of enabled-by-default collectors. If set, anything not provided in that list is disabled by default. Refer to the Collectors list for the default set of enabled collectors for each supported operating system.

enable_collectors enables more collectors over the default set, or on top of the ones provided in set_collectors.

disable_collectors extends the default set of disabled collectors. If there are conflicts, it takes precedence over enable_collectors.

Blocks

The following blocks are supported inside the definition of prometheus.exporter.unix to configure collector-specific options:

HierarchyNameDescriptionRequired
bcachebcacheConfigures the bcache collector.no
cpucpuConfigures the cpu collector.no
diskdiskConfigures the diskstats collector.no
ethtoolethtoolConfigures the ethtool collector.no
filesystemfilesystemConfigures the filesystem collector.no
hwmonhwmonConfigures the hwmon collector.no
ipvsipvsConfigures the ipvs collector.no
ntpntpConfigures the ntp collector.no
netclassnetclassConfigures the netclass collector.no
netdevnetdevConfigures the netdev collector.no
netstatnetstatConfigures the netstat collector.no
perfperfConfigures the perf collector.no
powersupplypowersupplyConfigures the powersupply collector.no
runitrunitConfigures the runit collector.no
supervisordsupervisordConfigures the supervisord collector.no
sysctlsysctlConfigures the sysctl collector.no
systemdsystemdConfigures the systemd collector.no
tapestatstapestatsConfigures the tapestats collector.no
textfiletextfileConfigures the textfile collector.no
vmstatvmstatConfigures the vmstat collector.no

bcache block

NameTypeDescriptionDefaultRequired
priority_statsbooleanEnable exposing of expensive bcache priority stats.falseno

cpu block

NameTypeDescriptionDefaultRequired
guestbooleanEnable the node_cpu_guest_seconds_total metric.falseno
infobooleanEnable the cpu_info metric for the cpu collector.falseno
bugs_includestringRegexp of bugs field in cpu info to filter.no
flags_includestringRegexp of flags field in cpu info to filter.no

disk block

NameTypeDescriptionDefaultRequired
device_excludestringRegexp of devices to exclude for diskstats."^(ram|loop|fd|(h|s|v|xv)d[a-z]|nvme\\d+n\\d+p)\\d+$"no
device_includestringRegexp of devices to include for diskstats. If set, device_exclude is ignored.no

ethtool block

NameTypeDescriptionDefaultRequired
device_excludestringRegexp of ethtool devices to exclude. Mutually exclusive with device_include.no
device_includestringRegexp of ethtool devices to include. Mutually exclusive with device_exclude.no
metrics_includestringRegexp of ethtool stats to include..*no

filesystem block

The default values vary by the operating system Alloy runs on.

NameTypeDescriptionDefaultRequired
fs_types_excludestringRegexp of filesystem types to ignore for filesystem collector.(see below )no
mount_points_excludestringRegexp of mount points to ignore for filesystem collector.(see below )no
mount_timeoutdurationHow long to wait for a mount to respond before marking it as stale."5s"no

fs_types_exclude defaults to the following regular expression string:

linux
^(autofs|binfmt_misc|bpf|cgroup2?|configfs|debugfs|devpts|devtmpfs|fusectl|hugetlbfs|iso9660|mqueue|nsfs|overlay|proc|procfs|pstore|rpc_pipefs|securityfs|selinuxfs|squashfs|sysfs|tracefs)$
osx
^(autofs|devfs)$
bsd
^devfs$

mount_points_exclude defaults to the following regular expression string:

linux
^/(dev|proc|run/credentials/.+|sys|var/lib/docker/.+)($|/)
osx
^/(dev)($|/)
bsd
^/(dev)($|/)

hwmon block

NameTypeDescriptionDefaultRequired
chip_includestringRegular expression of hwmon chip to include. Mutually exclusive to chip-exclude.no
chip_excludestringRegular expression of hwmon chip to exclude. Mutually exclusive to chip-include.no

ipvs block

NameTypeDescriptionDefaultRequired
backend_labelslist(string)Array of IPVS backend stats labels.[local_address, local_port, remote_address, remote_port, proto, local_mark]no

ntp block

nametypedescriptiondefaultrequired
serverstringNTP server to use for the collector."127.0.0.1"no
server_is_localbooleanCertifies that the server address isn’t a public NTP server.falseno
ip_ttlintTTL to use while sending NTP query.1no
local_offset_tolerancedurationOffset between local clock and local NTPD time to tolerate."1ms"no
max_distancedurationMax accumulated distance to the root."3466080us"no
protocol_versionintNTP protocol version.4no

netclass block

nametypedescriptiondefaultrequired
ignore_invalid_speed_devicebooleanIgnore net devices with invalid speed values.falseno
ignored_devicesstringRegexp of net devices to ignore for netclass collector."^$"no

netdev block

nametypedescriptiondefaultrequired
address_infobooleanEnable collecting address-info for every device.falseno
device_excludestringRegexp of net devices to exclude. Mutually exclusive with device_include.no
device_includestringRegexp of net devices to include. Mutually exclusive with device_exclude.no

netstat block

nametypedescriptiondefaultrequired
fieldsstringRegexp of fields to return for netstat collector.(see below)no

fields defaults to the following regular expression string:

"^(.*_(InErrors|InErrs)|Ip_Forwarding|Ip(6|Ext)_(InOctets|OutOctets)|Icmp6?_(InMsgs|OutMsgs)|TcpExt_(Listen.*|Syncookies.*|TCPSynRetrans|TCPTimeouts)|Tcp_(ActiveOpens|InSegs|OutSegs|OutRsts|PassiveOpens|RetransSegs|CurrEstab)|Udp6?_(InDatagrams|OutDatagrams|NoPorts|RcvbufErrors|SndbufErrors))$"

perf block

nametypedescriptiondefaultrequired
cpusstringList of CPUs from which perf metrics should be collected.no
tracepointlist(string)Array of perf tracepoints that should be collected.no
disable_hardware_profilersbooleanDisable perf hardware profilers.falseno
hardware_profilerslist(string)Perf hardware profilers that should be collected.no
disable_software_profilersbooleanDisable perf software profilers.falseno
software_profilerslist(string)Perf software profilers that should be collected.no
disable_cache_profilersbooleanDisable perf cache profilers.falseno
cache_profilerslist(string)Perf cache profilers that should be collected.no

powersupply block

nametypedescriptiondefaultrequired
ignored_suppliesstringRegexp of power supplies to ignore for the powersupplyclass collector."^$"no

runit block

nametypedescriptiondefaultrequired
service_dirstringPath to runit service directory."/etc/service"no

supervisord block

nametypedescriptiondefaultrequired
urlstringXML RPC endpoint for the supervisord collector."http://localhost:9001/RPC2"no

Setting SUPERVISORD_URL in the environment overrides the default value. An explicit value in the block takes precedence over the environment variable.

sysctl block

nametypedescriptiondefaultrequired
includelist(string)Numeric sysctl values to expose.[]no
include_infolist(string)String sysctl values to expose.[]no

systemd block

nametypedescriptiondefaultrequired
enable_restartsbooleanEnables service unit metric service_restart_totalfalseno
start_timebooleanEnables service unit metric unit_start_time_secondsfalseno
task_metricsbooleanEnables service unit task metrics unit_tasks_current and unit_tasks_max.falseno
unit_excludestringRegexp of systemd units to exclude. Units must both match include and not match exclude to be collected.".+\\.(automount|device|mount|scope|slice)"no
unit_includestringRegexp of systemd units to include. Units must both match include and not match exclude to be collected.".+"no

tapestats block

nametypedescriptiondefaultrequired
ignored_devicesstringRegexp of tapestats devices to ignore."^$"no

textfile block

nametypedescriptiondefaultrequired
directorystringDirectory to read *.prom files from for the textfile collector.no

vmstat block

nametypedescriptiondefaultrequired
fieldsstringRegexp of fields to return for the vmstat collector."^(oom_kill|pgpg|pswp|pg.*fault).*"no

Exported fields

The following fields are exported and can be referenced by other components.

NameTypeDescription
targetslist(map(string))The targets that can be used to collect exporter metrics.

For example, the targets can either be passed to a discovery.relabel component to rewrite the targets’ label sets or to a prometheus.scrape component that collects the exposed metrics.

The exported targets use the configured in-memory traffic address specified by the run command.

Component health

prometheus.exporter.unix is only reported as unhealthy if given an invalid configuration. In those cases, exported fields retain their last healthy values.

Debug information

prometheus.exporter.unix does not expose any component-specific debug information.

Debug metrics

prometheus.exporter.unix does not expose any component-specific debug metrics.

Collectors list

The following table lists the available collectors that node_exporter brings bundled in. Some collectors only work on specific operating systems. Enabling a collector that’s not supported by the host operating system where Alloy is running is a no-op.

Users can choose to enable a subset of collectors to limit the amount of metrics exposed by the prometheus.exporter.unix component, or disable collectors that are expensive to run.

NameDescriptionOSEnabled by default
arpExposes ARP statistics from /proc/net/arp.Linuxyes
bcacheExposes bcache statistics from /sys/fs/bcache.Linuxyes
bondingExposes the number of configured and active slaves of Linux bonding interfaces.Linuxyes
boottimeExposes system boot time derived from the kern.boottime sysctl.Darwin, Dragonfly, FreeBSD, NetBSD, OpenBSD, Oracle Solarisyes
btrfsExposes statistics on btrfs.Linuxyes
buddyinfoExposes statistics of memory fragments as reported by /proc/buddyinfo.Linuxno
conntrackShows conntrack statistics. Does nothing if no /proc/sys/net/netfilter/ is present.Linuxyes
cpuExposes CPU statistics.Darwin, Dragonfly, FreeBSD, Linux, Oracle Solaris, NetBSDyes
cpufreqExposes CPU frequency statistics.Linux, Oracle Solarisyes
devstatExposes device statistics.Dragonfly, FreeBSDno
diskstatsExposes disk I/O statistics.Darwin, Linux, OpenBSDyes
dmiExposes DMI information.Linuxyes
drbdExposes Distributed Replicated Block Device statistics (to version 8.4).Linuxno
drmExposes GPU card info from /sys/class/drm/card?/device.Linuxno
edacExposes error detection and correction statistics.Linuxyes
entropyExposes available entropy.Linuxyes
ethtoolExposes ethtool stats.Linuxno
execExposes execution statistics.Dragonfly, FreeBSDyes
fibrechannelExposes FibreChannel statistics.Linuxyes
filefdExposes file descriptor statistics from /proc/sys/fs/file-nr.Linuxyes
filesystemExposes filesystem statistics, such as disk space used.Darwin, Dragonfly, FreeBSD, Linux, OpenBSDyes
hwmonExposes hardware monitoring and sensor data from /sys/class/hwmon.Linuxyes
infinibandExposes network statistics specific to InfiniBand and Intel OmniPath configurations.Linuxyes
interruptsExposes detailed interrupts statistics.Linux, OpenBSDno
ipvsExposes IPVS status from /proc/net/ip_vs and stats from /proc/net/ip_vs_stats.Linuxyes
ksmdExposes kernel and system statistics from /sys/kernel/mm/ksm.Linuxno
lnstatExposes Linux network cache stats.Linuxno
loadavgExposes load average.Darwin, Dragonfly, FreeBSD, Linux, NetBSD, OpenBSD, Oracle Solarisyes
logindExposes session counts from logind.Linuxno
mdadmExposes statistics about devices in /proc/mdstat. Does nothing if no /proc/mdstat is present.Linuxyes
meminfoExposes memory statistics.Darwin, Dragonfly, FreeBSD, Linux, OpenBSD, NetBSDyes
meminfo_numaExposes memory statistics from /proc/meminfo_numa.Linuxno
mountstatsExposes filesystem statistics from /proc/self/mountstats. Exposes detailed NFS client statistics.Linuxno
netclassExposes network interface info from /sys/class/net.Linuxyes
netdevExposes network interface statistics such as bytes transferred.Darwin, Dragonfly, FreeBSD, Linux, OpenBSDyes
netisrExposes netisr statistics.FreeBSDyes
netstatExposes network statistics from /proc/net/netstat. This is the same information as netstat -s.Linuxyes
network_routeExposes network route statistics.Linuxno
nfsExposes NFS client statistics from /proc/net/rpc/nfs. This is the same information as nfsstat -c.Linuxyes
nfsdExposes NFS kernel server statistics from /proc/net/rpc/nfsd. This is the same information as nfsstat -s.Linuxyes
ntpExposes local NTP daemon health to check time.anyno
nvmeExposes NVMe statistics.Linuxyes
osExposes os-release information.Linuxyes
perfExposes perf based metric. Warning: Metrics are dependent on kernel configuration and settings.Linuxno
powersupplyclassCollects information on power supplies.anyyes
pressureExposes pressure stall statistics from /proc/pressure/.Linux kernel 4.20+ or CONFIG_PSIyes
processesExposes aggregate process statistics from /proc.Linuxno
qdiscExposes queuing discipline statistics.Linuxno
raplExposes various statistics from /sys/class/powercap.Linuxyes
runitExposes service status from runit.anyno
schedstatExposes task scheduler statistics from /proc/schedstat.Linuxyes
sockstatExposes various statistics from /proc/net/sockstat.Linuxyes
softirqsExposes detailed softirq statistics from /proc/softirqs.Linuxno
softnetExposes statistics from /proc/net/softnet_stat.Linuxyes
statExposes various statistics from /proc/stat. This includes boot time, forks and interrupts.Linuxyes
supervisordExposes service status from supervisord.anyno
sysctlExpose sysctl values from /proc/sys.Linuxno
systemdExposes service and system status from systemd.Linuxno
tapestatsExposes tape device stats.Linuxyes
tcpstatExposes TCP connection status information from /proc/net/tcp and /proc/net/tcp6. Warning: The current version has potential performance issues in high load situations.Linuxno
textfileCollects metrics from files in a directory matching the filename pattern *.prom. The files must use text-based exposition formats.anyyes
thermalExposes thermal statistics.Darwinyes
thermal_zoneExposes thermal zone & cooling device statistics from /sys/class/thermal.Linuxyes
timeExposes the current system time.anyyes
timexExposes selected adjtimex(2) system call stats.Linuxyes
udp_queuesExposes UDP total lengths of the rx_queue and tx_queue from /proc/net/udp and /proc/net/udp6.Linuxyes
unameExposes system information as provided by the uname system call.Darwin, FreeBSD, Linux, OpenBSD, NetBSDyes
vmstatExposes statistics from /proc/vmstat.Linuxyes
wifiExposes WiFi device and station statistics.Linuxno
xfsExposes XFS runtime statistics.Linux kernel 4.4+yes
zfsExposes ZFS performance statistics.Linux, Oracle Solarisyes
zoneinfoExposes zone stats.Linuxno

Run on Docker/Kubernetes

When running Alloy in a Docker container, you need to bind mount the filesystem, procfs, and sysfs from the host machine, as well as set the corresponding arguments for the component to work.

You may also need to add capabilities such as SYS_TIME and make sure that Alloy is running with elevated privileges for some of the collectors to work properly.

Example

This example uses a prometheus.scrape component to collect metrics from prometheus.exporter.unix:

alloy
prometheus.exporter.unix "demo" { }

// Configure a prometheus.scrape component to collect unix metrics.
prometheus.scrape "demo" {
  targets    = prometheus.exporter.unix.demo.targets
  forward_to = [prometheus.remote_write.demo.receiver]
}

prometheus.remote_write "demo" {
  endpoint {
    url = PROMETHEUS_REMOTE_WRITE_URL

    basic_auth {
      username = USERNAME
      password = PASSWORD
    }
  }
}

Replace the following:

  • PROMETHEUS_REMOTE_WRITE_URL: The URL of the Prometheus remote_write-compatible server to send metrics to.
  • USERNAME: The username to use for authentication to the remote_write API.
  • PASSWORD: The password to use for authentication to the remote_write API.

Compatible components

prometheus.exporter.unix has exports that can be consumed by the following components:

Note

Connecting some components may not be sensible or components may require further configuration to make the connection work correctly. Refer to the linked documentation for more details.