Showing preview only (2,735K chars total). Download the full file or copy to clipboard to get everything.
Repository: prometheus/node_exporter
Branch: master
Commit: 0f5c15834bcf
Files: 394
Total size: 2.5 MB
Directory structure:
gitextract_59ovhae2/
├── .circleci/
│ └── config.yml
├── .dockerignore
├── .github/
│ ├── ISSUE_TEMPLATE.md
│ ├── dependabot.yml
│ └── workflows/
│ ├── bsd.yml
│ ├── container_description.yml
│ └── golangci-lint.yml
├── .gitignore
├── .golangci.yml
├── .promu-cgo.yml
├── .promu.yml
├── .yamllint
├── CHANGELOG.md
├── CODE_OF_CONDUCT.md
├── CONTRIBUTING.md
├── Dockerfile
├── LICENSE
├── MAINTAINERS.md
├── Makefile
├── Makefile.common
├── NOTICE
├── README.md
├── SECURITY.md
├── VERSION
├── checkmetrics.sh
├── collector/
│ ├── arp_linux.go
│ ├── bcache_linux.go
│ ├── bcachefs_linux.go
│ ├── bonding_linux.go
│ ├── bonding_linux_test.go
│ ├── boot_time_bsd.go
│ ├── boot_time_solaris.go
│ ├── btrfs_linux.go
│ ├── btrfs_linux_test.go
│ ├── buddyinfo.go
│ ├── cgroups_linux.go
│ ├── collector.go
│ ├── conntrack_linux.go
│ ├── cpu_aix.go
│ ├── cpu_common.go
│ ├── cpu_darwin.go
│ ├── cpu_dragonfly.go
│ ├── cpu_dragonfly_test.go
│ ├── cpu_freebsd.go
│ ├── cpu_linux.go
│ ├── cpu_linux_test.go
│ ├── cpu_netbsd.go
│ ├── cpu_netbsd_test.go
│ ├── cpu_openbsd.go
│ ├── cpu_solaris.go
│ ├── cpu_vulnerabilities_linux.go
│ ├── cpufreq_common.go
│ ├── cpufreq_linux.go
│ ├── cpufreq_solaris.go
│ ├── device_filter.go
│ ├── device_filter_test.go
│ ├── devstat_dragonfly.go
│ ├── devstat_freebsd.c
│ ├── devstat_freebsd.go
│ ├── devstat_freebsd.h
│ ├── diskstats_aix.go
│ ├── diskstats_common.go
│ ├── diskstats_darwin.go
│ ├── diskstats_linux.go
│ ├── diskstats_linux_test.go
│ ├── diskstats_openbsd.go
│ ├── diskstats_openbsd_amd64.go
│ ├── dmi.go
│ ├── drbd_linux.go
│ ├── drm_linux.go
│ ├── edac_linux.go
│ ├── entropy_linux.go
│ ├── ethtool_linux.go
│ ├── ethtool_linux_test.go
│ ├── exec_bsd.go
│ ├── fibrechannel_linux.go
│ ├── filefd_linux.go
│ ├── filefd_linux_test.go
│ ├── filesystem_aix.go
│ ├── filesystem_bsd.go
│ ├── filesystem_common.go
│ ├── filesystem_freebsd.go
│ ├── filesystem_linux.go
│ ├── filesystem_linux_test.go
│ ├── filesystem_macos.go
│ ├── filesystem_netbsd.go
│ ├── filesystem_openbsd.go
│ ├── fixtures/
│ │ ├── e2e-64k-page-output.txt
│ │ ├── e2e-output-darwin.txt
│ │ ├── e2e-output-dragonfly.txt
│ │ ├── e2e-output-freebsd.txt
│ │ ├── e2e-output-netbsd.txt
│ │ ├── e2e-output-openbsd.txt
│ │ ├── e2e-output-solaris.txt
│ │ ├── e2e-output.txt
│ │ ├── ethtool/
│ │ │ ├── bond0/
│ │ │ │ └── statistics
│ │ │ └── eth0/
│ │ │ ├── driver
│ │ │ ├── settings
│ │ │ └── statistics
│ │ ├── ip_vs_result.txt
│ │ ├── ip_vs_result_lbs_local_address_local_port.txt
│ │ ├── ip_vs_result_lbs_local_port.txt
│ │ ├── ip_vs_result_lbs_none.txt
│ │ ├── pci.ids
│ │ ├── pcidevice-names-output.txt
│ │ ├── proc/
│ │ │ ├── 1/
│ │ │ │ ├── mountinfo
│ │ │ │ └── stat
│ │ │ ├── 10/
│ │ │ │ ├── mountinfo
│ │ │ │ ├── mountstats
│ │ │ │ └── stat
│ │ │ ├── 11/
│ │ │ │ ├── .missing_stat
│ │ │ │ └── stat
│ │ │ ├── buddyinfo
│ │ │ ├── cgroups
│ │ │ ├── cpuinfo
│ │ │ ├── diskstats
│ │ │ ├── drbd
│ │ │ ├── interrupts
│ │ │ ├── interrupts_aarch64
│ │ │ ├── loadavg
│ │ │ ├── mdstat
│ │ │ ├── meminfo
│ │ │ ├── net/
│ │ │ │ ├── arp
│ │ │ │ ├── ip_vs
│ │ │ │ ├── ip_vs_stats
│ │ │ │ ├── netstat
│ │ │ │ ├── rpc/
│ │ │ │ │ ├── nfs
│ │ │ │ │ └── nfsd
│ │ │ │ ├── snmp
│ │ │ │ ├── snmp6
│ │ │ │ ├── sockstat
│ │ │ │ ├── sockstat6
│ │ │ │ ├── softnet_stat
│ │ │ │ ├── stat/
│ │ │ │ │ ├── arp_cache
│ │ │ │ │ ├── ndisc_cache
│ │ │ │ │ └── nf_conntrack
│ │ │ │ ├── udp
│ │ │ │ └── xfrm_stat
│ │ │ ├── pressure/
│ │ │ │ ├── cpu
│ │ │ │ ├── io
│ │ │ │ ├── irq
│ │ │ │ └── memory
│ │ │ ├── schedstat
│ │ │ ├── slabinfo
│ │ │ ├── softirqs
│ │ │ ├── spl/
│ │ │ │ └── kstat/
│ │ │ │ └── zfs/
│ │ │ │ ├── abdstats
│ │ │ │ ├── arcstats
│ │ │ │ ├── dbufstats
│ │ │ │ ├── dmu_tx
│ │ │ │ ├── dnodestats
│ │ │ │ ├── fm
│ │ │ │ ├── pool1/
│ │ │ │ │ ├── io
│ │ │ │ │ ├── objset-1
│ │ │ │ │ ├── objset-2
│ │ │ │ │ └── state
│ │ │ │ ├── pool2/
│ │ │ │ │ └── state
│ │ │ │ ├── pool3/
│ │ │ │ │ ├── io
│ │ │ │ │ ├── objset-1
│ │ │ │ │ ├── objset-2
│ │ │ │ │ └── state
│ │ │ │ ├── poolz1/
│ │ │ │ │ ├── io
│ │ │ │ │ ├── objset-1
│ │ │ │ │ ├── objset-2
│ │ │ │ │ └── state
│ │ │ │ ├── vdev_cache_stats
│ │ │ │ ├── vdev_mirror_stats
│ │ │ │ ├── xuio_stats
│ │ │ │ ├── zfetchstats
│ │ │ │ └── zil
│ │ │ ├── stat
│ │ │ ├── swaps
│ │ │ ├── sys/
│ │ │ │ ├── fs/
│ │ │ │ │ └── file-nr
│ │ │ │ ├── kernel/
│ │ │ │ │ ├── pid_max
│ │ │ │ │ ├── random/
│ │ │ │ │ │ ├── entropy_avail
│ │ │ │ │ │ └── poolsize
│ │ │ │ │ ├── seccomp/
│ │ │ │ │ │ └── actions_avail
│ │ │ │ │ └── threads-max
│ │ │ │ ├── net/
│ │ │ │ │ └── netfilter/
│ │ │ │ │ ├── nf_conntrack_count
│ │ │ │ │ └── nf_conntrack_max
│ │ │ │ ├── pid_max
│ │ │ │ └── threads-max
│ │ │ ├── vmstat
│ │ │ └── zoneinfo
│ │ ├── qdisc/
│ │ │ └── results.json
│ │ ├── sys.ttar
│ │ ├── textfile/
│ │ │ ├── client_side_timestamp/
│ │ │ │ └── metrics.prom
│ │ │ ├── client_side_timestamp.out
│ │ │ ├── different_metric_types/
│ │ │ │ └── metrics.prom
│ │ │ ├── different_metric_types.out
│ │ │ ├── glob_extra_dimension.out
│ │ │ ├── histogram/
│ │ │ │ └── metrics.prom
│ │ │ ├── histogram.out
│ │ │ ├── histogram_extra_dimension/
│ │ │ │ └── metrics.prom
│ │ │ ├── histogram_extra_dimension.out
│ │ │ ├── inconsistent_metrics/
│ │ │ │ └── metrics.prom
│ │ │ ├── inconsistent_metrics.out
│ │ │ ├── metrics_merge_different_help/
│ │ │ │ ├── a.prom
│ │ │ │ └── b.prom
│ │ │ ├── metrics_merge_different_help.out
│ │ │ ├── metrics_merge_empty_help/
│ │ │ │ ├── a.prom
│ │ │ │ └── b.prom
│ │ │ ├── metrics_merge_empty_help.out
│ │ │ ├── metrics_merge_no_help/
│ │ │ │ ├── a.prom
│ │ │ │ └── b.prom
│ │ │ ├── metrics_merge_no_help.out
│ │ │ ├── metrics_merge_same_help/
│ │ │ │ ├── a.prom
│ │ │ │ └── b.prom
│ │ │ ├── metrics_merge_same_help.out
│ │ │ ├── no_metric_files/
│ │ │ │ └── non_matching_file.txt
│ │ │ ├── no_metric_files.out
│ │ │ ├── nonexistent_path.out
│ │ │ ├── summary/
│ │ │ │ └── metrics.prom
│ │ │ ├── summary.out
│ │ │ ├── summary_extra_dimension/
│ │ │ │ └── metrics.prom
│ │ │ ├── summary_extra_dimension.out
│ │ │ ├── two_metric_files/
│ │ │ │ ├── metrics1.prom
│ │ │ │ ├── metrics2.prom
│ │ │ │ └── non_matching_file.txt
│ │ │ └── two_metric_files.out
│ │ ├── udev.ttar
│ │ ├── usr/
│ │ │ └── lib/
│ │ │ └── os-release
│ │ └── wifi/
│ │ ├── interfaces.json
│ │ └── wlan0/
│ │ ├── bss.json
│ │ └── stationinfo.json
│ ├── fixtures_bindmount/
│ │ └── proc/
│ │ └── 1/
│ │ └── mountinfo
│ ├── fixtures_hidepid/
│ │ └── proc/
│ │ └── self/
│ │ └── mountinfo
│ ├── helper.go
│ ├── helper_test.go
│ ├── hwmon_linux.go
│ ├── infiniband_linux.go
│ ├── interrupts_common.go
│ ├── interrupts_linux.go
│ ├── interrupts_linux_test.go
│ ├── interrupts_openbsd.go
│ ├── interrupts_openbsd_amd64.go
│ ├── ipvs_linux.go
│ ├── ipvs_linux_test.go
│ ├── kernel_hung_linux.go
│ ├── ksmd_linux.go
│ ├── kvm_bsd.c
│ ├── kvm_bsd.go
│ ├── kvm_bsd.h
│ ├── lnstat_linux.go
│ ├── loadavg.go
│ ├── loadavg_aix.go
│ ├── loadavg_bsd.go
│ ├── loadavg_linux.go
│ ├── loadavg_linux_test.go
│ ├── loadavg_solaris.go
│ ├── logind_linux.go
│ ├── logind_linux_test.go
│ ├── mdadm_linux.go
│ ├── mdadm_linux_test.go
│ ├── meminfo.go
│ ├── meminfo_aix.go
│ ├── meminfo_darwin.go
│ ├── meminfo_linux.go
│ ├── meminfo_linux_test.go
│ ├── meminfo_netbsd.go
│ ├── meminfo_numa_linux.go
│ ├── meminfo_numa_linux_test.go
│ ├── meminfo_openbsd.go
│ ├── meminfo_openbsd_amd64.go
│ ├── memory_bsd.go
│ ├── mountstats_linux.go
│ ├── netclass_linux.go
│ ├── netclass_rtnl_linux.go
│ ├── netdev_aix.go
│ ├── netdev_bsd.go
│ ├── netdev_common.go
│ ├── netdev_darwin.go
│ ├── netdev_linux.go
│ ├── netdev_linux_test.go
│ ├── netdev_openbsd.go
│ ├── netdev_openbsd_amd64.go
│ ├── netinterface_aix.go
│ ├── netisr_freebsd.go
│ ├── netstat_freebsd.go
│ ├── netstat_freebsd_test.go
│ ├── netstat_linux.go
│ ├── netstat_linux_test.go
│ ├── network_route_linux.go
│ ├── nfs_linux.go
│ ├── nfsd_linux.go
│ ├── ntp.go
│ ├── nvme_linux.go
│ ├── os_release.go
│ ├── os_release_test.go
│ ├── partition_aix.go
│ ├── paths.go
│ ├── paths_test.go
│ ├── pcidevice_linux.go
│ ├── pcidevice_linux_test.go
│ ├── perf_linux.go
│ ├── perf_linux_test.go
│ ├── powersupplyclass.go
│ ├── powersupplyclass_darwin.go
│ ├── powersupplyclass_linux.go
│ ├── pressure_linux.go
│ ├── processes_linux.go
│ ├── processes_linux_test.go
│ ├── qdisc_linux.go
│ ├── rapl_linux.go
│ ├── runit.go
│ ├── schedstat_linux.go
│ ├── selinux_linux.go
│ ├── slabinfo_linux.go
│ ├── sockstat_linux.go
│ ├── softirqs_common.go
│ ├── softirqs_linux.go
│ ├── softnet_linux.go
│ ├── stat_linux.go
│ ├── supervisord.go
│ ├── swap_linux.go
│ ├── swap_linux_test.go
│ ├── sysctl_bsd.go
│ ├── sysctl_linux.go
│ ├── sysctl_openbsd_amd64.go
│ ├── systemd_linux.go
│ ├── systemd_linux_test.go
│ ├── tapestats_linux.go
│ ├── tcpstat_linux.go
│ ├── tcpstat_linux_test.go
│ ├── textfile.go
│ ├── textfile_test.go
│ ├── thermal_darwin.go
│ ├── thermal_darwin_amd64.go
│ ├── thermal_darwin_arm64.go
│ ├── thermal_zone_linux.go
│ ├── time.go
│ ├── time_linux.go
│ ├── time_other.go
│ ├── timex.go
│ ├── udp_queues_linux.go
│ ├── uname.go
│ ├── uname_bsd.go
│ ├── uname_linux.go
│ ├── utils/
│ │ ├── utils.go
│ │ └── utils_test.go
│ ├── vmstat_linux.go
│ ├── watchdog.go
│ ├── watchdog_test.go
│ ├── wifi_linux.go
│ ├── xfrm.go
│ ├── xfrm_test.go
│ ├── xfs_linux.go
│ ├── zfs_common.go
│ ├── zfs_freebsd.go
│ ├── zfs_linux.go
│ ├── zfs_linux_test.go
│ ├── zfs_solaris.go
│ └── zoneinfo_linux.go
├── docs/
│ ├── TIME.md
│ ├── V0_16_UPGRADE_GUIDE.md
│ ├── example-16-compatibility-rules-new-to-old.yml
│ ├── example-16-compatibility-rules.yml
│ ├── example-17-compatibility-rules-new-to-old.yml
│ ├── example-17-compatibility-rules.yml
│ └── node-mixin/
│ ├── .gitignore
│ ├── Makefile
│ ├── README.md
│ ├── alerts/
│ │ └── alerts.libsonnet
│ ├── alerts.jsonnet
│ ├── config.libsonnet
│ ├── dashboards/
│ │ ├── dashboards.libsonnet
│ │ ├── node.libsonnet
│ │ └── use.libsonnet
│ ├── dashboards.jsonnet
│ ├── jsonnetfile.json
│ ├── lib/
│ │ └── prom-mixin.libsonnet
│ ├── mixin.libsonnet
│ ├── rules/
│ │ └── rules.libsonnet
│ └── rules.jsonnet
├── end-to-end-test.sh
├── example-rules.yml
├── examples/
│ ├── init.d/
│ │ └── node_exporter
│ ├── launchctl/
│ │ ├── README.md
│ │ └── io.prometheus.node_exporter.plist
│ ├── openbsd-rc.d/
│ │ └── node_exporter
│ ├── openwrt-init.d/
│ │ └── node_exporter
│ └── systemd/
│ ├── README.md
│ ├── node_exporter.service
│ ├── node_exporter.socket
│ └── sysconfig.node_exporter
├── go.mod
├── go.sum
├── node_exporter.go
├── node_exporter_test.go
├── staticcheck.conf
├── test_image.sh
├── text_collector_examples/
│ └── README.md
├── tls_config_noAuth.bad.yml
├── tools/
│ └── main.go
└── ttar
================================================
FILE CONTENTS
================================================
================================================
FILE: .circleci/config.yml
================================================
---
version: 2.1
orbs:
prometheus: prometheus/prometheus@0.17.1
executors:
# Whenever the Go version is updated here, .promu.yml and .promu-cgo.yml
# should also be updated.
golang:
docker:
- image: cimg/go:1.26
arm:
docker:
- image: cimg/go:1.26
resource_class: arm.medium
jobs:
test:
executor: golang
steps:
- prometheus/setup_environment
- run: go mod download
- run: make
- prometheus/store_artifact:
file: node_exporter
test-arm:
executor: arm
steps:
- prometheus/setup_environment
- run: uname -a
- run: make test-e2e
test_mixins:
executor: golang
steps:
- checkout
- run: go install github.com/google/go-jsonnet/cmd/jsonnet@latest
- run: go install github.com/google/go-jsonnet/cmd/jsonnetfmt@latest
- run: go install github.com/jsonnet-bundler/jsonnet-bundler/cmd/jb@latest
- run: make promtool
- run: make -C docs/node-mixin clean
- run: make -C docs/node-mixin jb_install
- run: make -C docs/node-mixin
- run: git diff --exit-code
build:
machine:
image: ubuntu-2404:current
parallelism: 3
steps:
- prometheus/setup_environment
- run: docker run --privileged linuxkit/binfmt:af88a591f9cc896a52ce596b9cf7ca26a061ef97
- run: promu crossbuild -v --parallelism $CIRCLE_NODE_TOTAL --parallelism-thread $CIRCLE_NODE_INDEX
- run: promu --config .promu-cgo.yml crossbuild -v --parallelism $CIRCLE_NODE_TOTAL --parallelism-thread $CIRCLE_NODE_INDEX
# sign the darwin build so it doesn't get SIGKILLed on start, see: https://github.com/prometheus/node_exporter/issues/2539
- run:
command: |
if [[ -f "$(pwd)/.build/darwin-arm64/node_exporter" ]]; then
promu codesign "$(pwd)/.build/darwin-arm64/node_exporter"
fi
if [[ -f "$(pwd)/.build/darwin-amd64/node_exporter" ]]; then
promu codesign "$(pwd)/.build/darwin-amd64/node_exporter"
fi
- persist_to_workspace:
root: .
paths:
- .build
- store_artifacts:
path: .build
destination: /build
test_docker:
machine:
image: ubuntu-2404:current
environment:
DOCKER_TEST_IMAGE_NAME: quay.io/prometheus/golang-builder:1.26-base
REPO_PATH: github.com/prometheus/node_exporter
steps:
- prometheus/setup_environment
- attach_workspace:
at: .
- run:
command: |
if [ -n "$CIRCLE_TAG" ]; then
make docker DOCKER_IMAGE_TAG=$CIRCLE_TAG
else
make docker
fi
- run: docker images
- run: docker run --rm -t -v "$(pwd):/app" "${DOCKER_TEST_IMAGE_NAME}" -i "${REPO_PATH}" -T
- run:
command: |
if [ -n "$CIRCLE_TAG" ]; then
make test-docker DOCKER_IMAGE_TAG=$CIRCLE_TAG
else
make test-docker
fi
workflows:
version: 2
node_exporter:
jobs:
- test:
filters:
tags:
only: /.*/
- test-arm:
filters:
tags:
only: /.*/
- build:
filters:
tags:
only: /.*/
- test_docker:
requires:
- test
- build
filters:
tags:
only: /.*/
- test_mixins:
filters:
tags:
only: /.*/
- prometheus/publish_master:
context: org-context
requires:
- test
- build
filters:
branches:
only: master
- prometheus/publish_release:
context: org-context
requires:
- test
- build
filters:
tags:
only: /^v.*/
branches:
ignore: /.*/
================================================
FILE: .dockerignore
================================================
.build/
.tarballs/
!.build/linux-amd64
!.build/linux-armv7
!.build/linux-arm64
!.build/linux-ppc64le
!.build/linux-s390x
================================================
FILE: .github/ISSUE_TEMPLATE.md
================================================
<!--
Please note: GitHub issues should only be used for feature requests and
bug reports. For general discussions, please refer to one of the community channels
described in https://prometheus.io/community/.
Before filing a bug report, note that running node_exporter in Docker is
not recommended, for the reasons detailed in the README:
https://github.com/prometheus/node_exporter#docker
Finally, also note that node_exporter is focused on *NIX kernels, and the
WMI exporter should be used instead on Windows.
For bug reports, please fill out the below fields and provide as much detail
as possible about your issue. For feature requests, you may omit the
following template.
-->
### Host operating system: output of `uname -a`
### node_exporter version: output of `node_exporter --version`
<!-- If building from source, run `make` first. -->
### node_exporter command line flags
<!-- Please list all of the command line flags -->
### node_exporter log output
### Are you running node_exporter in Docker?
<!-- Please note the warning above. -->
### What did you do that produced an error?
### What did you expect to see?
### What did you see instead?
================================================
FILE: .github/dependabot.yml
================================================
version: 2
updates:
- package-ecosystem: "gomod"
directory: "/"
schedule:
interval: "monthly"
- package-ecosystem: "github-actions"
directory: "/"
schedule:
interval: "monthly"
================================================
FILE: .github/workflows/bsd.yml
================================================
name: bsd
on:
push:
branches:
- master
pull_request:
branches:
- master
permissions:
contents: read
env:
GNU_TAR_VERSION: "1.35"
GO_VERSION: "1.26.0"
# To spin up one of the VMs below, see the "Debug Shell" section here: https://github.com/vmactions
jobs:
test_freebsd:
name: Run end-to-end tests on FreeBSD
runs-on: ubuntu-latest
steps:
- name: Checkout the repository
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
- name: test-e2e
uses: vmactions/freebsd-vm@c9f815bc7aa0d34c9fdd0619b034a32d6ca7b57e # v1.4.2
with:
release: "15.0"
copyback: false
envs: 'GO_VERSION GNU_TAR_VERSION'
usesh: true
prepare: |
pkg update -f
pkg install -y \
bash \
git \
gmake \
gnugrep \
gsed \
gtar \
python \
wget
run: |
echo "::group::Setup prerequisites"
set -eu
mkdir bin
GOARCH=$(uname -m)
if [ "${GOARCH}" = "x86_64" ] ; then GOARCH="amd64" ; fi
GOGZ="go${GO_VERSION}.freebsd-${GOARCH}.tar.gz"
wget https://go.dev/dl/${GOGZ}
gtar xzf ${GOGZ}
ln -s $(pwd)/go/bin/go $(pwd)/bin/go
ln -s $(which ggrep) $(pwd)/bin/grep
ln -s $(which gmake) $(pwd)/bin/make
ln -s $(which gsed) $(pwd)/bin/sed
ln -s $(which gtar) $(pwd)/bin/tar
export PATH=$(pwd)/bin:$PATH
echo "::endgroup::"
echo "::group::Print environment information"
uname -a
echo "GOOS: $(go env GOOS)"
echo "GOARCH: $(go env GOARCH)"
echo "::endgroup::"
echo "::group::Run End-to-End Tests"
git config --global --add safe.directory $(pwd)
gmake test-e2e
echo "::endgroup::"
test_openbsd:
name: Run end-to-end tests on OpenBSD
runs-on: ubuntu-latest
steps:
- name: Checkout the repository
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
- name: test-e2e
uses: vmactions/openbsd-vm@7fd5a3e251db9d8bdff2f34aae11a43b6be5ad60 # v1.2.4
with:
copyback: false
envs: 'GO_VERSION GNU_TAR_VERSION'
usesh: true
prepare: |
pkg_add -u
pkg_add \
bash \
ggrep \
git \
gmake \
gsed \
gtar-${GNU_TAR_VERSION}p1-static \
python \
wget
run: |
echo "::group::Setup prerequisites"
set -eu
mkdir bin
GOARCH=$(uname -m)
if [ "${GOARCH}" = "x86_64" ] ; then GOARCH="amd64" ; fi
GOGZ="go${GO_VERSION}.openbsd-${GOARCH}.tar.gz"
wget https://go.dev/dl/${GOGZ}
gtar xzf ${GOGZ}
ln -s $(pwd)/go/bin/go $(pwd)/bin/go
ln -s $(which ggrep) $(pwd)/bin/grep
ln -s $(which gmake) $(pwd)/bin/make
ln -s $(which gsed) $(pwd)/bin/sed
ln -s $(which gtar) $(pwd)/bin/tar
export PATH=$(pwd)/bin:$PATH
echo "::endgroup::"
echo "::group::Print environment information"
uname -a
echo "GOOS: $(go env GOOS)"
echo "GOARCH: $(go env GOARCH)"
echo "::endgroup::"
echo "::group::Run End-to-End Tests"
git config --global --add safe.directory $(pwd)
make test-e2e
echo "::endgroup::"
test_netbsd:
name: Run end-to-end tests on NetBSD
runs-on: ubuntu-latest
steps:
- name: Checkout the repository
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
- name: test-e2e
uses: vmactions/netbsd-vm@e04aec09540429f9cebb0e7941f7cd0c0fc3b44f # v1.3.6
with:
copyback: false
envs: 'GO_VERSION GNU_TAR_VERSION'
usesh: true
prepare: |
/usr/sbin/pkg_add -u \
git \
gmake \
grep \
gsed \
gtar-base-${GNU_TAR_VERSION}\
python312 \
wget
run: |
echo "::group::Setup prerequisites"
set -eu
mkdir bin
GOARCH=$(uname -m)
if [ "${GOARCH}" = "x86_64" ] ; then GOARCH="amd64" ; fi
GOGZ="go${GO_VERSION}.netbsd-${GOARCH}.tar.gz"
wget https://go.dev/dl/${GOGZ}
gtar xzf ${GOGZ}
ln -s $(pwd)/go/bin/go $(pwd)/bin/go
ln -s $(which ggrep) $(pwd)/bin/grep
ln -s $(which gmake) $(pwd)/bin/make
ln -s $(which gsed) $(pwd)/bin/sed
ln -s $(which gtar) $(pwd)/bin/tar
export PATH=$(pwd)/bin:$PATH
echo "::endgroup::"
echo "::group::Print environment information"
uname -a
echo "GOOS: $(go env GOOS)"
echo "GOARCH: $(go env GOARCH)"
echo "::endgroup::"
echo "::group::Run End-to-End Tests"
git config --global --add safe.directory $(pwd)
make test-e2e
echo "::endgroup::"
test_dragonfly:
name: Run end-to-end tests on DragonFly
runs-on: ubuntu-latest
steps:
- name: Checkout the repository
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
- name: test-e2e
uses: vmactions/dragonflybsd-vm@04601322b25fa8eb14f0394e46e1103084ea0199 # v1.2.6
with:
copyback: false
envs: 'GO_VERSION'
usesh: true
prepare: |
pkg update && pkg upgrade -y
pkg install -y \
bash \
git \
gmake \
gnugrep \
gsed \
gtar \
python3 \
wget
run: |
echo "::group::Setup prerequisites"
set -eu
mkdir bin
GOARCH=$(uname -m)
if [ "${GOARCH}" = "x86_64" ] ; then GOARCH="amd64" ; fi
GOGZ="go${GO_VERSION}.dragonfly-${GOARCH}.tar.gz"
wget https://go.dev/dl/${GOGZ}
gtar xzf ${GOGZ}
ln -s $(pwd)/go/bin/go $(pwd)/bin/go
ln -s $(which ggrep) $(pwd)/bin/grep
ln -s $(which gmake) $(pwd)/bin/make
ln -s $(which gsed) $(pwd)/bin/sed
ln -s $(which gtar) $(pwd)/bin/tar
ln -s $(which python3) $(pwd)/bin/python
export PATH=$(pwd)/bin:$PATH
echo "::endgroup::"
echo "::group::Print environment information"
uname -a
echo "GOOS: $(go env GOOS)"
echo "GOARCH: $(go env GOARCH)"
echo "::endgroup::"
echo "::group::Run End-to-End Tests"
git config --global --add safe.directory $(pwd)
gmake test-e2e
echo "::endgroup::"
test_solaris:
name: Run end-to-end tests on Solaris
runs-on: ubuntu-latest
steps:
- name: Checkout the repository
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
- name: test-e2e
uses: vmactions/solaris-vm@69d382b4a775b25ea5955e6c1730e9d05047ca0d # v1.3.1
with:
copyback: false
envs: 'GO_VERSION'
usesh: true
prepare: |
pkg install \
bash \
curl \
gcc \
git \
gnu-grep \
gnu-make \
gnu-sed \
gnu-tar
run: |
echo "::group::Setup prerequisites"
set -eu
mkdir bin
GOARCH=$(uname -m)
if [ "${GOARCH}" = "i86pc" ] ; then GOARCH="amd64" ; fi
GOGZ="go${GO_VERSION}.solaris-${GOARCH}.tar.gz"
wget https://go.dev/dl/${GOGZ}
gtar xzf ${GOGZ}
ln -s $(pwd)/go/bin/go $(pwd)/bin/go
ln -s $(which ggrep) $(pwd)/bin/grep
ln -s $(which gmake) $(pwd)/bin/make
ln -s $(which gsed) $(pwd)/bin/sed
ln -s $(which gtar) $(pwd)/bin/tar
export PATH=$(pwd)/bin:$PATH
echo ">> building promu as it is not shipped for Solaris"
git clone https://github.com/prometheus/promu.git
cd promu
go build .
cd -
mkdir -p $(go env GOPATH)/bin
ln -s $(pwd)/promu/promu $(go env GOPATH)/bin/promu
export PATH=$(go env GOPATH)/bin:$PATH
echo "::endgroup::"
echo "::group::Print environment information"
uname -a
echo "GOOS: $(go env GOOS)"
echo "GOARCH: $(go env GOARCH)"
echo "::endgroup::"
echo "::group::Run End-to-End Tests"
git config --global --add safe.directory $(pwd)
make test-e2e
echo "::endgroup::"
test_macos:
name: Run end-to-end tests on Darwin/MacOS
runs-on: macos-latest
steps:
- name: Checkout the repository
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
- name: Install dependencies
run: |
brew install \
bash \
curl \
git \
grep \
make \
gnu-sed \
gnu-tar \
python3
- name: test-e2e
run: |
echo "::group::Setup prerequisites"
set -eu
mkdir bin
GOARCH=$(uname -m)
if [ "${GOARCH}" = "x86_64" ] ; then GOARCH="amd64" ; fi
GOGZ="go${GO_VERSION}.darwin-${GOARCH}.tar.gz"
wget https://go.dev/dl/${GOGZ}
gtar xzf ${GOGZ}
ln -s $(pwd)/go/bin/go $(pwd)/bin/go
ln -s $(which ggrep) $(pwd)/bin/grep
ln -s $(which gmake) $(pwd)/bin/make
ln -s $(which gsed) $(pwd)/bin/sed
ln -s $(which gtar) $(pwd)/bin/tar
export PATH=$(pwd)/bin:$PATH
echo "::endgroup::"
echo "::group::Print environment information"
uname -a
echo "GOOS: $(go env GOOS)"
echo "GOARCH: $(go env GOARCH)"
echo "::endgroup::"
echo "::group::Run End-to-End Tests"
git config --global --add safe.directory $(pwd)
make test-e2e E2E_EXTRA_FLAGS='--collector.diskstats.device-include=disk[04]'
echo "::endgroup::"
================================================
FILE: .github/workflows/container_description.yml
================================================
---
name: Push README to Docker Hub
on:
push:
paths:
- "README.md"
- "README-containers.md"
- ".github/workflows/container_description.yml"
branches: [ main, master ]
permissions:
contents: read
jobs:
PushDockerHubReadme:
runs-on: ubuntu-latest
name: Push README to Docker Hub
if: github.repository_owner == 'prometheus' || github.repository_owner == 'prometheus-community' # Don't run this workflow on forks.
steps:
- name: git checkout
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
persist-credentials: false
- name: Set docker hub repo name
run: echo "DOCKER_REPO_NAME=$(make docker-repo-name)" >> $GITHUB_ENV
- name: Push README to Dockerhub
uses: christian-korneck/update-container-description-action@d36005551adeaba9698d8d67a296bd16fa91f8e8 # v1
env:
DOCKER_USER: ${{ secrets.DOCKER_HUB_LOGIN }}
DOCKER_PASS: ${{ secrets.DOCKER_HUB_PASSWORD }}
with:
destination_container_repo: ${{ env.DOCKER_REPO_NAME }}
provider: dockerhub
short_description: ${{ env.DOCKER_REPO_NAME }}
# Empty string results in README-containers.md being pushed if it
# exists. Otherwise, README.md is pushed.
readme_file: ''
PushQuayIoReadme:
runs-on: ubuntu-latest
name: Push README to quay.io
if: github.repository_owner == 'prometheus' || github.repository_owner == 'prometheus-community' # Don't run this workflow on forks.
steps:
- name: git checkout
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
persist-credentials: false
- name: Set quay.io org name
run: echo "DOCKER_REPO=$(echo quay.io/${GITHUB_REPOSITORY_OWNER} | tr -d '-')" >> $GITHUB_ENV
- name: Set quay.io repo name
run: echo "DOCKER_REPO_NAME=$(make docker-repo-name)" >> $GITHUB_ENV
- name: Push README to quay.io
uses: christian-korneck/update-container-description-action@d36005551adeaba9698d8d67a296bd16fa91f8e8 # v1
env:
DOCKER_APIKEY: ${{ secrets.QUAY_IO_API_TOKEN }}
with:
destination_container_repo: ${{ env.DOCKER_REPO_NAME }}
provider: quay
# Empty string results in README-containers.md being pushed if it
# exists. Otherwise, README.md is pushed.
readme_file: ''
================================================
FILE: .github/workflows/golangci-lint.yml
================================================
---
# This action is synced from https://github.com/prometheus/prometheus
name: golangci-lint
on:
push:
branches: [main, master, 'release-*']
paths:
- "go.sum"
- "go.mod"
- "**.go"
- "scripts/errcheck_excludes.txt"
- ".github/workflows/golangci-lint.yml"
- ".golangci.yml"
tags: ['v*']
pull_request:
permissions: # added using https://github.com/step-security/secure-repo
contents: read
jobs:
golangci:
permissions:
contents: read # for actions/checkout to fetch code
pull-requests: read # for golangci/golangci-lint-action to fetch pull requests
name: lint
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
persist-credentials: false
- name: Install Go
uses: actions/setup-go@7a3fe6cf4cb3a834922a1244abfce67bcef6a0c5 # v6.2.0
with:
go-version: 1.26.x
- name: Install snmp_exporter/generator dependencies
run: sudo apt-get update && sudo apt-get -y install libsnmp-dev
if: github.repository == 'prometheus/snmp_exporter'
- name: Get golangci-lint version
id: golangci-lint-version
run: echo "version=$(make print-golangci-lint-version)" >> $GITHUB_OUTPUT
- name: Lint
uses: golangci/golangci-lint-action@1e7e51e771db61008b38414a730f564565cf7c20 # v9.2.0
with:
args: --verbose
version: ${{ steps.golangci-lint-version.outputs.version }}
================================================
FILE: .gitignore
================================================
# Compiled Object files, Static and Dynamic libs (Shared Objects)
*.o
*.a
*.so
# Folders
_obj
_test
# Architecture specific extensions/prefixes
*.[568vq]
[568vq].out
*.cgo1.go
*.cgo2.c
_cgo_defun.c
_cgo_gotypes.go
_cgo_export.*
_testmain.go
*.exe
dependencies-stamp
/node_exporter
/.build
/.deps
/.release
/.tarballs
tools/tools
# Intellij
/.idea
*.iml
# Test files extracted from ttar
collector/fixtures/sys/
collector/fixtures/udev/
/vendor
================================================
FILE: .golangci.yml
================================================
version: "2"
linters:
enable:
- depguard
- misspell
- revive
settings:
depguard:
rules:
no_exec_policy:
files:
- '!$test'
deny:
- pkg: os/exec
desc: Using os/exec to run sub processes it not allowed by policy
errcheck:
# Used in HTTP handlers, any error is handled by the server itself.
exclude-functions:
- (net/http.ResponseWriter).Write
revive:
rules:
- name: unused-parameter
severity: warning
disabled: true
exclusions:
generated: lax
presets:
- comments
- common-false-positives
- legacy
- std-error-handling
rules:
- linters:
- errcheck
path: _test.go
formatters:
enable:
- goimports
exclusions:
generated: lax
settings:
goimports:
local-prefixes:
- github.com/prometheus/node_exporter
================================================
FILE: .promu-cgo.yml
================================================
go:
# Whenever the Go version is updated here, .circle/config.yml and
# .promu.yml should also be updated.
version: 1.25
cgo: true
repository:
path: github.com/prometheus/node_exporter
build:
binaries:
- name: node_exporter
ldflags: |
-X github.com/prometheus/common/version.Version={{.Version}}
-X github.com/prometheus/common/version.Revision={{.Revision}}
-X github.com/prometheus/common/version.Branch={{.Branch}}
-X github.com/prometheus/common/version.BuildUser={{user}}@{{host}}
-X github.com/prometheus/common/version.BuildDate={{date "20060102-15:04:05"}}
tarball:
files:
- LICENSE
- NOTICE
crossbuild:
platforms:
- darwin/amd64
- darwin/arm64
- netbsd/amd64
- netbsd/386
================================================
FILE: .promu.yml
================================================
go:
# Whenever the Go version is updated here, .circle/config.yml and
# .promu-cgo.yml should also be updated.
version: 1.26
repository:
path: github.com/prometheus/node_exporter
build:
binaries:
- name: node_exporter
ldflags: |
-X github.com/prometheus/common/version.Version={{.Version}}
-X github.com/prometheus/common/version.Revision={{.Revision}}
-X github.com/prometheus/common/version.Branch={{.Branch}}
-X github.com/prometheus/common/version.BuildUser={{user}}@{{host}}
-X github.com/prometheus/common/version.BuildDate={{date "20060102-15:04:05"}}
tarball:
files:
- LICENSE
- NOTICE
crossbuild:
platforms:
- linux
- openbsd/amd64
================================================
FILE: .yamllint
================================================
---
extends: default
ignore: |
**/node_modules
web/api/v1/testdata/openapi_*_golden.yaml
rules:
braces:
max-spaces-inside: 1
level: error
brackets:
max-spaces-inside: 1
level: error
commas: disable
comments: disable
comments-indentation: disable
document-start: disable
indentation:
spaces: consistent
indent-sequences: consistent
key-duplicates:
ignore: |
config/testdata/section_key_dup.bad.yml
line-length: disable
truthy:
check-keys: false
================================================
FILE: CHANGELOG.md
================================================
## master / unreleased
* [CHANGE]
* [FEATURE]
* [ENHANCEMENT]
* [BUGFIX]
## 1.10.2 / 2025-10-25
* [BUGFIX] meminfo: Fix typo in Zswap metric name #3455
## 1.10.1 / 2025-10-25
* [BUGFIX] filesystem: Fix mount points being collected multiple times #3376
* [BUGFIX] filesystem: Refactor mountinfo parsing #3452
* [BUGFIX] meminfo: Add Zswap/Zswapped metrics #3453
## 1.10.0 / 2025-10-24
* [CHANGE] mdadm: Use sysfs for RAID metrics #3031
* [CHANGE] filesystem: Add erofs in default excluded fs #3313
* [CHANGE] tcpstat: Use std lib binary.NativeEndian #3386
* [FEATURE] pcidevice: Add new collector for PCIe devices #3339
* [FEATURE] AIX: Add more metrics #3338
* [FEATURE] systemd: Add Virtualization metrics #3254
* [FEATURE] swaps: Add new collector #3428
* [ENHANCEMENT] wifi: Add packet received and transmitted metrics #3382
* [ENHANCEMENT] filesystem: Take super options into account for read-only #3387
* [ENHANCEMENT] pcidevice: Add additional metrics #3425
* [ENHANCEMENT] perf: Add `tlb_data` metrics #3436
* [BUGFIX] interrupts: Fix OpenBSD interrupt device parsing #3288
* [BUGFIX] diskstats: Simplify condition #3290
* [BUGFIX] thermal: Sanitize darwin thermal strings #3294
* [BUGFIX] filesystem: Fix Darwin collector cgo memory leak #3315
* [BUGFIX] cpufreq: Fix: collector enable #3318
* [BUGFIX] ethtool: Fix returning 0 for sanitized metrics #3335
* [BUGFIX] netdev: Fix Darwin netdev i/o bytes metric #3336
* [BUGFIX] systemd: Fix logging race #3364
* [BUGFIX] filesystem: Fix duplicate Darwin CGO import #3391
## 1.9.1 / 2025-04-01
* [BUGFIX] pressure: Fix missing IRQ on older kernels #3263
* [BUGFIX] Fix Darwin memory leak #3277
## 1.9.0 / 2025-02-17
* [CHANGE] meminfo: Convert linux implementation to use procfs lib #3049
* [CHANGE] Update logging to use Go log/slog #3097
* [FEATURE] filesystem: Add `node_filesystem_mount_info` metric #2970
* [FEATURE] btrfs: Add metrics for commit statistics #3010
* [FEATURE] interrupts: Add collector include/exclude filtering #3028
* [FEATURE] interrupts: Add "exclude zeros" filtering #3028
* [FEATURE] slabinfo: Add filters for slab name. #3041
* [FEATURE] pressure: add IRQ PSI metrics #3048
* [FEATURE] hwmon: Add include and exclude filter for sensors #3072
* [FEATURE] filesystem: Add NetBSD support #3082
* [FEATURE] netdev: Add ifAlias label #3087
* [FEATURE] hwmon: Add Support for GPU Clock Frequencies #3093
* [FEATURE] Add `exclude[]` URL parameter #3116
* [FEATURE] Add AIX support #3136
* [FEATURE] filesystem: Add fs-types/mount-points include flags #3171
* [FEATURE] netstat: Add collector for tcp packet counters for FreeBSD. #3177
* [ENHANCEMENT] ethtool: Add logging for filtering flags #2979
* [ENHANCEMENT] netstat: Add TCPRcvQDrop to default metrics #3021
* [ENHANCEMENT] diskstats: Add block device rotational #3022
* [ENHANCEMENT] cpu: Support CPU online status #3032
* [ENHANCEMENT] arp: optimize interface name resolution #3133
* [ENHANCEMENT] textfile: Allow specifiying multiple directory globs #3135
* [ENHANCEMENT] filesystem: Add reporting of purgeable space on MacOS #3206
* [ENHANCEMENT] ethtool: Skip full scan of NetClass directories #3239
* [BUGFIX] zfs: Prevent `procfs` integer underflow #2961
* [BUGFIX] pressure: Fix collection on systems that do not expose a full CPU stat #3054
* [BUGFIX] cpu: Fix FreeBSD 32-bit host support and plug memory leak #3083
* [BUGFIX] hwmon: Add safety check to hwmon read #3134
* [BUGFIX] zfs: Allow space in dataset name #3186
## 1.8.1 / 2024-05-16
* [BUGFIX] Fix CPU seconds on Solaris #2963
* [BUGFIX] Sign Darwin/MacOS binaries #3008
* [BUGFIX] Fix pressure collector nil reference #3016
## 1.8.0 / 2024-04-24
* [CHANGE] exec_bsd: Fix labels for `vm.stats.sys.v_syscall` sysctl #2895
* [CHANGE] diskstats: Ignore zram devices on linux systems #2898
* [CHANGE] textfile: Avoid inconsistent help-texts #2962
* [CHANGE] os: Removed caching of modtime/filename of os-release file #2987
* [FEATURE] xfrm: Add new collector #2866
* [FEATURE] watchdog: Add new collector #2880
* [ENHANCEMENT] cpu_vulnerabilities: Add mitigation information label #2806
* [ENHANCEMENT] nfsd: Handle new `wdeleg_getattr` attribute #2810
* [ENHANCEMENT] netstat: Add TCPOFOQueue to default netstat metrics #2867
* [ENHANCEMENT] filesystem: surface device errors #2923
* [ENHANCEMENT] os: Add support end parsing #2982
* [ENHANCEMENT] zfs: Log mib when sysctl read fails on FreeBSD #2975
* [ENHANCEMENT] fibre_channel: update procfs to take into account optional attributes #2933
* [BUGFIX] cpu: Fix debug log in cpu collector #2857
* [BUGFIX] hwmon: Fix hwmon nil ptr #2873
* [BUGFIX] hwmon: Fix hwmon error capture #2915
* [BUGFIX] zfs: Revert "Add ZFS freebsd per dataset stats #2925
* [BUGFIX] ethtool: Sanitize ethtool metric name keys #2940
* [BUGFIX] fix: data race of NetClassCollector metrics initialization #2995
## 1.7.0 / 2023-11-11
* [FEATURE] Add ZFS freebsd per dataset stats #2753
* [FEATURE] Add cpu vulnerabilities reporting from sysfs #2721
* [ENHANCEMENT] Parallelize stat calls in Linux filesystem collector #1772
* [ENHANCEMENT] Add missing linkspeeds to ethtool collector 2711
* [ENHANCEMENT] Add CPU MHz as the value for `node_cpu_info` metric #2778
* [ENHANCEMENT] Improve qdisc collector performance #2779
* [ENHANCEMENT] Add include and exclude filter for hwmon collector #2699
* [ENHANCEMENT] Optionally fetch ARP stats via rtnetlink instead of procfs #2777
* [BUFFIX] Fix ZFS arcstats on FreeBSD 14.0+ 2754
* [BUGFIX] Fallback to 32-bit stats in netdev #2757
* [BUGFIX] Close btrfs.FS handle after use #2780
* [BUGFIX] Move RO status before error return #2807
* [BUFFIX] Fix `promhttp_metric_handler_errors_total` being always active #2808
* [BUGFIX] Fix nfsd v4 index miss #2824
## 1.6.1 / 2023-06-17
Rebuild with latest Go compiler bugfix release.
## 1.6.0 / 2023-05-27
* [CHANGE] Fix cpustat when some cpus are offline #2318
* [CHANGE] Remove metrics of offline CPUs in CPU collector #2605
* [CHANGE] Deprecate ntp collector #2603
* [CHANGE] Remove bcache `cache_readaheads_totals` metrics #2583
* [CHANGE] Deprecate supervisord collector #2685
* [FEATURE] Enable uname collector on NetBSD #2559
* [FEATURE] NetBSD support for the meminfo collector #2570
* [FEATURE] NetBSD support for CPU collector #2626
* [FEATURE] Add FreeBSD collector for netisr subsystem #2668
* [FEATURE] Add softirqs collector #2669
* [ENHANCEMENT] Add suspended as a `node_zfs_zpool_state` #2449
* [ENHANCEMENT] Add administrative state of Linux network interfaces #2515
* [ENHANCEMENT] Log current value of GOMAXPROCS #2537
* [ENHANCEMENT] Add profiler options for perf collector #2542
* [ENHANCEMENT] Allow root path as metrics path #2590
* [ENHANCEMENT] Add cpu frequency governor metrics #2569
* [ENHANCEMENT] Add new landing page #2622
* [ENHANCEMENT] Reduce privileges needed for btrfs device stats #2634
* [ENHANCEMENT] Add ZFS `memory_available_bytes` #2687
* [ENHANCEMENT] Use `SCSI_IDENT_SERIAL` as serial in diskstats #2612
* [ENHANCEMENT] Read missing from netlink netclass attributes from sysfs #2669
* [BUGFIX] perf: fixes for automatically detecting the correct tracefs mountpoints #2553
* [BUGFIX] Fix `thermal_zone` collector noise #2554
* [BUGFIX] Fix a problem fetching the user wire count on FreeBSD #2584
* [BUGFIX] interrupts: Fix fields on linux aarch64 #2631
* [BUGFIX] Remove metrics of offline CPUs in CPU collector #2605
* [BUGFIX] Fix OpenBSD filesystem collector string parsing #2637
* [BUGFIX] Fix bad reporting of `node_cpu_seconds_total` in OpenBSD #2663
## 1.5.0 / 2022-11-29
NOTE: This changes the Go runtime "GOMAXPROCS" to 1. This is done to limit the
concurrency of the exporter to 1 CPU thread at a time in order to avoid a
race condition problem in the Linux kernel (#2500) and parallel IO issues
on nodes with high numbers of CPUs/CPU threads (#1880).
NOTE: A command line arg has been changed from `--web.config` to `--web.config.file`.
* [CHANGE] Default GOMAXPROCS to 1 #2530
* [FEATURE] Add multiple listeners and systemd socket listener activation #2393
* [ENHANCEMENT] Add RTNL version of netclass collector #2492, #2528
* [BUGFIX] Fix diskstats exclude flags #2487
* [BUGFIX] Bump go/x/crypt and go/x/net #2488
* [BUGFIX] Fix hwmon label sanitizer #2504
* [BUGFIX] Use native endianness when encoding InetDiagMsg #2508
* [BUGFIX] Fix btrfs device stats always being zero #2516
* [BUGFIX] Security: Update exporter-toolkit (CVE-2022-46146) #2531
## 1.4.1 / 2022-11-29
* [BUGFIX] Fix diskstats exclude flags #2487
* [BUGFIX] Security: Update go/x/crypto and go/x/net (CVE-2022-27191 CVE-2022-27664) #2488
* [BUGFIX] Security: Update exporter-toolkit (CVE-2022-46146) #2531
## 1.4.0 / 2022-09-24
* [CHANGE] Merge metrics descriptions in textfile collector #2475
* [FEATURE] [node-mixin] Add darwin dashboard to mixin #2351
* [FEATURE] Add "isolated" metric on cpu collector on linux #2251
* [FEATURE] Add cgroup summary collector #2408
* [FEATURE] Add selinux collector #2205
* [FEATURE] Add slab info collector #2376
* [FEATURE] Add sysctl collector #2425
* [FEATURE] Also track the CPU Spin time for OpenBSD systems #1971
* [FEATURE] Add support for MacOS version #2471
* [ENHANCEMENT] [node-mixin] Add missing selectors #2426
* [ENHANCEMENT] [node-mixin] Change current datasource to grafana's default #2281
* [ENHANCEMENT] [node-mixin] Change disk graph to disk table #2364
* [ENHANCEMENT] [node-mixin] Change io time units to %util #2375
* [ENHANCEMENT] Ad user_wired_bytes and laundry_bytes on *bsd #2266
* [ENHANCEMENT] Add additional vm_stat memory metrics for darwin #2240
* [ENHANCEMENT] Add device filter flags to arp collector #2254
* [ENHANCEMENT] Add diskstats include and exclude device flags #2417
* [ENHANCEMENT] Add node_softirqs_total metric #2221
* [ENHANCEMENT] Add rapl zone name label option #2401
* [ENHANCEMENT] Add slabinfo collector #1799
* [ENHANCEMENT] Allow user to select port on NTP server to query #2270
* [ENHANCEMENT] collector/diskstats: Add labels and metrics from udev #2404
* [ENHANCEMENT] Enable builds against older macOS SDK #2327
* [ENHANCEMENT] qdisk-linux: Add exclude and include flags for interface name #2432
* [ENHANCEMENT] systemd: Expose systemd minor version #2282
* [ENHANCEMENT] Use netlink for tcpstat collector #2322
* [ENHANCEMENT] Use netlink to get netdev stats #2074
* [ENHANCEMENT] Add additional perf counters for stalled frontend/backend cycles #2191
* [ENHANCEMENT] Add btrfs device error stats #2193
* [BUGFIX] [node-mixin] Fix fsSpaceAvailableCriticalThreshold and fsSpaceAvailableWarning #2352
* [BUGFIX] Fix concurrency issue in ethtool collector #2289
* [BUGFIX] Fix concurrency issue in netdev collector #2267
* [BUGFIX] Fix diskstat reads and write metrics for disks with different sector sizes #2311
* [BUGFIX] Fix iostat on macos broken by deprecation warning #2292
* [BUGFIX] Fix NodeFileDescriptorLimit alerts #2340
* [BUGFIX] Sanitize rapl zone names #2299
* [BUGFIX] Add file descriptor close safely in test #2447
* [BUGFIX] Fix race condition in os_release.go #2454
* [BUGFIX] Skip ZFS IO metrics if their paths are missing #2451
## 1.3.1 / 2021-12-01
* [BUGFIX] Handle nil CPU thermal power status on M1 #2218
* [BUGFIX] bsd: Ignore filesystems flagged as MNT_IGNORE. #2227
* [BUGFIX] Sanitize UTF-8 in dmi collector #2229
## 1.3.0 / 2021-10-20
NOTE: In order to support globs in the textfile collector path, filenames exposed by
`node_textfile_mtime_seconds` now contain the full path name.
* [CHANGE] Add path label to rapl collector #2146
* [CHANGE] Exclude filesystems under /run/credentials #2157
* [CHANGE] Add TCPTimeouts to netstat default filter #2189
* [FEATURE] Add lnstat collector for metrics from /proc/net/stat/ #1771
* [FEATURE] Add darwin powersupply collector #1777
* [FEATURE] Add support for monitoring GPUs on Linux #1998
* [FEATURE] Add Darwin thermal collector #2032
* [FEATURE] Add os release collector #2094
* [FEATURE] Add netdev.address-info collector #2105
* [FEATURE] Add clocksource metrics to time collector #2197
* [ENHANCEMENT] Support glob textfile collector directories #1985
* [ENHANCEMENT] ethtool: Expose node_ethtool_info metric #2080
* [ENHANCEMENT] Use include/exclude flags for ethtool filtering #2165
* [ENHANCEMENT] Add flag to disable guest CPU metrics #2123
* [ENHANCEMENT] Add DMI collector #2131
* [ENHANCEMENT] Add threads metrics to processes collector #2164
* [ENHANCEMENT] Reduce timer GC delays in the Linux filesystem collector #2169
* [ENHANCEMENT] Add TCPTimeouts to netstat default filter #2189
* [ENHANCEMENT] Use SysctlTimeval for boottime collector on BSD #2208
* [BUGFIX] ethtool: Sanitize metric names #2093
* [BUGFIX] Fix ethtool collector for multiple interfaces #2126
* [BUGFIX] Fix possible panic on macOS #2133
* [BUGFIX] Collect flag_info and bug_info only for one core #2156
* [BUGFIX] Prevent duplicate ethtool metric names #2187
## 1.2.2 / 2021-08-06
* [BUGFIX] Fix processes collector long int parsing #2112
## 1.2.1 / 2021-07-23
* [BUGFIX] Fix zoneinfo parsing prometheus/procfs#386
* [BUGFIX] Fix nvme collector log noise #2091
* [BUGFIX] Fix rapl collector log noise #2092
## 1.2.0 / 2021-07-15
NOTE: Ignoring invalid network speed will be the default in 2.x
NOTE: Filesystem collector flags have been renamed. `--collector.filesystem.ignored-mount-points` is now `--collector.filesystem.mount-points-exclude` and `--collector.filesystem.ignored-fs-types` is now `--collector.filesystem.fs-types-exclude`. The old flags will be removed in 2.x.
* [CHANGE] Rename filesystem collector flags to match other collectors #2012
* [CHANGE] Make node_exporter print usage to STDOUT #2039
* [FEATURE] Add conntrack statistics metrics #1155
* [FEATURE] Add ethtool stats collector #1832
* [FEATURE] Add flag to ignore network speed if it is unknown #1989
* [FEATURE] Add tapestats collector for Linux #2044
* [FEATURE] Add nvme collector #2062
* [ENHANCEMENT] Add ErrorLog plumbing to promhttp #1887
* [ENHANCEMENT] Add more Infiniband counters #2019
* [ENHANCEMENT] netclass: retrieve interface names and filter before parsing #2033
* [ENHANCEMENT] Add time zone offset metric #2060
* [BUGFIX] Handle errors from disabled PSI subsystem #1983
* [BUGFIX] Fix panic when using backwards compatible flags #2000
* [BUGFIX] Fix wrong value for OpenBSD memory buffer cache #2015
* [BUGFIX] Only initiate collectors once #2048
* [BUGFIX] Handle small backwards jumps in CPU idle #2067
## 1.1.2 / 2021-03-05
* [BUGFIX] Handle errors from disabled PSI subsystem #1983
* [BUGFIX] Sanitize strings from /sys/class/power_supply #1984
* [BUGFIX] Silence missing netclass errors #1986
## 1.1.1 / 2021-02-12
* [BUGFIX] Fix ineffassign issue #1957
* [BUGFIX] Fix some noisy log lines #1962
## 1.1.0 / 2021-02-05
NOTE: We have improved some of the flag naming conventions (PR #1743). The old names are
deprecated and will be removed in 2.0. They will continue to work for backwards
compatibility.
* [CHANGE] Improve filter flag names #1743
* [CHANGE] Add btrfs and powersupplyclass to list of exporters enabled by default #1897
* [FEATURE] Add fibre channel collector #1786
* [FEATURE] Expose cpu bugs and flags as info metrics. #1788
* [FEATURE] Add network_route collector #1811
* [FEATURE] Add zoneinfo collector #1922
* [ENHANCEMENT] Add more InfiniBand counters #1694
* [ENHANCEMENT] Add flag to aggr ipvs metrics to avoid high cardinality metrics #1709
* [ENHANCEMENT] Adding backlog/current queue length to qdisc collector #1732
* [ENHANCEMENT] Include TCP OutRsts in netstat metrics #1733
* [ENHANCEMENT] Add pool size to entropy collector #1753
* [ENHANCEMENT] Remove CGO dependencies for OpenBSD amd64 #1774
* [ENHANCEMENT] bcache: add writeback_rate_debug stats #1658
* [ENHANCEMENT] Add check state for mdadm arrays via node_md_state metric #1810
* [ENHANCEMENT] Expose XFS inode statistics #1870
* [ENHANCEMENT] Expose zfs zpool state #1878
* [ENHANCEMENT] Added an ability to pass collector.supervisord.url via SUPERVISORD_URL environment variable #1947
* [BUGFIX] filesystem_freebsd: Fix label values #1728
* [BUGFIX] Fix various procfs parsing errors #1735
* [BUGFIX] Handle no data from powersupplyclass #1747
* [BUGFIX] udp_queues_linux.go: change upd to udp in two error strings #1769
* [BUGFIX] Fix node_scrape_collector_success behaviour #1816
* [BUGFIX] Fix NodeRAIDDegraded to not use a string rule expressions #1827
* [BUGFIX] Fix node_md_disks state label from fail to failed #1862
* [BUGFIX] Handle EPERM for syscall in timex collector #1938
* [BUGFIX] bcache: fix typo in a metric name #1943
* [BUGFIX] Fix XFS read/write stats (https://github.com/prometheus/procfs/pull/343)
## 1.0.1 / 2020-06-15
* [BUGFIX] filesystem_freebsd: Fix label values #1728
* [BUGFIX] Update prometheus/procfs to fix log noise #1735
* [BUGFIX] Fix build tags for collectors #1745
* [BUGFIX] Handle no data from powersupplyclass #1747, #1749
## 1.0.0 / 2020-05-25
### **Breaking changes**
* The netdev collector CLI argument `--collector.netdev.ignored-devices` was renamed to `--collector.netdev.device-blacklist` in order to conform with the systemd collector. #1279
* The label named `state` on `node_systemd_service_restart_total` metrics was changed to `name` to better describe the metric. #1393
* Refactoring of the mdadm collector changes several metrics
- `node_md_disks_active` is removed
- `node_md_disks` now has a `state` label for "failed", "spare", "active" disks.
- `node_md_is_active` is replaced by `node_md_state` with a state set of "active", "inactive", "recovering", "resync".
* Additional label `mountaddr` added to NFS device metrics to distinguish mounts from the same URL, but different IP addresses. #1417
* Metrics node_cpu_scaling_frequency_min_hrts and node_cpu_scaling_frequency_max_hrts of the cpufreq collector were renamed to node_cpu_scaling_frequency_min_hertz and node_cpu_scaling_frequency_max_hertz. #1510
* Collectors that are enabled, but are unable to find data to collect, now return 0 for `node_scrape_collector_success`.
### Changes
* [CHANGE] Add `--collector.netdev.device-whitelist`. #1279
* [CHANGE] Ignore iso9600 filesystem on Linux #1355
* [CHANGE] Refactor mdadm collector #1403
* [CHANGE] Add `mountaddr` label to NFS metrics. #1417
* [CHANGE] Don't count empty collectors as success. #1613
* [FEATURE] New flag to disable default collectors #1276
* [FEATURE] Add experimental TLS support #1277, #1687, #1695
* [FEATURE] Add collector for Power Supply Class #1280
* [FEATURE] Add new schedstat collector #1389
* [FEATURE] Add FreeBSD zfs support #1394
* [FEATURE] Add uname support for Darwin and OpenBSD #1433
* [FEATURE] Add new metric node_cpu_info #1489
* [FEATURE] Add new thermal_zone collector #1425
* [FEATURE] Add new cooling_device metrics to thermal zone collector #1445
* [FEATURE] Add swap usage on darwin #1508
* [FEATURE] Add Btrfs collector #1512
* [FEATURE] Add RAPL collector #1523
* [FEATURE] Add new softnet collector #1576
* [FEATURE] Add new udp_queues collector #1503
* [FEATURE] Add basic authentication #1673
* [ENHANCEMENT] Log pid when there is a problem reading the process stats #1341
* [ENHANCEMENT] Collect InfiniBand port state and physical state #1357
* [ENHANCEMENT] Include additional XFS runtime statistics. #1423
* [ENHANCEMENT] Report non-fatal collection errors in the exporter metric. #1439
* [ENHANCEMENT] Expose IPVS firewall mark as a label #1455
* [ENHANCEMENT] Add check for systemd version before attempting to query certain metrics. #1413
* [ENHANCEMENT] Add a flag to adjust mount timeout #1486
* [ENHANCEMENT] Add new counters for flush requests in Linux 5.5 #1548
* [ENHANCEMENT] Add metrics and tests for UDP receive and send buffer errors #1534
* [ENHANCEMENT] The sockstat collector now exposes IPv6 statistics in addition to the existing IPv4 support. #1552
* [ENHANCEMENT] Add infiniband info metric #1563
* [ENHANCEMENT] Add unix socket support for supervisord collector #1592
* [ENHANCEMENT] Implement loadavg on all BSDs without cgo #1584
* [ENHANCEMENT] Add model_name and stepping to node_cpu_info metric #1617
* [ENHANCEMENT] Add `--collector.perf.cpus` to allow setting the CPU list for perf stats. #1561
* [ENHANCEMENT] Add metrics for IO errors and retires on Darwin. #1636
* [ENHANCEMENT] Add perf tracepoint collection flag #1664
* [ENHANCEMENT] ZFS: read contents of objset file #1632
* [ENHANCEMENT] Linux CPU: Cache CPU metrics to make them monotonically increasing #1711
* [BUGFIX] Read /proc/net files with a single read syscall #1380
* [BUGFIX] Renamed label `state` to `name` on `node_systemd_service_restart_total`. #1393
* [BUGFIX] Fix netdev nil reference on Darwin #1414
* [BUGFIX] Strip path.rootfs from mountpoint labels #1421
* [BUGFIX] Fix seconds reported by schedstat #1426
* [BUGFIX] Fix empty string in path.rootfs #1464
* [BUGFIX] Fix typo in cpufreq metric names #1510
* [BUGFIX] Read /proc/stat in one syscall #1538
* [BUGFIX] Fix OpenBSD cache memory information #1542
* [BUGFIX] Refactor textfile collector to avoid looping defer #1549
* [BUGFIX] Fix network speed math #1580
* [BUGFIX] collector/systemd: use regexp to extract systemd version #1647
* [BUGFIX] Fix initialization in perf collector when using multiple CPUs #1665
* [BUGFIX] Fix accidentally empty lines in meminfo_linux #1671
## 0.18.1 / 2019-06-04
### Changes
* [BUGFIX] Fix incorrect sysctl call in BSD meminfo collector, resulting in broken swap metrics on FreeBSD #1345
* [BUGFIX] Fix rollover bug in mountstats collector #1364
## 0.18.0 / 2019-05-09
### **Breaking changes**
* Renamed `interface` label to `device` in netclass collector for consistency with
other network metrics #1224
* The cpufreq metrics now separate the `cpufreq` and `scaling` data based on what the driver provides. #1248
* The labels for the network_up metric have changed, see issue #1236
* Bonding collector now uses `mii_status` instead of `operstatus` #1124
* Several systemd metrics have been turned off by default to improve performance #1254
These include unit_tasks_current, unit_tasks_max, service_restart_total, and unit_start_time_seconds
* The systemd collector blacklist now includes automount, device, mount, and slice units by default. #1255
### Changes
* [CHANGE] Bonding state uses mii_status #1124
* [CHANGE] Add a limit to the number of in-flight requests #1166
* [CHANGE] Renamed `interface` label to `device` in netclass collector #1224
* [CHANGE] Add separate cpufreq and scaling metrics #1248
* [CHANGE] Several systemd metrics have been turned off by default to improve performance #1254
* [CHANGE] Expand systemd collector blacklist #1255
* [CHANGE] Split cpufreq metrics into a separate collector #1253
* [FEATURE] Add a flag to disable exporter metrics #1148
* [FEATURE] Add kstat-based Solaris metrics for boottime, cpu and zfs collectors #1197
* [FEATURE] Add uname collector for FreeBSD #1239
* [FEATURE] Add diskstats collector for OpenBSD #1250
* [FEATURE] Add pressure collector exposing pressure stall information for Linux #1174
* [FEATURE] Add perf exporter for Linux #1274
* [ENHANCEMENT] Add Infiniband counters #1120
* [ENHANCEMENT] Add TCPSynRetrans to netstat default filter #1143
* [ENHANCEMENT] Move network_up labels into new metric network_info #1236
* [ENHANCEMENT] Use 64-bit counters for Darwin netstat
* [BUGFIX] Add fallback for missing /proc/1/mounts #1172
* [BUGFIX] Fix node_textfile_mtime_seconds to work properly on symlinks #1326
## 0.17.0 / 2018-11-30
Build note: Linux builds can now be built without CGO.
### **Breaking changes**
supvervisord collector reports `start_time_seconds` rather than `uptime` #952
The wifi collector is disabled by default due to suspected caching issues and goroutine leaks.
* https://github.com/prometheus/node_exporter/issues/870
* https://github.com/prometheus/node_exporter/issues/1008
Darwin meminfo metrics have been renamed to match Prometheus conventions. #1060
### Changes
* [CHANGE] Use /proc/mounts instead of statfs(2) for ro state #1002
* [CHANGE] Exclude only subdirectories of /var/lib/docker #1003
* [CHANGE] Filter out non-installed units when collecting all systemd units #1011
* [CHANGE] `service_restart_total` and `socket_refused_connections_total` will not be reported if you're running an older version of systemd
* [CHANGE] collector/timex: remove cgo dependency #1079
* [CHANGE] filesystem: Ignore Docker netns mounts #1047
* [CHANGE] Ignore additional virtual filesystems #1104
* [FEATURE] Add netclass collector #851
* [FEATURE] Add processes collector #950
* [FEATURE] Collect start time for systemd units #952
* [FEATURE] Add socket unit stats to systemd collector #968
* [FEATURE] Collect NRestarts property for systemd service units #992
* [FEATURE] Collect NRefused property for systemd socket units (available as of systemd v239) #995
* [FEATURE] Allow removal of rootfs prefix for run in docker #1058
* [ENHANCEMENT] Support for octal characters in mountpoints #954
* [ENHANCEMENT] Update wifi stats to support multiple stations #980
* [ENHANCEMENT] Add transmit/receive bytes total for wifi stations #1150
* [ENHANCEMENT] Handle stuck NFS mounts #997
* [ENHANCEMENT] infiniband: Handle iWARP RDMA modules N/A #974
* [ENHANCEMENT] Update diskstats for linux kernel 4.19 #1109
* [ENHANCEMENT] Collect TasksCurrent, TasksMax per systemd unit #1098
* [BUGFIX] Fix FreeBSD CPU temp #965
* [BUGFIX] Fix goroutine leak in supervisord collector #978
* [BUGFIX] Fix mdadm collector issues #985
* [BUGFIX] Fix ntp collector thread safety #1014
* [BUGFIX] Systemd units will not be ignored if you're running older versions of systemd #1039
* [BUGFIX] Handle vanishing PIDs #1043
* [BUGFIX] Correctly cast Darwin memory info #1060
* [BUGFIX] Filter systemd units in Go for compatibility with older versions #1083
* [BUGFIX] Update cpu collector for OpenBSD 6.4 #1094
* [BUGFIX] Fix typo on HELP of `read_time_seconds_total` #1057
* [BUGFIX] collector/diskstats: don't fail if there are extra stats #1125
* [BUGFIX] collector/hwmon\_linux: handle temperature sensor file #1123
* [BUGFIX] collector/filesystem: add bounds check #1133
* [BUGFIX] Fix dragonfly's CPU counting frequency #1140
* [BUGFIX] Add fallback for missing /proc/1/mounts #1172
## 0.16.0 / 2018-05-15
**Breaking changes**
This release contains major breaking changes to metric names. Many metrics have new names, labels, and label values in order to conform to current naming conventions.
* Linux node_cpu metrics now break out `guest` values into separate metrics. See Issue #737
* Many counter metrics have been renamed to include `_total`.
* Many metrics have been renamed/modified to include base units, for example `node_cpu` is now `node_cpu_seconds_total`.
In order to help with the transition we have an [upgrade guide](docs/V0_16_UPGRADE_GUIDE.md).
Other breaking changes:
* The megacli collector has been removed, is now replaced by the storcli.py textfile helper.
* The gmond collector has been removed.
* The textfile collector will now treat timestamps as errors.
* [CHANGE] Split out guest cpu metrics on Linux. #744
* [CHANGE] Exclude Linux proc from filesystem type regexp #774
* [CHANGE] Ignore more virtual filesystems #775
* [CHANGE] Remove obsolete megacli collector. #798
* [CHANGE] Ignore /var/lib/docker by default. #814
* [CHANGE] Cleanup NFS metrics #834
* [CHANGE] Only report core throttles per core, not per cpu #836
* [CHANGE] Treat custom textfile metric timestamps as errors #769
* [CHANGE] Use lowercase cpu label name in interrupts #849
* [CHANGE] Enable bonding collector by default. #872
* [CHANGE] Greatly reduce the metrics vmstat returns by default. #874
* [CHANGE] Greatly trim what netstat collector exposes by default #876
* [CHANGE] Drop `exec_` prefix and move `node_boot_time_seconds` from `exec` to new `boottime` collector and enable for Darwin/Dragonfly/FreeBSD/NetBSD/OpenBSD. #839, #901
* [CHANGE] Remove deprecated gmond collector #852
* [CHANGE] align Darwin disk stat names with Linux #930
* [FEATURE] Add `collect[]` parameter #699
* [FEATURE] Add text collector conversion for ipmitool output. #746
* [FEATURE] Add openbsd meminfo #724
* [FEATURE] Add systemd summary metrics #765
* [FEATURE] Add OpenBSD CPU collector #805
* [FEATURE] Add NFS Server metrics collector. #803
* [FEATURE] add sample directory size exporter #789
* [ENHANCEMENT] added Wear_Leveling_Count attribute to smartmon.sh script #707
* [ENHANCEMENT] Simplify Utsname string conversion #716
* [ENHANCEMENT] apt.sh: handle multiple origins in apt-get output #757
* [ENHANCEMENT] Export systemd timers last trigger seconds. #807
* [ENHANCEMENT] updates for zfsonlinux 0.7.5 #779
* [BUGFIX] Fix smartmon.sh textfile script #700
* [BUGFIX] netdev: Change valueType to CounterValue #749
* [BUGFIX] textfile: fix duplicate metrics error #738
* [BUGFIX] Fix panic by updating github.com/ema/qdisc dependency #778
* [BUGFIX] Use uint64 in the ZFS collector #714
* [BUGFIX] multiply page size after float64 coercion to avoid signed integer overflow #780
* [BUGFIX] smartmon: Escape double quotes in device model family #772
* [BUGFIX] Fix log level regression in #533 #815
* [BUGFIX] Correct the ClocksPerSec scaling factor on Darwin #846
* [BUGFIX] Count core throttles per core and per package #871
* [BUGFIX] Fix netdev collector for linux #890 #910
* [BUGFIX] Fix memory corruption when number of filesystems > 16 on FreeBSD #900
* [BUGFIX] Fix parsing of interface aliases in netdev linux #904
## 0.15.2 / 2017-12-06
* [BUGFIX] cpu: Support processor-less (memory-only) NUMA nodes #734
## 0.15.1 / 2017-11-07
* [BUGFIX] xfs: expose correct fields, fix metric names #708
* [BUGFIX] Correct buffer_bytes > INT_MAX on BSD/amd64. #712
* [BUGFIX] netstat: return nothing when /proc/net/snmp6 not found #718
* [BUGFIX] Fix off by one in Linux interrupts collector #721
* [BUGFIX] Add and use sysReadFile in hwmon collector #728
## 0.15.0 / 2017-10-06
**Breaking changes**
This release contains major breaking changes to flag handling.
* The flag library has been changed, all flags now require double-dashes. (`-foo` becomes `--foo`).
* The collector selection flag has been replaced by individual boolean flags.
* The `-collector.procfs` and `-collector.sysfs` flags have been renamed to `--path.procfs` and `--path.sysfs` respectively.
The `ntp` collector has been replaced with a new NTP-based check that is designed to expose the state of a localhost NTP server rather than provide the offset of the node to a remote NTP server. By default the `ntp` collector is now locked to localhost. This is to avoid accidental spamming of public internet NTP pools.
Windows support is now removed, the [wmi_exporter](https://github.com/martinlindhe/wmi_exporter) is recommended as a replacement.
* [CHANGE] `node_cpu` metrics moved from `stats` to `cpu` collector on linux (enabled by default). #548
* [CHANGE] Blacklist systemd scope units #534
* [CHANGE] Remove netbsd/arm #551
* [CHANGE] Remove Windows support #549
* [CHANGE] Enable IPVS collector by default #623
* [CHANGE] Switch to kingpin flags #639
* [CHANGE] Replace --collectors.enabled with per-collector flags #640
* [FEATURE] Add ARP collector for Linux #540
* [FEATURE] Add XFS collector for Linux #568, #575
* [FEATURE] Add qdisc collector for Linux #580
* [FEATURE] Add cpufreq stats for Linux #548
* [FEATURE] Add diskstats for Darwin #593
* [FEATURE] Add bcache collector for Linux #597
* [FEATURE] Add parsing /proc/net/snmp6 file for Linux #615
* [FEATURE] Add timex collector for Linux #664
* [ENHANCEMENT] Include overall health status in smartmon.sh example script #546
* [ENHANCEMENT] Include `guest_nice` in CPU collector #554
* [ENHANCEMENT] Add exec_boot_time for freebsd, dragonfly #550
* [ENHANCEMENT] Get full resolution for node_time #555
* [ENHANCEMENT] infiniband: Multiply port data XMIT/RCV metrics by 4 #579
* [ENHANCEMENT] cpu: Metric 'package_throttles_total' is per package. #657
* [BUGFIX] Fix stale device error metrics #533
* [BUGFIX] edac: Fix typo in node_edac_csrow_uncorrectable_errors_total #564
* [BUGFIX] Use int64 throughout the ZFS collector #653
* [BUGFIX] Silently ignore nonexisting bonding_masters file #569
* [BUGFIX] Change raid0 status line regexp for mdadm collector (bug #618) #619
* [BUGFIX] Ignore wifi collector permission errors #646
* [BUGFIX] Always try to return smartmon_device_info metric #663
## 0.14.0 / 2017-03-21
NOTE: We are deprecating several collectors in this release.
* `gmond` - Out of scope.
* `megacli` - Requires forking, to be moved to textfile collection.
* `ntp` - Out of scope.
Breaking changes:
* Collector errors are now a separate metric, `node_scrape_collector_success`, not a label on `node_exporter_scrape_duration_seconds` (#516)
* [CHANGE] Report collector success/failure as a bool metric, not a label. #516
* [FEATURE] Add loadavg collector for Solaris #311
* [FEATURE] Add StorCli text collector example script #320
* [FEATURE] Add collector for Linux EDAC #324
* [FEATURE] Add text file utility for SMART metrics #354
* [FEATURE] Add a collector for NFS client statistics. #360
* [FEATURE] Add mountstats collector for detailed NFS statistics #367
* [FEATURE] Add a collector for DRBD #365
* [FEATURE] Add cpu collector for darwin #391
* [FEATURE] Add netdev collector for darwin #393
* [FEATURE] Collect CPU temperatures on FreeBSD #397
* [FEATURE] Add ZFS collector #410
* [FEATURE] Add initial wifi collector #413
* [FEATURE] Add NFS event metrics to mountstats collector #415
* [FEATURE] Add an example rules file #422
* [FEATURE] infiniband: Add new collector for InfiniBand statistics #450
* [FEATURE] buddyinfo: Add support for /proc/buddyinfo for linux free memory fragmentation. #454
* [IMPROVEMENT] hwmon: Provide annotation metric to link chip sysfs paths to human-readable chip types #359
* [IMPROVEMENT] Add node_filesystem_device_errors_total metric #374
* [IMPROVEMENT] Add runit service dir flag #375
* [IMPROVEMENT] Improve Docker documentation #376
* [IMPROVEMENT] Ignore autofs filesystems on linux #384
* [IMPROVEMENT] Replace some FreeBSD collectors with pure Go versions #385
* [IMPROVEMENT] Use filename as label, move 'label' to own metric #411 (hwmon)
* [BUGFIX] mips64 build fix #361
* [BUGFIX] Update vendoring #372 (to fix #242)
* [BUGFIX] Convert remaining collectors to use ConstMetrics #389
* [BUGFIX] Check for errors in netdev scanner #398
* [BUGFIX] Don't leak or race in FreeBSD devstat collector #396
* [BUGFIX] Allow graceful failure in hwmon collector #427
* [BUGFIX] Fix the reporting of active+total disk metrics for inactive raids. #522
## 0.13.0 / 2016-11-26
NOTE: We have disabled builds of linux/ppc64 and linux/ppc64le due to build bugs.
* [FEATURE] Add flag to ignore certain filesystem types (Copy of #217) #241
* [FEATURE] Add NTP stratum to NTP collector. #247
* [FEATURE] Add ignored-units flag for systemd collector #286
* [FEATURE] Compile netdev on dragonfly #314
* [FEATURE] Compile meminfo for dfly #315
* [FEATURE] Add hwmon /sensors support #278
* [FEATURE] Add Linux NUMA "numastat" metrics #249
* [FEATURE] export DragonFlyBSD CPU time #310
* [FEATURE] Dragonfly devstat #323
* [IMPROVEMENT] Use the offset calculation that includes round trip time in the ntp collector #250
* [IMPROVEMENT] Enable `*bsd` collector on darwin #265
* [IMPROVEMENT] Use meminfo_freebsd on darwin as well #266
* [IMPROVEMENT] sockstat: add support for RHE4 #267
* [IMPROVEMENT] Compile fs stats for dfly #302
* [BUGFIX] Add support for raid0 devices in mdadm_linux collector. #253
* [BUGFIX] Close file handler in textfile #263
* [BUGFIX] Ignore partitions on NVME devices by default #268
* [BUGFIX] Fix mdstat tabs parsing #275
* [BUGFIX] Fix mdadm collector for resync=PENDING. #309
* [BUGFIX] mdstat: Fix parsing of RAID0 lines that contain additional attributes. #341
* [BUGFIX] Fix additional mdadm parsing cases #346
## 0.12.0 / 2016-05-05
* [CHANGE] Remove lastlogin collector.
* [CHANGE] Remove -debug.memprofile-file flag.
* [CHANGE] Sync BSD filesystem collector labels with Linux.
* [CHANGE] Remove HTTP Basic Auth support.
* [FEATURE] Add -version flag.
* [FEATURE] Add Linux logind collector.
* [FEATURE] Add Linux ksmd collector.
* [FEATURE] Add Linux memory NUMA collector.
* [FEATURE] Add Linux entropy collector.
* [FEATURE] Add Linux vmstat collector.
* [FEATURE] Add Linux conntrack collector.
* [FEATURE] Add systemd collector.
* [FEATURE] Add OpenBSD support for filesystem, interrupt and netdev collectors.
* [FEATURE] Add supervisord collector.
* [FEATURE] Add Linux /proc/mdstat collector.
* [FEATURE] Add Linux uname collector.
* [FEATURE] Add Linux /proc/sys/fs/file-nr collector.
* [FEATURE] Add Linux /proc/net/sockstat collector.
* [IMPROVEMENT] Provide statically linked Linux binaries.
* [IMPROVEMENT] Remove root requirement for FreeBSD CPU metrics.
* [IMPROVEMENT] Add node_exporter build info metric.
* [IMPROVEMENT] Add disk bytes read/written metrics on Linux.
* [IMPROVEMENT] Add filesystem read-only metric.
* [IMPROVEMENT] Use common Prometheus log formatting.
* [IMPROVEMENT] Add option to specify NTP protocol version.
* [IMPROVEMENT] Handle statfs errors gracefully for individual filesystems.
* [IMPROVEMENT] Add load5 and load15 metrics to loadavg collector.
* [IMPROVEMENT] Add end-to-end tests.
* [IMPROVEMENT] Export FreeBSD CPU metrics to seconds.
* [IMPROVEMENT] Add flag to configure sysfs mountpoint.
* [IMPROVEMENT] Add flag to configure procfs mountpoint.
* [IMPROVEMENT] Add metric for last service state change to runit collector.
* [BUGFIX] Fix FreeBSD netdev metrics on 64 bit systems.
* [BUGFIX] Fix mdstat for devices in delayed resync state.
* [BUGFIX] Fix Linux stat metrics on parallel scrapes.
* [BUGFIX] Remove unavailable collectors from defaults.
* [BUGFIX] Fix build errors on FreeBSD, OpenBSD, Darwin and Windows.
* [BUGFIX] Fix build errors on 386, arm, arm64, ppc64 and ppc64le architectures.
* [BUGFIX] Fix export of stale metrics for removed filesystem and network devices.
* [BUGFIX] textfile: Fix mtime reporting.
* [BUGFIX] megacli: prevent crash when drive temperature is N/A
## 0.11.0 / 2015-07-27
* [FEATURE] Add stats from /proc/net/snmp.
* [FEATURE] Add support for FreeBSD.
* [FEATURE] Allow netdev devices to be ignored.
* [MAINTENANCE] New Dockerfile for unified way to dockerize Prometheus exporters.
* [FEATURE] Add device,fstype collection to the filesystem exporter.
* [IMPROVEMENT] Make logging of collector executions less verbose.
## 0.10.0 / 2015-06-10
* [CHANGE] Change logging output format and flags.
## 0.9.0 / 2015-05-26
* [BUGFIX] Fix `/proc/net/dev` parsing.
* [CLEANUP] Remove the `attributes` collector, use `textfile` instead.
* [CLEANUP] Replace last uses of the configuration file with flags.
* [IMPROVEMENT] Remove cgo dependency.
* [IMPROVEMENT] Sort collector names when printing.
* [FEATURE] IPVS stats collector.
## 0.8.1 / 2015-05-17
* [MAINTENANCE] Use the common Prometheus build infrastructure.
* [MAINTENANCE] Update former Google Code imports.
* [IMPROVEMENT] Log the version at startup.
* [FEATURE] TCP stats collector
## 0.8.0 / 2015-03-09
* [CLEANUP] Introduced semantic versioning and changelog. From now on,
changes will be reported in this file.
================================================
FILE: CODE_OF_CONDUCT.md
================================================
# Prometheus Community Code of Conduct
Prometheus follows the [CNCF Code of Conduct](https://github.com/cncf/foundation/blob/main/code-of-conduct.md).
================================================
FILE: CONTRIBUTING.md
================================================
# Contributing
Prometheus uses GitHub to manage reviews of pull requests.
* If you have a trivial fix or improvement, go ahead and create a pull request,
addressing (with `@...`) the maintainer of this repository (see
[MAINTAINERS.md](MAINTAINERS.md)) in the description of the pull request.
* If you plan to do something more involved, first discuss your ideas
on our [mailing list](https://groups.google.com/forum/?fromgroups#!forum/prometheus-developers).
This will avoid unnecessary work and surely give you and us a good deal
of inspiration.
* Relevant coding style guidelines are the [Go Code Review
Comments](https://code.google.com/p/go-wiki/wiki/CodeReviewComments)
and the _Formatting and style_ section of Peter Bourgon's [Go: Best
Practices for Production
Environments](http://peter.bourgon.org/go-in-production/#formatting-and-style).
* Sign your work to certify that your changes were created by yourself or you
have the right to submit it under our license. Read
https://developercertificate.org/ for all details and append your sign-off to
every commit message like this:
Signed-off-by: Random J Developer <example@example.com>
## Collector Implementation Guidelines
The Node Exporter is not a general monitoring agent. Its sole purpose is to
expose machine metrics, as oppose to service metrics, with the only exception
being the textfile collector.
The metrics should not get transformed in a way that is hardware specific and
would require maintaining any form of vendor based mappings or conditions. If
for example a proc file contains the magic number 42 as some identifier, the
Node Exporter should expose it as it is and not keep a mapping in code to make
this human readable. Instead, the textfile collector can be used to add a static
metric which can be joined with the metrics exposed by the exporter to get human
readable identifier.
A Collector may only read `/proc` or `/sys` files, use system calls or local
sockets to retrieve metrics. It may not require root privileges. Running
external commands is not allowed for performance and reliability reasons. Use a
dedicated exporter instead or gather the metrics via the textfile collector.
The Node Exporter tries to support the most common machine metrics. For more
exotic metrics, use the textfile collector or a dedicated Exporter.
================================================
FILE: Dockerfile
================================================
ARG ARCH="amd64"
ARG OS="linux"
FROM quay.io/prometheus/busybox-${OS}-${ARCH}:latest
LABEL maintainer="The Prometheus Authors <prometheus-developers@googlegroups.com>"
ARG ARCH="amd64"
ARG OS="linux"
COPY .build/${OS}-${ARCH}/node_exporter /bin/node_exporter
EXPOSE 9100
USER nobody
ENTRYPOINT [ "/bin/node_exporter" ]
================================================
FILE: LICENSE
================================================
Apache License
Version 2.0, January 2004
http://www.apache.org/licenses/
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
1. Definitions.
"License" shall mean the terms and conditions for use, reproduction,
and distribution as defined by Sections 1 through 9 of this document.
"Licensor" shall mean the copyright owner or entity authorized by
the copyright owner that is granting the License.
"Legal Entity" shall mean the union of the acting entity and all
other entities that control, are controlled by, or are under common
control with that entity. For the purposes of this definition,
"control" means (i) the power, direct or indirect, to cause the
direction or management of such entity, whether by contract or
otherwise, or (ii) ownership of fifty percent (50%) or more of the
outstanding shares, or (iii) beneficial ownership of such entity.
"You" (or "Your") shall mean an individual or Legal Entity
exercising permissions granted by this License.
"Source" form shall mean the preferred form for making modifications,
including but not limited to software source code, documentation
source, and configuration files.
"Object" form shall mean any form resulting from mechanical
transformation or translation of a Source form, including but
not limited to compiled object code, generated documentation,
and conversions to other media types.
"Work" shall mean the work of authorship, whether in Source or
Object form, made available under the License, as indicated by a
copyright notice that is included in or attached to the work
(an example is provided in the Appendix below).
"Derivative Works" shall mean any work, whether in Source or Object
form, that is based on (or derived from) the Work and for which the
editorial revisions, annotations, elaborations, or other modifications
represent, as a whole, an original work of authorship. For the purposes
of this License, Derivative Works shall not include works that remain
separable from, or merely link (or bind by name) to the interfaces of,
the Work and Derivative Works thereof.
"Contribution" shall mean any work of authorship, including
the original version of the Work and any modifications or additions
to that Work or Derivative Works thereof, that is intentionally
submitted to Licensor for inclusion in the Work by the copyright owner
or by an individual or Legal Entity authorized to submit on behalf of
the copyright owner. For the purposes of this definition, "submitted"
means any form of electronic, verbal, or written communication sent
to the Licensor or its representatives, including but not limited to
communication on electronic mailing lists, source code control systems,
and issue tracking systems that are managed by, or on behalf of, the
Licensor for the purpose of discussing and improving the Work, but
excluding communication that is conspicuously marked or otherwise
designated in writing by the copyright owner as "Not a Contribution."
"Contributor" shall mean Licensor and any individual or Legal Entity
on behalf of whom a Contribution has been received by Licensor and
subsequently incorporated within the Work.
2. Grant of Copyright License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
copyright license to reproduce, prepare Derivative Works of,
publicly display, publicly perform, sublicense, and distribute the
Work and such Derivative Works in Source or Object form.
3. Grant of Patent License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
(except as stated in this section) patent license to make, have made,
use, offer to sell, sell, import, and otherwise transfer the Work,
where such license applies only to those patent claims licensable
by such Contributor that are necessarily infringed by their
Contribution(s) alone or by combination of their Contribution(s)
with the Work to which such Contribution(s) was submitted. If You
institute patent litigation against any entity (including a
cross-claim or counterclaim in a lawsuit) alleging that the Work
or a Contribution incorporated within the Work constitutes direct
or contributory patent infringement, then any patent licenses
granted to You under this License for that Work shall terminate
as of the date such litigation is filed.
4. Redistribution. You may reproduce and distribute copies of the
Work or Derivative Works thereof in any medium, with or without
modifications, and in Source or Object form, provided that You
meet the following conditions:
(a) You must give any other recipients of the Work or
Derivative Works a copy of this License; and
(b) You must cause any modified files to carry prominent notices
stating that You changed the files; and
(c) You must retain, in the Source form of any Derivative Works
that You distribute, all copyright, patent, trademark, and
attribution notices from the Source form of the Work,
excluding those notices that do not pertain to any part of
the Derivative Works; and
(d) If the Work includes a "NOTICE" text file as part of its
distribution, then any Derivative Works that You distribute must
include a readable copy of the attribution notices contained
within such NOTICE file, excluding those notices that do not
pertain to any part of the Derivative Works, in at least one
of the following places: within a NOTICE text file distributed
as part of the Derivative Works; within the Source form or
documentation, if provided along with the Derivative Works; or,
within a display generated by the Derivative Works, if and
wherever such third-party notices normally appear. The contents
of the NOTICE file are for informational purposes only and
do not modify the License. You may add Your own attribution
notices within Derivative Works that You distribute, alongside
or as an addendum to the NOTICE text from the Work, provided
that such additional attribution notices cannot be construed
as modifying the License.
You may add Your own copyright statement to Your modifications and
may provide additional or different license terms and conditions
for use, reproduction, or distribution of Your modifications, or
for any such Derivative Works as a whole, provided Your use,
reproduction, and distribution of the Work otherwise complies with
the conditions stated in this License.
5. Submission of Contributions. Unless You explicitly state otherwise,
any Contribution intentionally submitted for inclusion in the Work
by You to the Licensor shall be under the terms and conditions of
this License, without any additional terms or conditions.
Notwithstanding the above, nothing herein shall supersede or modify
the terms of any separate license agreement you may have executed
with Licensor regarding such Contributions.
6. Trademarks. This License does not grant permission to use the trade
names, trademarks, service marks, or product names of the Licensor,
except as required for reasonable and customary use in describing the
origin of the Work and reproducing the content of the NOTICE file.
7. Disclaimer of Warranty. Unless required by applicable law or
agreed to in writing, Licensor provides the Work (and each
Contributor provides its Contributions) on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
implied, including, without limitation, any warranties or conditions
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
PARTICULAR PURPOSE. You are solely responsible for determining the
appropriateness of using or redistributing the Work and assume any
risks associated with Your exercise of permissions under this License.
8. Limitation of Liability. In no event and under no legal theory,
whether in tort (including negligence), contract, or otherwise,
unless required by applicable law (such as deliberate and grossly
negligent acts) or agreed to in writing, shall any Contributor be
liable to You for damages, including any direct, indirect, special,
incidental, or consequential damages of any character arising as a
result of this License or out of the use or inability to use the
Work (including but not limited to damages for loss of goodwill,
work stoppage, computer failure or malfunction, or any and all
other commercial damages or losses), even if such Contributor
has been advised of the possibility of such damages.
9. Accepting Warranty or Additional Liability. While redistributing
the Work or Derivative Works thereof, You may choose to offer,
and charge a fee for, acceptance of support, warranty, indemnity,
or other liability obligations and/or rights consistent with this
License. However, in accepting such obligations, You may act only
on Your own behalf and on Your sole responsibility, not on behalf
of any other Contributor, and only if You agree to indemnify,
defend, and hold each Contributor harmless for any liability
incurred by, or claims asserted against, such Contributor by reason
of your accepting any such warranty or additional liability.
END OF TERMS AND CONDITIONS
APPENDIX: How to apply the Apache License to your work.
To apply the Apache License to your work, attach the following
boilerplate notice, with the fields enclosed by brackets "[]"
replaced with your own identifying information. (Don't include
the brackets!) The text should be enclosed in the appropriate
comment syntax for the file format. We also recommend that a
file or class name and description of purpose be included on the
same "printed page" as the copyright notice for easier
identification within third-party archives.
Copyright [yyyy] [name of copyright owner]
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
================================================
FILE: MAINTAINERS.md
================================================
* Ben Kochie <superq@gmail.com> @SuperQ
* Johannes 'fish' Ziemke <github@freigeist.org> @discordianfish
================================================
FILE: Makefile
================================================
# Copyright 2015 The Prometheus Authors
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# Ensure that 'all' is the default target otherwise it will be the first target from Makefile.common.
all::
# Needs to be defined before including Makefile.common to auto-generate targets
DOCKER_ARCHS ?= amd64 armv7 arm64 ppc64le s390x
include Makefile.common
PROMTOOL_VERSION ?= 2.30.0
PROMTOOL_URL ?= https://github.com/prometheus/prometheus/releases/download/v$(PROMTOOL_VERSION)/prometheus-$(PROMTOOL_VERSION).$(GO_BUILD_PLATFORM).tar.gz
PROMTOOL ?= $(FIRST_GOPATH)/bin/promtool
E2E_EXTRA_FLAGS ?=
DOCKER_IMAGE_NAME ?= node-exporter
MACH ?= $(shell uname -m)
STATICCHECK_IGNORE =
ifeq ($(GOHOSTOS), linux)
test-e2e := test-e2e
else
test-e2e := skip-test-e2e
endif
# Use CGO for non-Linux builds.
ifeq ($(GOOS), linux)
PROMU_CONF ?= .promu.yml
else
ifndef GOOS
ifeq ($(GOHOSTOS), linux)
PROMU_CONF ?= .promu.yml
else
PROMU_CONF ?= .promu-cgo.yml
endif
else
# Do not use CGO for openbsd/amd64 builds
ifeq ($(GOOS), openbsd)
ifeq ($(GOARCH), amd64)
PROMU_CONF ?= .promu.yml
else
PROMU_CONF ?= .promu-cgo.yml
endif
else
PROMU_CONF ?= .promu-cgo.yml
endif
endif
endif
PROMU := $(FIRST_GOPATH)/bin/promu --config $(PROMU_CONF)
e2e-out-64k-page = collector/fixtures/e2e-64k-page-output.txt
e2e-out = collector/fixtures/e2e-output.txt
ifeq ($(MACH), ppc64le)
e2e-out = $(e2e-out-64k-page)
endif
ifeq ($(MACH), aarch64)
e2e-out = $(e2e-out-64k-page)
endif
# 64bit -> 32bit mapping for cross-checking. At least for amd64/386, the 64bit CPU can execute 32bit code but not the other way around, so we don't support cross-testing upwards.
cross-test = skip-test-32bit
define goarch_pair
ifeq ($$(GOHOSTOS),linux)
ifeq ($$(GOHOSTARCH),$1)
GOARCH_CROSS = $2
cross-test = test-32bit
endif
endif
endef
# By default, "cross" test with ourselves to cover unknown pairings.
$(eval $(call goarch_pair,amd64,386))
$(eval $(call goarch_pair,mips64,mips))
$(eval $(call goarch_pair,mips64el,mipsel))
all:: vet checkmetrics checkrules common-all $(cross-test) $(test-e2e)
.PHONY: test
test: collector/fixtures/sys/.unpacked collector/fixtures/udev/.unpacked
@echo ">> running tests"
$(GO) test -short $(test-flags) $(pkgs)
.PHONY: test-32bit
test-32bit: collector/fixtures/sys/.unpacked collector/fixtures/udev/.unpacked
@echo ">> running tests in 32-bit mode"
@env GOARCH=$(GOARCH_CROSS) $(GO) test $(pkgs)
.PHONY: skip-test-32bit
skip-test-32bit:
@echo ">> SKIP running tests in 32-bit mode: not supported on $(GOHOSTOS)/$(GOHOSTARCH)"
%/.unpacked: %.ttar
@echo ">> extracting fixtures"
if [ -d $(dir $@) ] ; then rm -rf $(dir $@) ; fi
./ttar -C $(dir $*) -x -f $*.ttar
touch $@
update_fixtures:
rm -vf collector/fixtures/sys/.unpacked
./ttar -C collector/fixtures -c -f collector/fixtures/sys.ttar sys
rm -vf collector/fixtures/udev/.unpacked
./ttar -C collector/fixtures -c -f collector/fixtures/udev.ttar udev
.PHONY: tools
tools:
@rm ./tools/tools >/dev/null 2>&1 || true
@$(GO) build -o tools ./tools/...
.PHONY: test-e2e
test-e2e: build collector/fixtures/sys/.unpacked collector/fixtures/udev/.unpacked tools
@echo ">> running end-to-end tests"
./end-to-end-test.sh -e "$(E2E_EXTRA_FLAGS)"
.PHONY: skip-test-e2e
skip-test-e2e:
@echo ">> SKIP running end-to-end tests on $(GOHOSTOS)"
.PHONY: checkmetrics
checkmetrics: $(PROMTOOL)
@echo ">> checking metrics for correctness"
./checkmetrics.sh $(PROMTOOL) $(e2e-out)
./checkmetrics.sh $(PROMTOOL) $(e2e-out-64k-page)
.PHONY: checkrules
checkrules: $(PROMTOOL)
@echo ">> checking rules for correctness"
find . -name "*rules*.yml" | xargs -I {} $(PROMTOOL) check rules {}
.PHONY: test-docker
test-docker:
@echo ">> testing docker image"
./test_image.sh "$(DOCKER_REPO)/$(DOCKER_IMAGE_NAME)-linux-amd64:$(DOCKER_IMAGE_TAG)" 9100
.PHONY: promtool
promtool: $(PROMTOOL)
$(PROMTOOL):
mkdir -p $(FIRST_GOPATH)/bin
curl -fsS -L $(PROMTOOL_URL) | tar -xvzf - -C $(FIRST_GOPATH)/bin --strip 1 "prometheus-$(PROMTOOL_VERSION).$(GO_BUILD_PLATFORM)/promtool"
================================================
FILE: Makefile.common
================================================
# Copyright The Prometheus Authors
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# A common Makefile that includes rules to be reused in different prometheus projects.
# !!! Open PRs only against the prometheus/prometheus/Makefile.common repository!
# Example usage :
# Create the main Makefile in the root project directory.
# include Makefile.common
# customTarget:
# @echo ">> Running customTarget"
#
# Ensure GOBIN is not set during build so that promu is installed to the correct path
unexport GOBIN
GO ?= go
GOFMT ?= $(GO)fmt
FIRST_GOPATH := $(firstword $(subst :, ,$(shell $(GO) env GOPATH)))
GOOPTS ?=
GOHOSTOS ?= $(shell $(GO) env GOHOSTOS)
GOHOSTARCH ?= $(shell $(GO) env GOHOSTARCH)
GO_VERSION ?= $(shell $(GO) version)
GO_VERSION_NUMBER ?= $(word 3, $(GO_VERSION))
PRE_GO_111 ?= $(shell echo $(GO_VERSION_NUMBER) | grep -E 'go1\.(10|[0-9])\.')
PROMU := $(FIRST_GOPATH)/bin/promu
pkgs = ./...
ifeq (arm, $(GOHOSTARCH))
GOHOSTARM ?= $(shell GOARM= $(GO) env GOARM)
GO_BUILD_PLATFORM ?= $(GOHOSTOS)-$(GOHOSTARCH)v$(GOHOSTARM)
else
GO_BUILD_PLATFORM ?= $(GOHOSTOS)-$(GOHOSTARCH)
endif
GOTEST := $(GO) test
GOTEST_DIR :=
ifneq ($(CIRCLE_JOB),)
ifneq ($(shell command -v gotestsum 2> /dev/null),)
GOTEST_DIR := test-results
GOTEST := gotestsum --junitfile $(GOTEST_DIR)/unit-tests.xml --
endif
endif
PROMU_VERSION ?= 0.18.0
PROMU_URL := https://github.com/prometheus/promu/releases/download/v$(PROMU_VERSION)/promu-$(PROMU_VERSION).$(GO_BUILD_PLATFORM).tar.gz
SKIP_GOLANGCI_LINT :=
GOLANGCI_LINT :=
GOLANGCI_LINT_OPTS ?=
GOLANGCI_LINT_VERSION ?= v2.10.1
GOLANGCI_FMT_OPTS ?=
# golangci-lint only supports linux, darwin and windows platforms on i386/amd64/arm64.
# windows isn't included here because of the path separator being different.
ifeq ($(GOHOSTOS),$(filter $(GOHOSTOS),linux darwin))
ifeq ($(GOHOSTARCH),$(filter $(GOHOSTARCH),amd64 i386 arm64))
# If we're in CI and there is an Actions file, that means the linter
# is being run in Actions, so we don't need to run it here.
ifneq (,$(SKIP_GOLANGCI_LINT))
GOLANGCI_LINT :=
else ifeq (,$(CIRCLE_JOB))
GOLANGCI_LINT := $(FIRST_GOPATH)/bin/golangci-lint
else ifeq (,$(wildcard .github/workflows/golangci-lint.yml))
GOLANGCI_LINT := $(FIRST_GOPATH)/bin/golangci-lint
endif
endif
endif
PREFIX ?= $(shell pwd)
BIN_DIR ?= $(shell pwd)
DOCKER_IMAGE_TAG ?= $(subst /,-,$(shell git rev-parse --abbrev-ref HEAD))
DOCKERBUILD_CONTEXT ?= ./
DOCKER_REPO ?= prom
# Check if deprecated DOCKERFILE_PATH is set
ifdef DOCKERFILE_PATH
$(error DOCKERFILE_PATH is deprecated. Use DOCKERFILE_VARIANTS ?= $(DOCKERFILE_PATH) in the Makefile)
endif
DOCKER_ARCHS ?= amd64
DOCKERFILE_VARIANTS ?= Dockerfile $(wildcard Dockerfile.*)
# Function to extract variant from Dockerfile label.
# Returns the variant name from io.prometheus.image.variant label, or "default" if not found.
define dockerfile_variant
$(strip $(or $(shell sed -n 's/.*io\.prometheus\.image\.variant="\([^"]*\)".*/\1/p' $(1)),default))
endef
# Check for duplicate variant names (including default for Dockerfiles without labels).
DOCKERFILE_VARIANT_NAMES := $(foreach df,$(DOCKERFILE_VARIANTS),$(call dockerfile_variant,$(df)))
DOCKERFILE_VARIANT_NAMES_SORTED := $(sort $(DOCKERFILE_VARIANT_NAMES))
ifneq ($(words $(DOCKERFILE_VARIANT_NAMES)),$(words $(DOCKERFILE_VARIANT_NAMES_SORTED)))
$(error Duplicate variant names found. Each Dockerfile must have a unique io.prometheus.image.variant label, and only one can be without a label (default))
endif
# Build variant:dockerfile pairs for shell iteration.
DOCKERFILE_VARIANTS_WITH_NAMES := $(foreach df,$(DOCKERFILE_VARIANTS),$(call dockerfile_variant,$(df)):$(df))
# Shell helper to check whether a dockerfile/arch pair is excluded.
define dockerfile_arch_is_excluded
case " $(DOCKERFILE_ARCH_EXCLUSIONS) " in \
*" $$dockerfile:$(1) "*) true ;; \
*) false ;; \
esac
endef
# Shell helper to check whether a registry/arch pair is excluded.
# Extracts registry from DOCKER_REPO (e.g., quay.io/prometheus -> quay.io)
define registry_arch_is_excluded
registry=$$(echo "$(DOCKER_REPO)" | cut -d'/' -f1); \
case " $(DOCKER_REGISTRY_ARCH_EXCLUSIONS) " in \
*" $$registry:$(1) "*) true ;; \
*) false ;; \
esac
endef
BUILD_DOCKER_ARCHS = $(addprefix common-docker-,$(DOCKER_ARCHS))
PUBLISH_DOCKER_ARCHS = $(addprefix common-docker-publish-,$(DOCKER_ARCHS))
TAG_DOCKER_ARCHS = $(addprefix common-docker-tag-latest-,$(DOCKER_ARCHS))
SANITIZED_DOCKER_IMAGE_TAG := $(subst +,-,$(DOCKER_IMAGE_TAG))
ifeq ($(GOHOSTARCH),amd64)
ifeq ($(GOHOSTOS),$(filter $(GOHOSTOS),linux freebsd darwin windows))
# Only supported on amd64
test-flags := -race
endif
endif
# This rule is used to forward a target like "build" to "common-build". This
# allows a new "build" target to be defined in a Makefile which includes this
# one and override "common-build" without override warnings.
%: common-% ;
.PHONY: common-all
common-all: precheck style check_license lint yamllint unused build test
.PHONY: common-style
common-style:
@echo ">> checking code style"
@fmtRes=$$($(GOFMT) -d $$(git ls-files '*.go' ':!:vendor/*' || find . -path ./vendor -prune -o -name '*.go' -print)); \
if [ -n "$${fmtRes}" ]; then \
echo "gofmt checking failed!"; echo "$${fmtRes}"; echo; \
echo "Please ensure you are using $$($(GO) version) for formatting code."; \
exit 1; \
fi
.PHONY: common-check_license
common-check_license:
@echo ">> checking license header"
@licRes=$$(for file in $$(git ls-files '*.go' ':!:vendor/*' || find . -path ./vendor -prune -o -type f -iname '*.go' -print) ; do \
awk 'NR<=3' $$file | grep -Eq "(Copyright|generated|GENERATED)" || echo $$file; \
done); \
if [ -n "$${licRes}" ]; then \
echo "license header checking failed:"; echo "$${licRes}"; \
exit 1; \
fi
@echo ">> checking for copyright years 2026 or later"
@futureYearRes=$$(git grep -E 'Copyright (202[6-9]|20[3-9][0-9])' -- '*.go' ':!:vendor/*' || true); \
if [ -n "$${futureYearRes}" ]; then \
echo "Files with copyright year 2026 or later found (should use 'Copyright The Prometheus Authors'):"; echo "$${futureYearRes}"; \
exit 1; \
fi
.PHONY: common-deps
common-deps:
@echo ">> getting dependencies"
$(GO) mod download
.PHONY: update-go-deps
update-go-deps:
@echo ">> updating Go dependencies"
@for m in $$($(GO) list -mod=readonly -m -f '{{ if and (not .Indirect) (not .Main)}}{{.Path}}{{end}}' all); do \
$(GO) get $$m; \
done
$(GO) mod tidy
.PHONY: common-test-short
common-test-short: $(GOTEST_DIR)
@echo ">> running short tests"
$(GOTEST) -short $(GOOPTS) $(pkgs)
.PHONY: common-test
common-test: $(GOTEST_DIR)
@echo ">> running all tests"
$(GOTEST) $(test-flags) $(GOOPTS) $(pkgs)
$(GOTEST_DIR):
@mkdir -p $@
.PHONY: common-format
common-format: $(GOLANGCI_LINT)
@echo ">> formatting code"
$(GO) fmt $(pkgs)
ifdef GOLANGCI_LINT
@echo ">> formatting code with golangci-lint"
$(GOLANGCI_LINT) fmt $(GOLANGCI_FMT_OPTS)
endif
.PHONY: common-vet
common-vet:
@echo ">> vetting code"
$(GO) vet $(GOOPTS) $(pkgs)
.PHONY: common-lint
common-lint: $(GOLANGCI_LINT)
ifdef GOLANGCI_LINT
@echo ">> running golangci-lint"
$(GOLANGCI_LINT) run $(GOLANGCI_LINT_OPTS) $(pkgs)
endif
.PHONY: common-lint-fix
common-lint-fix: $(GOLANGCI_LINT)
ifdef GOLANGCI_LINT
@echo ">> running golangci-lint fix"
$(GOLANGCI_LINT) run --fix $(GOLANGCI_LINT_OPTS) $(pkgs)
endif
.PHONY: common-yamllint
common-yamllint:
@echo ">> running yamllint on all YAML files in the repository"
ifeq (, $(shell command -v yamllint 2> /dev/null))
@echo "yamllint not installed so skipping"
else
yamllint .
endif
# For backward-compatibility.
.PHONY: common-staticcheck
common-staticcheck: lint
.PHONY: common-unused
common-unused:
@echo ">> running check for unused/missing packages in go.mod"
$(GO) mod tidy
@git diff --exit-code -- go.sum go.mod
.PHONY: common-build
common-build: promu
@echo ">> building binaries"
$(PROMU) build --prefix $(PREFIX) $(PROMU_BINARIES)
.PHONY: common-tarball
common-tarball: promu
@echo ">> building release tarball"
$(PROMU) tarball --prefix $(PREFIX) $(BIN_DIR)
.PHONY: common-docker-repo-name
common-docker-repo-name:
@echo "$(DOCKER_REPO)/$(DOCKER_IMAGE_NAME)"
.PHONY: common-docker $(BUILD_DOCKER_ARCHS)
common-docker: $(BUILD_DOCKER_ARCHS)
$(BUILD_DOCKER_ARCHS): common-docker-%:
@for variant in $(DOCKERFILE_VARIANTS_WITH_NAMES); do \
dockerfile=$${variant#*:}; \
variant_name=$${variant%%:*}; \
if $(call dockerfile_arch_is_excluded,$*); then \
echo "Skipping $$variant_name variant for linux-$* (excluded by DOCKERFILE_ARCH_EXCLUSIONS)"; \
continue; \
fi; \
distroless_arch="$*"; \
if [ "$*" = "armv7" ]; then \
distroless_arch="arm"; \
fi; \
if [ "$$dockerfile" = "Dockerfile" ]; then \
echo "Building default variant ($$variant_name) for linux-$* using $$dockerfile"; \
docker build -t "$(DOCKER_REPO)/$(DOCKER_IMAGE_NAME)-linux-$*:$(SANITIZED_DOCKER_IMAGE_TAG)" \
-f $$dockerfile \
--build-arg ARCH="$*" \
--build-arg OS="linux" \
--build-arg DISTROLESS_ARCH="$$distroless_arch" \
$(DOCKERBUILD_CONTEXT); \
if [ "$$variant_name" != "default" ]; then \
echo "Tagging default variant with $$variant_name suffix"; \
docker tag "$(DOCKER_REPO)/$(DOCKER_IMAGE_NAME)-linux-$*:$(SANITIZED_DOCKER_IMAGE_TAG)" \
"$(DOCKER_REPO)/$(DOCKER_IMAGE_NAME)-linux-$*:$(SANITIZED_DOCKER_IMAGE_TAG)-$$variant_name"; \
fi; \
else \
echo "Building $$variant_name variant for linux-$* using $$dockerfile"; \
docker build -t "$(DOCKER_REPO)/$(DOCKER_IMAGE_NAME)-linux-$*:$(SANITIZED_DOCKER_IMAGE_TAG)-$$variant_name" \
-f $$dockerfile \
--build-arg ARCH="$*" \
--build-arg OS="linux" \
--build-arg DISTROLESS_ARCH="$$distroless_arch" \
$(DOCKERBUILD_CONTEXT); \
fi; \
done
.PHONY: common-docker-publish $(PUBLISH_DOCKER_ARCHS)
common-docker-publish: $(PUBLISH_DOCKER_ARCHS)
$(PUBLISH_DOCKER_ARCHS): common-docker-publish-%:
@for variant in $(DOCKERFILE_VARIANTS_WITH_NAMES); do \
dockerfile=$${variant#*:}; \
variant_name=$${variant%%:*}; \
if $(call dockerfile_arch_is_excluded,$*); then \
echo "Skipping push for $$variant_name variant on linux-$* (excluded by DOCKERFILE_ARCH_EXCLUSIONS)"; \
continue; \
fi; \
if $(call registry_arch_is_excluded,$*); then \
echo "Skipping push for $$variant_name variant on linux-$* to $(DOCKER_REPO) (excluded by DOCKER_REGISTRY_ARCH_EXCLUSIONS)"; \
continue; \
fi; \
if [ "$$dockerfile" != "Dockerfile" ] || [ "$$variant_name" != "default" ]; then \
echo "Pushing $$variant_name variant for linux-$*"; \
docker push "$(DOCKER_REPO)/$(DOCKER_IMAGE_NAME)-linux-$*:$(SANITIZED_DOCKER_IMAGE_TAG)-$$variant_name"; \
fi; \
if [ "$$dockerfile" = "Dockerfile" ]; then \
echo "Pushing default variant ($$variant_name) for linux-$*"; \
docker push "$(DOCKER_REPO)/$(DOCKER_IMAGE_NAME)-linux-$*:$(SANITIZED_DOCKER_IMAGE_TAG)"; \
fi; \
if [ "$(DOCKER_IMAGE_TAG)" = "latest" ]; then \
if [ "$$dockerfile" != "Dockerfile" ] || [ "$$variant_name" != "default" ]; then \
echo "Pushing $$variant_name variant version tags for linux-$*"; \
docker push "$(DOCKER_REPO)/$(DOCKER_IMAGE_NAME)-linux-$*:v$(DOCKER_MAJOR_VERSION_TAG)-$$variant_name"; \
fi; \
if [ "$$dockerfile" = "Dockerfile" ]; then \
echo "Pushing default variant version tag for linux-$*"; \
docker push "$(DOCKER_REPO)/$(DOCKER_IMAGE_NAME)-linux-$*:v$(DOCKER_MAJOR_VERSION_TAG)"; \
fi; \
fi; \
done
DOCKER_MAJOR_VERSION_TAG = $(firstword $(subst ., ,$(shell cat VERSION)))
.PHONY: common-docker-tag-latest $(TAG_DOCKER_ARCHS)
common-docker-tag-latest: $(TAG_DOCKER_ARCHS)
$(TAG_DOCKER_ARCHS): common-docker-tag-latest-%:
@for variant in $(DOCKERFILE_VARIANTS_WITH_NAMES); do \
dockerfile=$${variant#*:}; \
variant_name=$${variant%%:*}; \
if $(call dockerfile_arch_is_excluded,$*); then \
echo "Skipping tag for $$variant_name variant on linux-$* (excluded by DOCKERFILE_ARCH_EXCLUSIONS)"; \
continue; \
fi; \
if $(call registry_arch_is_excluded,$*); then \
echo "Skipping tag for $$variant_name variant on linux-$* for $(DOCKER_REPO) (excluded by DOCKER_REGISTRY_ARCH_EXCLUSIONS)"; \
continue; \
fi; \
if [ "$$dockerfile" != "Dockerfile" ] || [ "$$variant_name" != "default" ]; then \
echo "Tagging $$variant_name variant for linux-$* as latest"; \
docker tag "$(DOCKER_REPO)/$(DOCKER_IMAGE_NAME)-linux-$*:$(SANITIZED_DOCKER_IMAGE_TAG)-$$variant_name" "$(DOCKER_REPO)/$(DOCKER_IMAGE_NAME)-linux-$*:latest-$$variant_name"; \
docker tag "$(DOCKER_REPO)/$(DOCKER_IMAGE_NAME)-linux-$*:$(SANITIZED_DOCKER_IMAGE_TAG)-$$variant_name" "$(DOCKER_REPO)/$(DOCKER_IMAGE_NAME)-linux-$*:v$(DOCKER_MAJOR_VERSION_TAG)-$$variant_name"; \
fi; \
if [ "$$dockerfile" = "Dockerfile" ]; then \
echo "Tagging default variant ($$variant_name) for linux-$* as latest"; \
docker tag "$(DOCKER_REPO)/$(DOCKER_IMAGE_NAME)-linux-$*:$(SANITIZED_DOCKER_IMAGE_TAG)" "$(DOCKER_REPO)/$(DOCKER_IMAGE_NAME)-linux-$*:latest"; \
docker tag "$(DOCKER_REPO)/$(DOCKER_IMAGE_NAME)-linux-$*:$(SANITIZED_DOCKER_IMAGE_TAG)" "$(DOCKER_REPO)/$(DOCKER_IMAGE_NAME)-linux-$*:v$(DOCKER_MAJOR_VERSION_TAG)"; \
fi; \
done
.PHONY: common-docker-manifest
common-docker-manifest:
@for variant in $(DOCKERFILE_VARIANTS_WITH_NAMES); do \
dockerfile=$${variant#*:}; \
variant_name=$${variant%%:*}; \
if [ "$$dockerfile" != "Dockerfile" ] || [ "$$variant_name" != "default" ]; then \
echo "Creating manifest for $$variant_name variant"; \
refs=""; \
for arch in $(DOCKER_ARCHS); do \
if $(call dockerfile_arch_is_excluded,$$arch); then \
echo " Skipping $$arch for $$variant_name (excluded by DOCKERFILE_ARCH_EXCLUSIONS)"; \
continue; \
fi; \
if $(call registry_arch_is_excluded,$$arch); then \
echo " Skipping $$arch for $$variant_name on $(DOCKER_REPO) (excluded by DOCKER_REGISTRY_ARCH_EXCLUSIONS)"; \
continue; \
fi; \
refs="$$refs $(DOCKER_REPO)/$(DOCKER_IMAGE_NAME)-linux-$$arch:$(SANITIZED_DOCKER_IMAGE_TAG)-$$variant_name"; \
done; \
if [ -z "$$refs" ]; then \
echo "Skipping manifest for $$variant_name variant (no supported architectures)"; \
continue; \
fi; \
DOCKER_CLI_EXPERIMENTAL=enabled docker manifest create -a "$(DOCKER_REPO)/$(DOCKER_IMAGE_NAME):$(SANITIZED_DOCKER_IMAGE_TAG)-$$variant_name" $$refs; \
DOCKER_CLI_EXPERIMENTAL=enabled docker manifest push "$(DOCKER_REPO)/$(DOCKER_IMAGE_NAME):$(SANITIZED_DOCKER_IMAGE_TAG)-$$variant_name"; \
fi; \
if [ "$$dockerfile" = "Dockerfile" ]; then \
echo "Creating default variant ($$variant_name) manifest"; \
refs=""; \
for arch in $(DOCKER_ARCHS); do \
if $(call dockerfile_arch_is_excluded,$$arch); then \
echo " Skipping $$arch for default variant (excluded by DOCKERFILE_ARCH_EXCLUSIONS)"; \
continue; \
fi; \
if $(call registry_arch_is_excluded,$$arch); then \
echo " Skipping $$arch for default variant on $(DOCKER_REPO) (excluded by DOCKER_REGISTRY_ARCH_EXCLUSIONS)"; \
continue; \
fi; \
refs="$$refs $(DOCKER_REPO)/$(DOCKER_IMAGE_NAME)-linux-$$arch:$(SANITIZED_DOCKER_IMAGE_TAG)"; \
done; \
if [ -z "$$refs" ]; then \
echo "Skipping default variant manifest (no supported architectures)"; \
continue; \
fi; \
DOCKER_CLI_EXPERIMENTAL=enabled docker manifest create -a "$(DOCKER_REPO)/$(DOCKER_IMAGE_NAME):$(SANITIZED_DOCKER_IMAGE_TAG)" $$refs; \
DOCKER_CLI_EXPERIMENTAL=enabled docker manifest push "$(DOCKER_REPO)/$(DOCKER_IMAGE_NAME):$(SANITIZED_DOCKER_IMAGE_TAG)"; \
fi; \
if [ "$(DOCKER_IMAGE_TAG)" = "latest" ]; then \
if [ "$$dockerfile" != "Dockerfile" ] || [ "$$variant_name" != "default" ]; then \
echo "Creating manifest for $$variant_name variant version tag"; \
refs=""; \
for arch in $(DOCKER_ARCHS); do \
if $(call dockerfile_arch_is_excluded,$$arch); then \
echo " Skipping $$arch for $$variant_name version tag (excluded by DOCKERFILE_ARCH_EXCLUSIONS)"; \
continue; \
fi; \
if $(call registry_arch_is_excluded,$$arch); then \
echo " Skipping $$arch for $$variant_name version tag on $(DOCKER_REPO) (excluded by DOCKER_REGISTRY_ARCH_EXCLUSIONS)"; \
continue; \
fi; \
refs="$$refs $(DOCKER_REPO)/$(DOCKER_IMAGE_NAME)-linux-$$arch:v$(DOCKER_MAJOR_VERSION_TAG)-$$variant_name"; \
done; \
if [ -z "$$refs" ]; then \
echo "Skipping version-tag manifest for $$variant_name variant (no supported architectures)"; \
continue; \
fi; \
DOCKER_CLI_EXPERIMENTAL=enabled docker manifest create -a "$(DOCKER_REPO)/$(DOCKER_IMAGE_NAME):v$(DOCKER_MAJOR_VERSION_TAG)-$$variant_name" $$refs; \
DOCKER_CLI_EXPERIMENTAL=enabled docker manifest push "$(DOCKER_REPO)/$(DOCKER_IMAGE_NAME):v$(DOCKER_MAJOR_VERSION_TAG)-$$variant_name"; \
fi; \
if [ "$$dockerfile" = "Dockerfile" ]; then \
echo "Creating default variant version tag manifest"; \
refs=""; \
for arch in $(DOCKER_ARCHS); do \
if $(call dockerfile_arch_is_excluded,$$arch); then \
echo " Skipping $$arch for default variant version tag (excluded by DOCKERFILE_ARCH_EXCLUSIONS)"; \
continue; \
fi; \
if $(call registry_arch_is_excluded,$$arch); then \
echo " Skipping $$arch for default variant version tag on $(DOCKER_REPO) (excluded by DOCKER_REGISTRY_ARCH_EXCLUSIONS)"; \
continue; \
fi; \
refs="$$refs $(DOCKER_REPO)/$(DOCKER_IMAGE_NAME)-linux-$$arch:v$(DOCKER_MAJOR_VERSION_TAG)"; \
done; \
if [ -z "$$refs" ]; then \
echo "Skipping default variant version-tag manifest (no supported architectures)"; \
continue; \
fi; \
DOCKER_CLI_EXPERIMENTAL=enabled docker manifest create -a "$(DOCKER_REPO)/$(DOCKER_IMAGE_NAME):v$(DOCKER_MAJOR_VERSION_TAG)" $$refs; \
DOCKER_CLI_EXPERIMENTAL=enabled docker manifest push "$(DOCKER_REPO)/$(DOCKER_IMAGE_NAME):v$(DOCKER_MAJOR_VERSION_TAG)"; \
fi; \
fi; \
done
.PHONY: promu
promu: $(PROMU)
$(PROMU):
$(eval PROMU_TMP := $(shell mktemp -d))
curl -s -L $(PROMU_URL) | tar -xvzf - -C $(PROMU_TMP)
mkdir -p $(FIRST_GOPATH)/bin
cp $(PROMU_TMP)/promu-$(PROMU_VERSION).$(GO_BUILD_PLATFORM)/promu $(FIRST_GOPATH)/bin/promu
rm -r $(PROMU_TMP)
.PHONY: common-proto
common-proto:
@echo ">> generating code from proto files"
@./scripts/genproto.sh
ifdef GOLANGCI_LINT
$(GOLANGCI_LINT):
mkdir -p $(FIRST_GOPATH)/bin
curl -sfL https://raw.githubusercontent.com/golangci/golangci-lint/$(GOLANGCI_LINT_VERSION)/install.sh \
| sed -e '/install -d/d' \
| sh -s -- -b $(FIRST_GOPATH)/bin $(GOLANGCI_LINT_VERSION)
endif
.PHONY: common-print-golangci-lint-version
common-print-golangci-lint-version:
@echo $(GOLANGCI_LINT_VERSION)
.PHONY: precheck
precheck::
define PRECHECK_COMMAND_template =
precheck:: $(1)_precheck
PRECHECK_COMMAND_$(1) ?= $(1) $$(strip $$(PRECHECK_OPTIONS_$(1)))
.PHONY: $(1)_precheck
$(1)_precheck:
@if ! $$(PRECHECK_COMMAND_$(1)) 1>/dev/null 2>&1; then \
echo "Execution of '$$(PRECHECK_COMMAND_$(1))' command failed. Is $(1) installed?"; \
exit 1; \
fi
endef
govulncheck: install-govulncheck
govulncheck ./...
install-govulncheck:
command -v govulncheck > /dev/null || go install golang.org/x/vuln/cmd/govulncheck@latest
================================================
FILE: NOTICE
================================================
Configurable modular Prometheus exporter for various node metrics.
Copyright 2013-2015 The Prometheus Authors
This product includes software developed at
SoundCloud Ltd. (http://soundcloud.com/).
The following components are included in this product:
wifi
https://github.com/mdlayher/wifi
Copyright 2016-2017 Matt Layher
Licensed under the MIT License
netlink
https://github.com/mdlayher/netlink
Copyright 2016-2017 Matt Layher
Licensed under the MIT License
================================================
FILE: README.md
================================================
# Node exporter
[][circleci]


[][quay]
[][hub]
[][goreportcard]
Prometheus exporter for hardware and OS metrics exposed by \*NIX kernels, written
in Go with pluggable metric collectors.
The [Windows exporter](https://github.com/prometheus-community/windows_exporter) is recommended for Windows users.
To expose NVIDIA GPU metrics, [prometheus-dcgm
](https://github.com/NVIDIA/dcgm-exporter)
can be used.
## Installation and Usage
If you are new to Prometheus and `node_exporter` there is a [simple step-by-step guide](https://prometheus.io/docs/guides/node-exporter/).
The `node_exporter` listens on HTTP port 9100 by default. See the `--help` output for more options.
### Ansible
For automated installs with [Ansible](https://www.ansible.com/), there is the [Prometheus Community role](https://github.com/prometheus-community/ansible).
### Docker
The `node_exporter` is designed to monitor the host system. Deploying in containers requires
extra care in order to avoid monitoring the container itself.
For situations where containerized deployment is needed, some extra flags must be used to allow
the `node_exporter` access to the host namespaces.
Be aware that any non-root mount points you want to monitor will need to be bind-mounted
into the container.
If you start container for host monitoring, specify `path.rootfs` argument.
This argument must match path in bind-mount of host root. The node\_exporter will use
`path.rootfs` as prefix to access host filesystem.
```bash
docker run -d \
--net="host" \
--pid="host" \
-v "/:/host:ro,rslave" \
quay.io/prometheus/node-exporter:latest \
--path.rootfs=/host
```
For Docker compose, similar flag changes are needed.
```yaml
---
version: '3.8'
services:
node_exporter:
image: quay.io/prometheus/node-exporter:latest
container_name: node_exporter
command:
- '--path.rootfs=/host'
network_mode: host
pid: host
restart: unless-stopped
volumes:
- '/:/host:ro,rslave'
```
On some systems, the `timex` collector requires an additional Docker flag,
`--cap-add=SYS_TIME`, in order to access the required syscalls.
## Collectors
There is varying support for collectors on each operating system. The tables
below list all existing collectors and the supported systems.
Collectors are enabled by providing a `--collector.<name>` flag.
Collectors that are enabled by default can be disabled by providing a `--no-collector.<name>` flag.
To enable only some specific collector(s), use `--collector.disable-defaults --collector.<name> ...`.
### Include & Exclude flags
A few collectors can be configured to include or exclude certain patterns using dedicated flags. The exclude flags are used to indicate "all except", while the include flags are used to say "none except". Note that these flags are mutually exclusive on collectors that support both.
Example:
```txt
--collector.filesystem.mount-points-exclude=^/(dev|proc|sys|var/lib/docker/.+|var/lib/kubelet/.+)($|/)
```
List:
Collector | Scope | Include Flag | Exclude Flag
--- | --- | --- | ---
arp | device | --collector.arp.device-include | --collector.arp.device-exclude
cpu | bugs | --collector.cpu.info.bugs-include | N/A
cpu | flags | --collector.cpu.info.flags-include | N/A
diskstats | device | --collector.diskstats.device-include | --collector.diskstats.device-exclude
ethtool | device | --collector.ethtool.device-include | --collector.ethtool.device-exclude
ethtool | metrics | --collector.ethtool.metrics-include | N/A
filesystem | fs-types | --collector.filesystem.fs-types-include | --collector.filesystem.fs-types-exclude
filesystem | mount-points | --collector.filesystem.mount-points-include | --collector.filesystem.mount-points-exclude
hwmon | chip | --collector.hwmon.chip-include | --collector.hwmon.chip-exclude
hwmon | sensor | --collector.hwmon.sensor-include | --collector.hwmon.sensor-exclude
interrupts | name | --collector.interrupts.name-include | --collector.interrupts.name-exclude
netdev | device | --collector.netdev.device-include | --collector.netdev.device-exclude
qdisk | device | --collector.qdisk.device-include | --collector.qdisk.device-exclude
slabinfo | slab-names | --collector.slabinfo.slabs-include | --collector.slabinfo.slabs-exclude
sysctl | all | --collector.sysctl.include | N/A
systemd | unit | --collector.systemd.unit-include | --collector.systemd.unit-exclude
### Enabled by default
Name | Description | OS
---------|-------------|----
arp | Exposes ARP statistics from `/proc/net/arp`. | Linux
bcache | Exposes bcache statistics from `/sys/fs/bcache/`. | Linux
bonding | Exposes the number of configured and active slaves of Linux bonding interfaces. | Linux
btrfs | Exposes btrfs statistics | Linux
boottime | Exposes system boot time derived from the `kern.boottime` sysctl. | Darwin, Dragonfly, FreeBSD, NetBSD, OpenBSD, Solaris
conntrack | Shows conntrack statistics (does nothing if no `/proc/sys/net/netfilter/` present). | Linux
cpu | Exposes CPU statistics | Darwin, Dragonfly, FreeBSD, Linux, Solaris, OpenBSD
cpufreq | Exposes CPU frequency statistics | Linux, Solaris
diskstats | Exposes disk I/O statistics. | Darwin, Linux, OpenBSD
dmi | Expose Desktop Management Interface (DMI) info from `/sys/class/dmi/id/` | Linux
edac | Exposes error detection and correction statistics. | Linux
entropy | Exposes available entropy. | Linux
exec | Exposes execution statistics. | Dragonfly, FreeBSD
fibrechannel | Exposes fibre channel information and statistics from `/sys/class/fc_host/`. | Linux
filefd | Exposes file descriptor statistics from `/proc/sys/fs/file-nr`. | Linux
filesystem | Exposes filesystem statistics, such as disk space used. | Darwin, Dragonfly, FreeBSD, Linux, OpenBSD
hwmon | Expose hardware monitoring and sensor data from `/sys/class/hwmon/`. | Linux
infiniband | Exposes network statistics specific to InfiniBand and Intel OmniPath configurations. | Linux
ipvs | Exposes IPVS status from `/proc/net/ip_vs` and stats from `/proc/net/ip_vs_stats`. | Linux
loadavg | Exposes load average. | Darwin, Dragonfly, FreeBSD, Linux, NetBSD, OpenBSD, Solaris
mdadm | Exposes statistics about devices in `/proc/mdstat` (does nothing if no `/proc/mdstat` present). | Linux
meminfo | Exposes memory statistics. | Darwin, Dragonfly, FreeBSD, Linux, OpenBSD
netclass | Exposes network interface info from `/sys/class/net/` | Linux
netdev | Exposes network interface statistics such as bytes transferred. | Darwin, Dragonfly, FreeBSD, Linux, OpenBSD
netisr | Exposes netisr statistics | FreeBSD
netstat | Exposes network statistics from `/proc/net/netstat`. This is the same information as `netstat -s`. | Linux
nfs | Exposes NFS client statistics from `/proc/net/rpc/nfs`. This is the same information as `nfsstat -c`. | Linux
nfsd | Exposes NFS kernel server statistics from `/proc/net/rpc/nfsd`. This is the same information as `nfsstat -s`. | Linux
nvme | Exposes NVMe info from `/sys/class/nvme/` | Linux
os | Expose OS release info from `/etc/os-release` or `/usr/lib/os-release` | _any_
powersupplyclass | Exposes Power Supply statistics from `/sys/class/power_supply` | Linux
pressure | Exposes pressure stall statistics from `/proc/pressure/`. | Linux (kernel 4.20+ and/or [CONFIG\_PSI](https://www.kernel.org/doc/html/latest/accounting/psi.html))
rapl | Exposes various statistics from `/sys/class/powercap`. | Linux
schedstat | Exposes task scheduler statistics from `/proc/schedstat`. | Linux
selinux | Exposes SELinux statistics. | Linux
sockstat | Exposes various statistics from `/proc/net/sockstat`. | Linux
softnet | Exposes statistics from `/proc/net/softnet_stat`. | Linux
stat | Exposes various statistics from `/proc/stat`. This includes boot time, forks and interrupts. | Linux
tapestats | Exposes statistics from `/sys/class/scsi_tape`. | Linux
textfile | Exposes statistics read from local disk. The `--collector.textfile.directory` flag must be set. | _any_
thermal | Exposes thermal statistics like `pmset -g therm`. | Darwin
thermal\_zone | Exposes thermal zone & cooling device statistics from `/sys/class/thermal`. | Linux
time | Exposes the current system time. | _any_
timex | Exposes selected adjtimex(2) system call stats. | Linux
udp_queues | Exposes UDP total lengths of the rx_queue and tx_queue from `/proc/net/udp` and `/proc/net/udp6`. | Linux
uname | Exposes system information as provided by the uname system call. | Darwin, FreeBSD, Linux, OpenBSD
vmstat | Exposes statistics from `/proc/vmstat`. | Linux
watchdog | Exposes statistics from `/sys/class/watchdog` | Linux
xfs | Exposes XFS runtime statistics. | Linux (kernel 4.4+)
zfs | Exposes [ZFS](http://open-zfs.org/) performance statistics. | FreeBSD, [Linux](http://zfsonlinux.org/), Solaris
### Disabled by default
`node_exporter` also implements a number of collectors that are disabled by default. Reasons for this vary by
collector, and may include:
* High cardinality
* Prolonged runtime that exceeds the Prometheus `scrape_interval` or `scrape_timeout`
* Significant resource demands on the host
You can enable additional collectors as desired by adding them to your
init system's or service supervisor's startup configuration for
`node_exporter` but caution is advised. Enable at most one at a time,
testing first on a non-production system, then by hand on a single
production node. When enabling additional collectors, you should
carefully monitor the change by observing the `
scrape_duration_seconds` metric to ensure that collection completes
and does not time out. In addition, monitor the
`scrape_samples_post_metric_relabeling` metric to see the changes in
cardinality.
Name | Description | OS
---------|-------------|----
buddyinfo | Exposes statistics of memory fragments as reported by /proc/buddyinfo. | Linux
cgroups | A summary of the number of active and enabled cgroups | Linux
cpu\_vulnerabilities | Exposes CPU vulnerability information from sysfs. | Linux
devstat | Exposes device statistics | Dragonfly, FreeBSD
drm | Expose GPU metrics using sysfs / DRM, `amdgpu` is the only driver which exposes this information through DRM | Linux
drbd | Exposes Distributed Replicated Block Device statistics (to version 8.4) | Linux
ethtool | Exposes network interface information and network driver statistics equivalent to `ethtool`, `ethtool -S`, and `ethtool -i`. | Linux
interrupts | Exposes detailed interrupts statistics. | Linux, OpenBSD
kernel_hung | Exposes number of tasks that have been detected as hung from `/proc/sys/kernel/hung_task_detect_count`. | Linux
ksmd | Exposes kernel and system statistics from `/sys/kernel/mm/ksm`. | Linux
lnstat | Exposes stats from `/proc/net/stat/`. | Linux
logind | Exposes session counts from [logind](http://www.freedesktop.org/wiki/Software/systemd/logind/). | Linux
meminfo\_numa | Exposes memory statistics from `/sys/devices/system/node/node[0-9]*/meminfo`, `/sys/devices/system/node/node[0-9]*/numastat`. | Linux
mountstats | Exposes filesystem statistics from `/proc/self/mountstats`. Exposes detailed NFS client statistics. | Linux
network_route | Exposes the routing table as metrics | Linux
pcidevice | Exposes pci devices' information including their link status and parent devices. | Linux
perf | Exposes perf based metrics (Warning: Metrics are dependent on kernel configuration and settings). | Linux
processes | Exposes aggregate process statistics from `/proc`. | Linux
qdisc | Exposes [queuing discipline](https://en.wikipedia.org/wiki/Network_scheduler#Linux_kernel) statistics | Linux
slabinfo | Exposes slab statistics from `/proc/slabinfo`. Note that permission of `/proc/slabinfo` is usually 0400, so set it appropriately. | Linux
softirqs | Exposes detailed softirq statistics from `/proc/softirqs`. | Linux
sysctl | Expose sysctl values from `/proc/sys`. Use `--collector.sysctl.include(-info)` to configure. | Linux
swap | Expose swap information from `/proc/swaps`. | Linux
systemd | Exposes service and system status from [systemd](http://www.freedesktop.org/wiki/Software/systemd/). | Linux
tcpstat | Exposes TCP connection status information from `/proc/net/tcp` and `/proc/net/tcp6`. (Warning: the current version has potential performance issues in high load situations.) | Linux
wifi | Exposes WiFi device and station statistics. | Linux
xfrm | Exposes statistics from `/proc/net/xfrm_stat` | Linux
zoneinfo | Exposes NUMA memory zone metrics. | Linux
### Deprecated
These collectors are deprecated and will be removed in the next major release.
Name | Description | OS
---------|-------------|----
ntp | Exposes local NTP daemon health to check [time](./docs/TIME.md) | _any_
runit | Exposes service status from [runit](http://smarden.org/runit/). | _any_
supervisord | Exposes service status from [supervisord](http://supervisord.org/). | _any_
### Perf Collector
The `perf` collector may not work out of the box on some Linux systems due to kernel
configuration and security settings. To allow access, set the following `sysctl`
parameter:
```
sysctl -w kernel.perf_event_paranoid=X
```
- 2 allow only user-space measurements (default since Linux 4.6).
- 1 allow both kernel and user measurements (default before Linux 4.6).
- 0 allow access to CPU-specific data but not raw tracepoint samples.
- -1 no restrictions.
Depending on the configured value different metrics will be available, for most
cases `0` will provide the most complete set. For more information see [`man 2
perf_event_open`](http://man7.org/linux/man-pages/man2/perf_event_open.2.html).
By default, the `perf` collector will only collect metrics of the CPUs that
`node_exporter` is running on (ie
[`runtime.NumCPU`](https://golang.org/pkg/runtime/#NumCPU). If this is
insufficient (e.g. if you run `node_exporter` with its CPU affinity set to
specific CPUs), you can specify a list of alternate CPUs by using the
`--collector.perf.cpus` flag. For example, to collect metrics on CPUs 2-6, you
would specify: `--collector.perf --collector.perf.cpus=2-6`. The CPU
configuration is zero indexed and can also take a stride value; e.g.
`--collector.perf --collector.perf.cpus=1-10:5` would collect on CPUs
1, 5, and 10.
The `perf` collector is also able to collect
[tracepoint](https://www.kernel.org/doc/html/latest/core-api/tracepoint.html)
counts when using the `--collector.perf.tracepoint` flag. Tracepoints can be
found using [`perf list`](http://man7.org/linux/man-pages/man1/perf.1.html) or
from debugfs. And example usage of this would be
`--collector.perf.tracepoint="sched:sched_process_exec"`.
### Sysctl Collector
The `sysctl` collector can be enabled with `--collector.sysctl`. It supports exposing numeric sysctl values
as metrics using the `--collector.sysctl.include` flag and string values as info metrics by using the
`--collector.sysctl.include-info` flag. The flags can be repeated. For sysctl with multiple numeric values,
an optional mapping can be given to expose each value as its own metric. Otherwise an `index` label is used
to identify the different fields.
#### Examples
##### Numeric values
###### Single values
Using `--collector.sysctl.include=vm.user_reserve_kbytes`:
`vm.user_reserve_kbytes = 131072` -> `node_sysctl_vm_user_reserve_kbytes 131072`
###### Multiple values
A sysctl can contain multiple values, for example:
```
net.ipv4.tcp_rmem = 4096 131072 6291456
```
Using `--collector.sysctl.include=net.ipv4.tcp_rmem` the collector will expose:
```
node_sysctl_net_ipv4_tcp_rmem{index="0"} 4096
node_sysctl_net_ipv4_tcp_rmem{index="1"} 131072
node_sysctl_net_ipv4_tcp_rmem{index="2"} 6291456
```
If the indexes have defined meaning like in this case, the values can be mapped to multiple metrics by appending the mapping to the --collector.sysctl.include flag:
Using `--collector.sysctl.include=net.ipv4.tcp_rmem:min,default,max` the collector will expose:
```
node_sysctl_net_ipv4_tcp_rmem_min 4096
node_sysctl_net_ipv4_tcp_rmem_default 131072
node_sysctl_net_ipv4_tcp_rmem_max 6291456
```
##### String values
String values need to be exposed as info metric. The user selects them by using the `--collector.sysctl.include-info` flag.
###### Single values
`kernel.core_pattern = core` -> `node_sysctl_info{key="kernel.core_pattern_info", value="core"} 1`
###### Multiple values
Given the following sysctl:
```
kernel.seccomp.actions_avail = kill_process kill_thread trap errno trace log allow
```
Setting `--collector.sysctl.include-info=kernel.seccomp.actions_avail` will yield:
```
node_sysctl_info{key="kernel.seccomp.actions_avail", index="0", value="kill_process"} 1
node_sysctl_info{key="kernel.seccomp.actions_avail", index="1", value="kill_thread"} 1
...
```
### Textfile Collector
The `textfile` collector is similar to the [Pushgateway](https://github.com/prometheus/pushgateway),
in that it allows exporting of statistics from batch jobs. It can also be used
to export static metrics, such as what role a machine has. The Pushgateway
should be used for service-level metrics. The `textfile` module is for metrics
that are tied to a machine.
To use it, set the `--collector.textfile.directory` flag on the `node_exporter` commandline. The
collector will parse all files in that directory matching the glob `*.prom`
using the [text
format](http://prometheus.io/docs/instrumenting/exposition_formats/). **Note:** Timestamps are not supported.
To atomically push completion time for a cron job:
```
echo my_batch_job_completion_time $(date +%s) > /path/to/directory/my_batch_job.prom.$$
mv /path/to/directory/my_batch_job.prom.$$ /path/to/directory/my_batch_job.prom
```
To statically set roles for a machine using labels:
```
echo 'role{role="application_server"} 1' > /path/to/directory/role.prom.$$
mv /path/to/directory/role.prom.$$ /path/to/directory/role.prom
```
### Filtering enabled collectors
The `node_exporter` will expose all metrics from enabled collectors by default. This is the recommended way to collect metrics to avoid errors when comparing metrics of different families.
For advanced use the `node_exporter` can be passed an optional list of collectors to filter metrics. The parameters `collect[]` and `exclude[]` can be used multiple times (but cannot be combined). In Prometheus configuration you can use this syntax under the [scrape config](https://prometheus.io/docs/prometheus/latest/configuration/configuration/#<scrape_config>).
Collect only `cpu` and `meminfo` collector metrics:
```
params:
collect[]:
- cpu
- meminfo
```
Collect all enabled collector metrics but exclude `netdev`:
```
params:
exclude[]:
- netdev
```
This can be useful for having different Prometheus servers collect specific metrics from nodes.
## Development building and running
Prerequisites:
* [Go compiler](https://golang.org/dl/)
* RHEL/CentOS: `glibc-static` package.
Building:
git clone https://github.com/prometheus/node_exporter.git
cd node_exporter
make build
./node_exporter <flags>
To see all available configuration flags:
./node_exporter -h
## Running tests
make test
## TLS endpoint
**EXPERIMENTAL**
The exporter supports TLS via a new web configuration file.
```console
./node_exporter --web.config.file=web-config.yml
```
See the [exporter-toolkit web-configuration](https://github.com/prometheus/exporter-toolkit/blob/master/docs/web-configuration.md) for more details.
[travis]: https://travis-ci.org/prometheus/node_exporter
[hub]: https://hub.docker.com/r/prom/node-exporter/
[circleci]: https://circleci.com/gh/prometheus/node_exporter
[quay]: https://quay.io/repository/prometheus/node-exporter
[goreportcard]: https://goreportcard.com/report/github.com/prometheus/node_exporter
================================================
FILE: SECURITY.md
================================================
# Reporting a security issue
The Prometheus security policy, including how to report vulnerabilities, can be
found here:
<https://prometheus.io/docs/operating/security/>
================================================
FILE: VERSION
================================================
1.10.2
================================================
FILE: checkmetrics.sh
================================================
#!/usr/bin/env bash
if [[ ( -z "$1" ) || ( -z "$2" ) ]]; then
echo "usage: ./checkmetrics.sh /usr/bin/promtool e2e-output.txt"
exit 1
fi
# Ignore known issues in auto-generated and network specific collectors.
lint=$($1 check metrics < "$2" 2>&1 | grep -v -E "^node_(entropy|memory|netstat|wifi_station)_")
if [[ -n $lint ]]; then
echo -e "Some Prometheus metrics do not follow best practices:\n"
echo "$lint"
exit 1
fi
================================================
FILE: collector/arp_linux.go
================================================
// Copyright 2017 The Prometheus Authors
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//go:build !noarp
package collector
import (
"fmt"
"log/slog"
"github.com/alecthomas/kingpin/v2"
"github.com/jsimonetti/rtnetlink/v2/rtnl"
"github.com/prometheus/client_golang/prometheus"
"github.com/prometheus/procfs"
"golang.org/x/sys/unix"
)
var (
arpDeviceInclude = kingpin.Flag("collector.arp.device-include", "Regexp of arp devices to include (mutually exclusive to device-exclude).").String()
arpDeviceExclude = kingpin.Flag("collector.arp.device-exclude", "Regexp of arp devices to exclude (mutually exclusive to device-include).").String()
arpNetlink = kingpin.Flag("collector.arp.netlink", "Use netlink to gather stats instead of /proc/net/arp.").Default("true").Bool()
)
type arpCollector struct {
fs procfs.FS
deviceFilter deviceFilter
entries *prometheus.Desc
logger *slog.Logger
}
func init() {
registerCollector("arp", defaultEnabled, NewARPCollector)
}
// NewARPCollector returns a new Collector exposing ARP stats.
func NewARPCollector(logger *slog.Logger) (Collector, error) {
fs, err := procfs.NewFS(*procPath)
if err != nil {
return nil, fmt.Errorf("failed to open procfs: %w", err)
}
return &arpCollector{
fs: fs,
deviceFilter: newDeviceFilter(*arpDeviceExclude, *arpDeviceInclude),
entries: prometheus.NewDesc(
prometheus.BuildFQName(namespace, "arp", "entries"),
"ARP entries by device",
[]string{"device"}, nil,
),
logger: logger,
}, nil
}
func getTotalArpEntries(deviceEntries []procfs.ARPEntry) map[string]uint32 {
entries := make(map[string]uint32)
for _, device := range deviceEntries {
entries[device.Device]++
}
return entries
}
func getTotalArpEntriesRTNL() (map[string]uint32, error) {
conn, err := rtnl.Dial(nil)
if err != nil {
return nil, err
}
defer conn.Close()
// Neighbors will also contain IPv6 neighbors, but since this is purely an ARP collector,
// restrict to AF_INET.
neighbors, err := conn.Neighbours(nil, unix.AF_INET)
if err != nil {
return nil, err
}
// Map of interface name to ARP neighbor count.
entries := make(map[string]uint32)
for _, n := range neighbors {
// Skip entries which have state NUD_NOARP to conform to output of /proc/net/arp.
if n.State&unix.NUD_NOARP == 0 {
entries[n.Interface.Name]++
}
}
return entries, nil
}
func (c *arpCollector) Update(ch chan<- prometheus.Metric) error {
var enumeratedEntry map[string]uint32
if *arpNetlink {
var err error
enumeratedEntry, err = getTotalArpEntriesRTNL()
if err != nil {
return fmt.Errorf("could not get ARP entries: %w", err)
}
} else {
entries, err := c.fs.GatherARPEntries()
if err != nil {
return fmt.Errorf("could not get ARP entries: %w", err)
}
enumeratedEntry = getTotalArpEntries(entries)
}
for device, entryCount := range enumeratedEntry {
if c.deviceFilter.ignored(device) {
continue
}
ch <- prometheus.MustNewConstMetric(
c.entries, prometheus.GaugeValue, float64(entryCount), device)
}
return nil
}
================================================
FILE: collector/bcache_linux.go
================================================
// Copyright 2017 The Prometheus Authors
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//go:build !nobcache
package collector
import (
"fmt"
"log/slog"
"github.com/alecthomas/kingpin/v2"
"github.com/prometheus/client_golang/prometheus"
"github.com/prometheus/procfs/bcache"
)
var (
priorityStats = kingpin.Flag("collector.bcache.priorityStats", "Expose expensive priority stats.").Bool()
)
func init() {
registerCollector("bcache", defaultEnabled, NewBcacheCollector)
}
// A bcacheCollector is a Collector which gathers metrics from Linux bcache.
type bcacheCollector struct {
fs bcache.FS
logger *slog.Logger
}
// NewBcacheCollector returns a newly allocated bcacheCollector.
// It exposes a number of Linux bcache statistics.
func NewBcacheCollector(logger *slog.Logger) (Collector, error) {
fs, err := bcache.NewFS(*sysPath)
if err != nil {
return nil, fmt.Errorf("failed to open sysfs: %w", err)
}
return &bcacheCollector{
fs: fs,
logger: logger,
}, nil
}
// Update reads and exposes bcache stats.
// It implements the Collector interface.
func (c *bcacheCollector) Update(ch chan<- prometheus.Metric) error {
var stats []*bcache.Stats
var err error
if *priorityStats {
stats, err = c.fs.Stats()
} else {
stats, err = c.fs.StatsWithoutPriority()
}
if err != nil {
return fmt.Errorf("failed to retrieve bcache stats: %w", err)
}
for _, s := range stats {
c.updateBcacheStats(ch, s)
}
return nil
}
type bcacheMetric struct {
name string
desc string
value float64
metricType prometheus.ValueType
extraLabel []string
extraLabelValue string
}
func bcachePeriodStatsToMetric(ps *bcache.PeriodStats, labelValue string) []bcacheMetric {
label := []string{"backing_device"}
metrics := []bcacheMetric{
{
name: "bypassed_bytes_total",
desc: "Amount of IO (both reads and writes) that has bypassed the cache.",
value: float64(ps.Bypassed),
metricType: prometheus.CounterValue,
extraLabel: label,
extraLabelValue: labelValue,
},
{
name: "cache_hits_total",
desc: "Hits counted per individual IO as bcache sees them.",
value: float64(ps.CacheHits),
metricType: prometheus.CounterValue,
extraLabel: label,
extraLabelValue: labelValue,
},
{
name: "cache_misses_total",
desc: "Misses counted per individual IO as bcache sees them.",
value: float64(ps.CacheMisses),
metricType: prometheus.CounterValue,
extraLabel: label,
extraLabelValue: labelValue,
},
{
name: "cache_bypass_hits_total",
desc: "Hits for IO intended to skip the cache.",
value: float64(ps.CacheBypassHits),
metricType: prometheus.CounterValue,
extraLabel: label,
extraLabelValue: labelValue,
},
{
name: "cache_bypass_misses_total",
desc: "Misses for IO intended to skip the cache.",
value: float64(ps.CacheBypassMisses),
metricType: prometheus.CounterValue,
extraLabel: label,
extraLabelValue: labelValue,
},
{
name: "cache_miss_collisions_total",
desc: "Instances where data insertion from cache miss raced with write (data already present).",
value: float64(ps.CacheMissCollisions),
metricType: prometheus.CounterValue,
extraLabel: label,
extraLabelValue: labelValue,
},
}
if ps.CacheReadaheads != 0 {
bcacheReadaheadMetrics := []bcacheMetric{
{
name: "cache_readaheads_total",
desc: "Count of times readahead occurred.",
value: float64(ps.CacheReadaheads),
metricType: prometheus.CounterValue,
extraLabel: label,
extraLabelValue: labelValue,
},
}
metrics = append(metrics, bcacheReadaheadMetrics...)
}
return metrics
}
// UpdateBcacheStats collects statistics for one bcache ID.
func (c *bcacheCollector) updateBcacheStats(ch chan<- prometheus.Metric, s *bcache.Stats) {
const (
subsystem = "bcache"
)
var (
devLabel = []string{"uuid"}
allMetrics []bcacheMetric
metrics []bcacheMetric
)
allMetrics = []bcacheMetric{
// metrics in /sys/fs/bcache/<uuid>/
{
name: "average_key_size_sectors",
desc: "Average data per key in the btree (sectors).",
value: float64(s.Bcache.AverageKeySize),
metricType: prometheus.GaugeValue,
},
{
name: "btree_cache_size_bytes",
desc: "Amount of memory currently used by the btree cache.",
value: float64(s.Bcache.BtreeCacheSize),
metricType: prometheus.GaugeValue,
},
{
name: "cache_available_percent",
desc: "Percentage of cache device without dirty data, usable for writeback (may contain clean cached data).",
value: float64(s.Bcache.CacheAvailablePercent),
metricType: prometheus.GaugeValue,
},
{
name: "congested",
desc: "Congestion.",
value: float64(s.Bcache.Congested),
metricType: prometheus.GaugeValue,
},
{
name: "root_usage_percent",
desc: "Percentage of the root btree node in use (tree depth increases if too high).",
value: float64(s.Bcache.RootUsagePercent),
metricType: prometheus.GaugeValue,
},
{
name: "tree_depth",
desc: "Depth of the btree.",
value: float64(s.Bcache.TreeDepth),
metricType: prometheus.GaugeValue,
},
// metrics in /sys/fs/bcache/<uuid>/internal/
{
name: "active_journal_entries",
desc: "Number of journal entries that are newer than the index.",
value: float64(s.Bcache.Internal.ActiveJournalEntries),
metricType: prometheus.GaugeValue,
},
{
name: "btree_nodes",
desc: "Total nodes in the btree.",
value: float64(s.Bcache.Internal.BtreeNodes),
metricType: prometheus.GaugeValue,
},
{
name: "btree_read_average_duration_seconds",
desc: "Average btree read duration.",
value: float64(s.Bcache.Internal.BtreeReadAverageDurationNanoSeconds) * 1e-9,
metricType: prometheus.GaugeValue,
},
{
name: "cache_read_races_total",
desc: "Counts instances where while data was being read from the cache, the bucket was reused and invalidated - i.e. where the pointer was stale after the read completed.",
value: float64(s.Bcache.Internal.CacheReadRaces),
metricType: prometheus.CounterValue,
},
}
for _, bdev := range s.Bdevs {
// metrics in /sys/fs/bcache/<uuid>/<bdev>/
metrics = []bcacheMetric{
{
name: "dirty_data_bytes",
desc: "Amount of dirty data for this backing device in the cache.",
value: float64(bdev.DirtyData),
metricType: prometheus.GaugeValue,
extraLabel: []string{"backing_device"},
extraLabelValue: bdev.Name,
},
{
name: "dirty_target_bytes",
desc: "Current dirty data target threshold for this backing device in bytes.",
value: float64(bdev.WritebackRateDebug.Target),
metricType: prometheus.GaugeValue,
extraLabel: []string{"backing_device"},
extraLabelValue: bdev.Name,
},
{
name: "writeback_rate",
desc: "Current writeback rate for this backing device in bytes.",
value: float64(bdev.WritebackRateDebug.Rate),
metricType: prometheus.GaugeValue,
extraLabel: []string{"backing_device"},
extraLabelValue: bdev.Name,
},
{
name: "writeback_rate_proportional_term",
desc: "Current result of proportional controller, part of writeback rate",
value: float64(bdev.WritebackRateDebug.Proportional),
metricType: prometheus.GaugeValue,
extraLabel: []string{"backing_device"},
extraLabelValue: bdev.Name,
},
{
name: "writeback_rate_integral_term",
desc: "Current result of integral controller, part of writeback rate",
value: float64(bdev.WritebackRateDebug.Integral),
metricType: prometheus.GaugeValue,
extraLabel: []string{"backing_device"},
extraLabelValue: bdev.Name,
},
{
name: "writeback_change",
desc: "Last writeback rate change step for this backing device.",
value: float64(bdev.WritebackRateDebug.Change),
metricType: prometheus.GaugeValue,
extraLabel: []string{"backing_device"},
extraLabelValue: bdev.Name,
},
}
allMetrics = append(allMetrics, metrics...)
// metrics in /sys/fs/bcache/<uuid>/<bdev>/stats_total
metrics := bcachePeriodStatsToMetric(&bdev.Total, bdev.Name)
allMetrics = append(allMetrics, metrics...)
}
for _, cache := range s.Caches {
metrics = []bcacheMetric{
// metrics in /sys/fs/bcache/<uuid>/<cache>/
{
name: "io_errors",
desc: "Number of errors that have occurred, decayed by io_error_halflife.",
value: float64(cache.IOErrors),
metricType: prometheus.GaugeValue,
extraLabel: []string{"cache_device"},
extraLabelValue: cache.Name,
},
{
name: "metadata_written_bytes_total",
desc: "Sum of all non data writes (btree writes and all other metadata).",
value: float64(cache.MetadataWritten),
metricType: prometheus.CounterValue,
extraLabel: []string{"cache_device"},
extraLabelValue: cache.Name,
},
{
name: "written_bytes_total",
desc: "Sum of all data that has been written to the cache.",
value: float64(cache.Written),
metricType: prometheus.CounterValue,
extraLabel: []string{"cache_device"},
extraLabelValue: cache.Name,
},
}
if *priorityStats {
// metrics in /sys/fs/bcache/<uuid>/<cache>/priority_stats
priorityStatsMetrics := []bcacheMetric{
{
name: "priority_stats_unused_percent",
desc: "The percentage of the cache that doesn't contain any data.",
value: float64(cache.Priority.UnusedPercent),
metricType: prometheus.GaugeValue,
extraLabel: []string{"cache_device"},
extraLabelValue: cache.Name,
},
{
name: "priority_stats_metadata_percent",
desc: "Bcache's metadata overhead.",
value: float64(cache.Priority.MetadataPercent),
metricType: prometheus.GaugeValue,
extraLabel: []string{"cache_device"},
extraLabelValue: cache.Name,
},
}
metrics = append(metrics, priorityStatsMetrics...)
}
allMetrics = append(allMetrics, metrics...)
}
for _, m := range allMetrics {
labels := append(devLabel, m.extraLabel...)
desc := prometheus.NewDesc(
prometheus.BuildFQName(namespace, subsystem, m.name),
m.desc,
labels,
nil,
)
labelValues := []string{s.Name}
if m.extraLabelValue != "" {
labelValues = append(labelValues, m.extraLabelValue)
}
ch <- prometheus.MustNewConstMetric(
desc,
m.metricType,
m.value,
labelValues...,
)
}
}
================================================
FILE: collector/bcachefs_linux.go
================================================
// Copyright The Prometheus Authors
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//go:build !nobcachefs
package collector
import (
"fmt"
"log/slog"
"os"
"github.com/prometheus/client_golang/prometheus"
"github.com/prometheus/procfs/bcachefs"
)
const subsystem = "bcachefs"
var (
bcachefsInfoDesc = prometheus.NewDesc(
prometheus.BuildFQName(namespace, subsystem, "info"),
"Filesystem information.",
[]string{"uuid"},
nil,
)
bcachefsBtreeCacheSizeBytes = prometheus.NewDesc(
prometheus.BuildFQName(namespace, subsystem, "btree_cache_size_bytes"),
"Btree cache memory usage in bytes.",
[]string{"uuid"},
nil,
)
bcachefsCompressionCompressedBytesDesc = prometheus.NewDesc(
prometheus.BuildFQName(namespace, subsystem, "compression_compressed_bytes"),
"Compressed size by algorithm.",
[]string{"uuid", "algorithm"},
nil,
)
bcachefsCompressionUncompressedBytesDesc = prometheus.NewDesc(
prometheus.BuildFQName(namespace, subsystem, "compression_uncompressed_bytes"),
"Uncompressed size by algorithm.",
[]string{"uuid", "algorithm"},
nil,
)
bcachefsErrorsTotalDesc = prometheus.NewDesc(
prometheus.BuildFQName(namespace, subsystem, "errors_total"),
"Error count by error type.",
[]string{"uuid", "error_type"},
nil,
)
bcachefsBtreeWritesTotalDesc = prometheus.NewDesc(
prometheus.BuildFQName(namespace, subsystem, "btree_writes_total"),
"Number of btree writes by type.",
[]string{"uuid", "type"},
nil,
)
bcachefsBtreeWriteAverageSizeBytesDesc = prometheus.NewDesc(
prometheus.BuildFQName(namespace, subsystem, "btree_write_average_size_bytes"),
"Average btree write size by type.",
[]string{"uuid", "type"},
nil,
)
bcachefsDeviceInfoDesc = prometheus.NewDesc(
prometheus.BuildFQName(namespace, subsystem, "device_info"),
"Device information.",
[]string{"uuid", "device", "label", "state"},
nil,
)
bcachefsDeviceBucketSizeBytesDesc = prometheus.NewDesc(
prometheus.BuildFQName(namespace, subsystem, "device_bucket_size_bytes"),
"Bucket size in bytes.",
[]string{"uuid", "device"},
nil,
)
bcachefsDeviceBucketsDesc = prometheus.NewDesc(
prometheus.BuildFQName(namespace, subsystem, "device_buckets"),
"Total number of buckets.",
[]string{"uuid", "device"},
nil,
)
bcachefsDeviceDurabilityDesc = prometheus.NewDesc(
prometheus.BuildFQName(namespace, subsystem, "device_durability"),
"Device durability setting.",
[]string{"uuid", "device"},
nil,
)
bcachefsDeviceIODoneBytesTotalDesc = prometheus.NewDesc(
prometheus.BuildFQName(namespace, subsystem, "device_io_done_bytes_total"),
"IO bytes by operation type and data type.",
[]string{"uuid", "device", "operation", "data_type"},
nil,
)
bcachefsDeviceIOErrorsTotalDesc = prometheus.NewDesc(
prometheus.BuildFQName(namespace, subsystem, "device_io_errors_total"),
"IO errors by error type.",
[]string{"uuid", "device", "type"},
nil,
)
)
func init() {
registerCollector(subsystem, defaultEnabled, NewBcachefsCollector)
}
// bcachefsCollector collects metrics from bcachefs filesystems.
type bcachefsCollector struct {
fs bcachefs.FS
logger *slog.Logger
}
// NewBcachefsCollector returns a new Collector exposing bcachefs statistics.
func NewBcachefsCollector(logger *slog.Logger) (Collector, error) {
fs, err := bcachefs.NewFS(*sysPath)
if err != nil {
return nil, fmt.Errorf("failed to open sysfs: %w", err)
}
return &bcachefsCollector{
fs: fs,
logger: logger,
}, nil
}
// Update retrieves and exports bcachefs statistics.
func (c *bcachefsCollector) Update(ch chan<- prometheus.Metric) error {
stats, err := c.fs.Stats()
if err != nil {
if os.IsNotExist(err) {
c.logger.Debug("bcachefs sysfs path does not exist", "path", sysFilePath("fs/bcachefs"))
return ErrNoData
}
return fmt.Errorf("failed to retrieve bcachefs stats: %w", err)
}
if len(stats) == 0 {
return ErrNoData
}
for _, s := range stats {
uuid := s.UUID
ch <- prometheus.MustNewConstMetric(
bcachefsInfoDesc,
prometheus.GaugeValue,
1,
uuid,
)
ch <- prometheus.MustNewConstMetric(
bcachefsBtreeCacheSizeBytes,
prometheus.GaugeValue,
float64(s.BtreeCacheSizeBytes),
uuid,
)
for algorithm, comp := range s.Compression {
ch <- prometheus.MustNewConstMetric(
bcachefsCompressionCompressedBytesDesc,
prometheus.GaugeValue,
float64(comp.CompressedBytes),
uuid, algorithm,
)
ch <- prometheus.MustNewConstMetric(
bcachefsCompressionUncompressedBytesDesc,
prometheus.GaugeValue,
float64(comp.UncompressedBytes),
uuid, algorithm,
)
}
for errorType, errStats := range s.Errors {
ch <- prometheus.MustNewConstMetric(
bcachefsErrorsTotalDesc,
prometheus.CounterValue,
float64(errStats.Count),
uuid, errorType,
)
}
for counterName, counterStats := range s.Counters {
metricName := SanitizeMetricName(counterName) + "_total"
ch <- prometheus.MustNewConstMetric(
prometheus.NewDesc(
prometheus.BuildFQName(namespace, subsystem, metricName),
fmt.Sprintf("Bcachefs counter %s since filesystem creation.", counterName),
[]string{"uuid"},
nil,
),
prometheus.CounterValue,
float64(counterStats.SinceFilesystemCreation),
uuid,
)
}
for writeType, writeStats := range s.BtreeWrites {
ch <- prometheus.MustNewConstMetric(
bcachefsBtreeWritesTotalDesc,
prometheus.CounterValue,
float64(writeStats.Count),
uuid, writeType,
)
ch <- prometheus.MustNewConstMetric(
bcachefsBtreeWriteAverageSizeBytesDesc,
prometheus.GaugeValue,
float64(writeStats.SizeBytes),
uuid, writeType,
)
}
for device, devStats := range s.Devices {
if devStats == nil {
continue
}
ch <- prometheus.MustNewConstMetric(
bcachefsDeviceInfoDesc,
prometheus.GaugeValue,
1,
uuid, device, devStats.Label, devStats.State,
)
ch <- prometheus.MustNewConstMetric(
bcachefsDeviceBucketSizeBytesDesc,
prometheus.GaugeValue,
float64(devStats.BucketSizeBytes),
uuid, device,
)
ch <- prometheus.MustNewConstMetric(
bcachefsDeviceBucketsDesc,
prometheus.GaugeValue,
float64(devStats.Buckets),
uuid, device,
)
ch <- prometheus.MustNewConstMetric(
bcachefsDeviceDurabilityDesc,
prometheus.GaugeValue,
float64(devStats.Durability),
uuid, device,
)
for op, dataTypes := range devStats.IODone {
for dataType, value := range dataTypes {
ch <- prometheus.MustNewConstMetric(
bcachefsDeviceIODoneBytesTotalDesc,
prometheus.CounterValue,
float64(value),
uuid, device, op, dataType,
)
}
}
for errorType, value := range devStats.IOErrors {
ch <- prometheus.MustNewConstMetric(
bcachefsDeviceIOErrorsTotalDesc,
prometheus.CounterValue,
float64(value),
uuid, device, errorType,
)
}
}
}
return nil
}
================================================
FILE: collector/bonding_linux.go
================================================
// Copyright 2015 The Prometheus Authors
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//go:build !nobonding
package collector
import (
"errors"
"fmt"
"log/slog"
"os"
"path/filepath"
"strings"
"github.com/prometheus/client_golang/prometheus"
)
type bondingCollector struct {
slaves, active typedDesc
logger *slog.Logger
}
func init() {
registerCollector("bonding", defaultEnabled, NewBondingCollector)
}
// NewBondingCollector returns a newly allocated bondingCollector.
// It exposes the number of configured and active slave of linux bonding interfaces.
func NewBondingCollector(logger *slog.Logger) (Collector, error) {
return &bondingCollector{
slaves: typedDesc{prometheus.NewDesc(
prometheus.BuildFQName(namespace, "bonding", "slaves"),
"Number of configured slaves per bonding interface.",
[]string{"master"}, nil,
), prometheus.GaugeValue},
active: typedDesc{prometheus.NewDesc(
prometheus.BuildFQName(namespace, "bonding", "active"),
"Number of active slaves per bonding interface.",
[]string{"master"}, nil,
), prometheus.GaugeValue},
logger: logger,
}, nil
}
// Update reads and exposes bonding states, implements Collector interface. Caution: This works only on linux.
func (c *bondingCollector) Update(ch chan<- prometheus.Metric) error {
statusfile := sysFilePath("class/net")
bondingStats, err := readBondingStats(statusfile)
if err != nil {
if errors.Is(err, os.ErrNotExist) {
c.logger.Debug("Not collecting bonding, file does not exist", "file", statusfile)
return ErrNoData
}
return err
}
for master, status := range bondingStats {
ch <- c.slaves.mustNewConstMetric(float64(status[0]), master)
ch <- c.active.mustNewConstMetric(float64(status[1]), master)
}
return nil
}
func readBondingStats(root string) (status map[string][2]int, err error) {
status = map[string][2]int{}
masters, err := os.ReadFile(filepath.Join(root, "bonding_masters"))
if err != nil {
return nil, err
}
for master := range strings.FieldsSeq(string(masters)) {
slaves, err := os.ReadFile(filepath.Join(root, master, "bonding", "slaves"))
if err != nil {
return nil, err
}
sstat := [2]int{0, 0}
for slave := range strings.FieldsSeq(string(slaves)) {
state, err := os.ReadFile(filepath.Join(root, master, fmt.Sprintf("lower_%s", slave), "bonding_slave", "mii_status"))
if errors.Is(err, os.ErrNotExist) {
// some older? kernels use slave_ prefix
state, err = os.ReadFile(filepath.Join(root, master, fmt.Sprintf("slave_%s", slave), "bonding_slave", "mii_status"))
}
if err != nil {
return nil, err
}
sstat[0]++
if strings.TrimSpace(string(state)) == "up" {
sstat[1]++
}
}
status[master] = sstat
}
return status, err
}
================================================
FILE: collector/bonding_linux_test.go
================================================
// Copyright 2015 The Prometheus Authors
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//go:build !nobonding
package collector
import (
"testing"
)
func TestBonding(t *testing.T) {
bondingStats, err := readBondingStats("fixtures/sys/class/net")
if err != nil {
t.Fatal(err)
}
if bondingStats["bond0"][0] != 0 || bondingStats["bond0"][1] != 0 {
t.Fatal("bond0 in unexpected state")
}
if bondingStats["int"][0] != 2 || bondingStats["int"][1] != 1 {
t.Fatal("int in unexpected state")
}
if bondingStats["dmz"][0] != 2 || bondingStats["dmz"][1] != 2 {
t.Fatal("dmz in unexpected state")
}
}
================================================
FILE: collector/boot_time_bsd.go
================================================
// Copyright 2018 The Prometheus Authors
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//go:build (freebsd || dragonfly || openbsd || netbsd || darwin) && !noboottime
package collector
import (
"log/slog"
"github.com/prometheus/client_golang/prometheus"
"golang.org/x/sys/unix"
)
type bootTimeCollector struct {
logger *slog.Logger
}
func init() {
registerCollector("boottime", defaultEnabled, newBootTimeCollector)
}
// newBootTimeCollector returns a new Collector exposing system boot time on BSD systems.
func newBootTimeCollector(logger *slog.Logger) (Collector, error) {
return &bootTimeCollector{
logger: logger,
}, nil
}
// Update pushes boot time onto ch
func (c *bootTimeCollector) Update(ch chan<- prometheus.Metric) error {
tv, err := unix.SysctlTimeval("kern.boottime")
if err != nil {
return err
}
// This conversion maintains the usec precision. Using the time
// package did not.
v := float64(tv.Sec) + (float64(tv.Usec) / float64(1000*1000))
ch <- prometheus.MustNewConstMetric(
prometheus.NewDesc(
prometheus.BuildFQName(namespace, "", "boot_time_seconds"),
"Unix time of last boot, including microseconds.",
nil, nil,
), prometheus.GaugeValue, v)
return nil
}
================================================
FILE: collector/boot_time_solaris.go
================================================
// Copyright 2018 The Prometheus Authors
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//go:build !noboottime
package collector
import (
"log/slog"
"github.com/illumos/go-kstat"
"github.com/prometheus/client_golang/prometheus"
)
type bootTimeCollector struct {
boottime typedDesc
logger *slog.Logger
}
func init() {
registerCollector("boottime", defaultEnabled, newBootTimeCollector)
}
func newBootTimeCollector(logger *slog.Logger) (Collector, error) {
return &bootTimeCollector{
boottime: typedDesc{
prometheus.NewDesc(
prometheus.BuildFQName(namespace, "", "boot_time_seconds"),
"Unix time of last boot, including microseconds.",
nil, nil,
), prometheus.GaugeValue},
logger: logger,
}, nil
}
// newBootTimeCollector returns a new Collector exposing system boot time on Solaris systems.
// Update pushes boot time onto ch
func (c *bootTimeCollector) Update(ch chan<- prometheus.Metric) error {
tok, err := kstat.Open()
if err != nil {
return err
}
defer tok.Close()
ks, err := tok.Lookup("unix", 0, "system_misc")
if err != nil {
return err
}
v, err := ks.GetNamed("boot_time")
if err != nil {
return err
}
ch <- c.boottime.mustNewConstMetric(float64(v.UintVal))
return nil
}
================================================
FILE: collector/btrfs_linux.go
================================================
// Copyright 2019 The Prometheus Authors
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//go:build !nobtrfs
package collector
import (
"fmt"
"log/slog"
"path"
"strings"
"syscall"
dennwc "github.com/dennwc/btrfs"
"github.com/prometheus/client_golang/prometheus"
"github.com/prometheus/procfs/btrfs"
)
// A btrfsCollector is a Collector which gathers metrics from Btrfs filesystems.
type btrfsCollector struct {
fs btrfs.FS
logger *slog.Logger
}
func init() {
registerCollector("btrfs", defaultEnabled, NewBtrfsCollector)
}
// NewBtrfsCollector returns a new Collector exposing Btrfs statistics.
func NewBtrfsCollector(logger *slog.Logger) (Collector, error) {
fs, err := btrfs.NewFS(*sysPath)
if err != nil {
return nil, fmt.Errorf("failed to open sysfs: %w", err)
}
return &btrfsCollector{
fs: fs,
logger: logger,
}, nil
}
// Update retrieves and exports Btrfs statistics.
// It implements Collector.
func (c *btrfsCollector) Update(ch chan<- prometheus.Metric) error {
stats, err := c.fs.Stats()
if err != nil {
return fmt.Errorf("failed to retrieve Btrfs stats from procfs: %w", err)
}
ioctlStatsMap, err := c.getIoctlStats()
if err != nil {
c.logger.Debug(
"Error querying btrfs device stats with ioctl",
"err", err)
ioctlStatsMap = make(map[string]*btrfsIoctlFsStats)
}
for _, s := range stats {
// match up procfs and ioctl info by filesystem UUID (without dashes)
var fsUUID = strings.ReplaceAll(s.UUID, "-", "")
ioctlStats := ioctlStatsMap[fsUUID]
c.updateBtrfsStats(ch, s, ioctlStats)
}
return nil
}
type btrfsIoctlFsDevStats struct {
path string
uuid string
bytesUsed uint64
totalBytes uint64
// The error stats below match the following upstream lists:
// https://github.com/dennwc/btrfs/blob/b3db0b2dedac3bf580f412034d77e0bf4b420167/btrfs.go#L132-L140
// https://github.com/torvalds/linux/blob/70d605cbeecb408dd884b1f0cd3963eeeaac144c/include/uapi/linux/btrfs.h#L680-L692
writeErrs uint64
readErrs uint64
flushErrs uint64
corruptionErrs uint64
generationErrs uint64
}
type btrfsIoctlFsStats struct {
uuid string
devices []btrfsIoctlFsDevStats
}
func (c *btrfsCollector) getIoctlStats() (map[string]*btrfsIoctlFsStats, error) {
// Instead of introducing more ioctl calls to scan for all btrfs
// filesystems re-use our mount point utils to find known mounts
mountsList, err := mountPointDetails(c.logger)
if err != nil {
return nil, err
}
// Track devices we have successfully scanned, by device path.
devicesDone := make(map[string]struct{})
// Filesystems scann results by UUID.
fsStats := make(map[string]*btrfsIoctlFsStats)
for _, mount := range mountsList {
if mount.fsType != "btrfs" {
continue
}
if _, found := devicesDone[mount.device]; found {
// We already found this filesystem by another mount point.
continue
}
mountPath := rootfsFilePath(mount.mountPoint)
fs, err := dennwc.Open(mountPath, true)
if err != nil {
// Failed to open this mount point, maybe we didn't have permission
// maybe we'll find another mount point for this FS later.
c.logger.Debug(
"Error inspecting btrfs mountpoint",
"mountPoint", mountPath,
"err", err)
continue
}
defer fs.Close()
fsInfo, err := fs.Info()
if err != nil {
// Failed to get the FS info for some reason,
// perhaps it'll work with a different mount point
c.logger.Debug(
"Error querying btrfs filesystem",
"mountPoint", mountPath,
"err", err)
continue
}
fsID := fsInfo.FSID.String()
if _, found := fsStats[fsID]; found {
// We already found this filesystem by another mount point
continue
}
deviceStats, err := c.getIoctlDeviceStats(fs, &fsInfo)
if err != nil {
c.logger.Debug(
"Error querying btrfs device stats",
"mountPoint", mountPath,
"err", err)
continue
}
devicesDone[mount.device] = struct{}{}
fsStats[fsID] = &btrfsIoctlFsStats{
uuid: fsID,
devices: deviceStats,
}
}
return fsStats, nil
}
func (c *btrfsCollector) getIoctlDeviceStats(fs *dennwc.FS, fsInfo *dennwc.Info) ([]btrfsIoctlFsDevStats, error) {
devices := make([]btrfsIoctlFsDevStats, 0, fsInfo.NumDevices)
for i := uint64(0); i <= fsInfo.MaxID; i++ {
deviceInfo, err := fs.GetDevInfo(i)
if err != nil {
if errno, ok := err.(syscall.Errno); ok && errno == syscall.ENODEV {
// Device IDs do not consistently start at 0, nor are ranges contiguous, so we expect this.
continue
}
return nil, err
}
deviceStats, err := fs.GetDevStats(i)
if err != nil {
return nil, err
}
devices = append(devices, btrfsIoctlFsDevStats{
path: deviceInfo.Path,
uuid: deviceInfo.UUID.String(),
bytesUsed: deviceInfo.BytesUsed,
totalBytes: deviceInfo.TotalBytes,
writeErrs: deviceStats.WriteErrs,
readErrs: deviceStats.ReadErrs,
flushErrs: deviceStats.FlushErrs,
corruptionErrs: deviceStats.CorruptionErrs,
generationErrs: deviceStats.GenerationErrs,
})
if uint64(len(devices)) == fsInfo.NumDevices {
break
}
}
return devices, nil
}
// btrfsMetric represents a single Btrfs metric that is converted into a Prometheus Metric.
type btrfsMetric struct {
name string
metricType prometheus.ValueType
desc string
value float64
extraLabel []string
extraLabelValue []string
}
// updateBtrfsStats collects statistics for one bcache ID.
func (c *btrfsCollector) updateBtrfsStats(ch chan<- prometheus.Metric, s *btrfs.Stats, ioctlStats *btrfsIoctlFsStats) {
const subsystem = "btrfs"
// Basic information about the filesystem.
devLabels := []string{"uuid"}
// Retrieve the metrics.
metrics := c.getMetrics(s, ioctlStats)
// Convert all gathered metrics to Prometheus Metrics and add to channel.
for _, m := range metrics {
labels := append(devLabels, m.extraLabel...)
desc := prometheus.NewDesc(
prometheus.BuildFQName(namespace, subsystem, m.name),
m.desc,
labels,
nil,
)
labelValues := []string{s.UUID}
if len(m.extraLabelValue) > 0 {
labelValues = append(labelValues, m.extraLabelValue...)
}
ch <- prometheus.MustNewConstMetric(
desc,
m.metricType,
m.value,
labelValues...,
)
}
}
// getMetrics returns metrics for the given Btrfs statistics.
func (c *btrfsCollector) getMetrics(s *btrfs.Stats, ioctlStats *btrfsIoctlFsStats) []btrfsMetric {
metrics := []btrfsMetric{
{
name: "info",
desc: "Filesystem information",
value: 1,
metricType: prometheus.GaugeValue,
extraLabel: []string{"label"},
extraLabelValue: []string{s.Label},
},
{
name: "global_rsv_size_bytes",
desc: "Size of global reserve.",
metricType: prometheus.GaugeValue,
value: float64(s.Allocation.GlobalRsvSize),
},
{
name: "commits_total",
desc: "The total number of commits that have occurred.",
metricType: prometheus.CounterValue,
value: float64(s.CommitStats.Commits),
},
{
name: "last_commit_seconds",
desc: "Duration of the most recent commit, in seconds.",
metricType: prometheus.GaugeValue,
value: float64(s.CommitStats.LastCommitMs) / 1000,
},
{
name: "max_commit_seconds",
desc: "Duration of the slowest commit, in seconds.",
metricType: prometheus.GaugeValue,
value: float64(s.CommitStats.MaxCommitMs) / 1000,
},
{
name: "commit_seconds_total",
desc: "Sum of the duration of all commits, in seconds.",
metricType: prometheus.CounterValue,
value: float64(s.CommitStats.TotalCommitMs) / 1000,
},
}
// Information about data, metadata and system data.
metrics = append(metrics, c.getAllocationStats("data", s.Allocation.Data)...)
metrics = append(metrics, c.getAllocationStats("metadata", s.Allocation.Metadata)...)
metrics = append(metrics, c.getAllocationStats("system", s.Allocation.System)...)
// Information about devices.
if ioctlStats == nil {
for n, dev := range s.Devices {
metrics = append(metrics, btrfsMetric{
name: "device_size_bytes",
desc: "Size of a device that is part of the filesystem.",
metricType: prometheus.GaugeValue,
value: float64(dev.Size),
extraLabel: []string{"device"},
extraLabelValue: []string{n},
})
}
return metrics
}
for _, dev := range ioctlStats.devices {
// trim the path prefix from the device name so the value should match
// the value used in the fallback branch above.
// e.g. /dev/sda -> sda, /rootfs/dev/md1 -> md1
_, device := path.Split(dev.path)
extraLabels := []string{"device", "btrfs_dev_uuid"}
extraLabelValues := []string{device, dev.uuid}
metrics = append(metrics,
btrfsMetric{
name: "device_size_bytes",
desc: "Size of a device that is part of the filesystem.",
metricType: prometheus.GaugeValue,
value: float64(dev.totalBytes),
extraLabel: extraLabels,
extraLabelValue: extraLabelValues,
},
// A bytes available metric is probably more useful than a
// bytes used metric, because large numbers of bytes will
// suffer from floating point representation issues
// and we probably care more about the number when it's low anyway
btrfsMetric{
name: "device_unused_bytes",
desc: "Unused bytes unused on a device that is part of the filesystem.",
metricType: prometheus.GaugeValue,
value: float64(dev.totalBytes - dev.bytesUsed),
extraLabel: extraLabels,
extraLabelValue: extraLabelValues,
})
errorLabels := append([]string{"type"}, extraLabels...)
values := []uint64{
dev.writeErrs,
dev.readErrs,
dev.flushErrs,
dev.corruptionErrs,
dev.generationErrs,
}
btrfsErrorTypeNames := []string{
"write",
"read",
"flush",
"corruption",
"generation",
}
for i, errorType := range btrfsErrorTypeNames {
metrics = append(metrics,
btrfsMetric{
name: "device_errors_total",
desc: "Errors reported for the device",
metricType: prometheus.CounterValue,
value: float64(values[i]),
extraLabel: errorLabels,
extraLabelValue: append([]string{errorType}, extraLabelValues...),
})
}
}
return metrics
}
// getAllocationStats returns allocation metrics for the given Btrfs Allocation statistics.
func (c *btrfsCollector) getAllocationStats(a string, s *btrfs.AllocationStats) []btrfsMetric {
metrics := []btrfsMetric{
{
name: "reserved_bytes",
desc: "Amount of space reserved for a data type",
metricType: prometheus.GaugeValue,
value: float64(s.ReservedBytes),
extraLabel: []string{"block_group_type"},
extraLabelValue: []string{a},
},
}
// Add all layout statistics.
for layout, stats := range s.Layouts {
metrics = append(metrics, c.getLayoutStats(a, layout, stats)...)
}
return metrics
}
// getLayoutStats returns metrics for a data layout.
func (c *btrfsCollector) getLayoutStats(a, l string, s *btrfs.LayoutUsage) []btrfsMetric {
return []btrfsMetric{
{
name: "used_bytes",
desc: "Amount of used space by a layout/data type",
metricType: prometheus.GaugeValue,
value: float64(s.UsedBytes),
extraLabel: []string{"block_group_type", "mode"},
extraLabelValue: []string{a, l},
},
{
name: "size_bytes",
desc: "Amount of space allocated for a layout/data type",
metricType: prometheus.GaugeValue,
value: float64(s.TotalBytes),
extraLabel: []string{"block_group_type", "mode"},
extraLabelValue: []string{a, l},
},
{
name: "allocation_ratio",
desc: "Data allocation ratio for a layout/data type",
metricType: prometheus.GaugeValue,
value: s.Ratio,
extraLabel: []string{"block_group_type", "mode"},
extraLabelValue: []string{a, l},
},
}
}
================================================
FILE: collector/btrfs_linux_test.go
================================================
// Copyright 2019 The Prometheus Authors
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//go:build !nobtrfs
package collector
import (
"strings"
"testing"
"github.com/prometheus/procfs/btrfs"
)
var expectedBtrfsMetrics = [][]btrfsMetric{
{
{name: "info", value: 1, extraLabel: []string{"label"}, extraLabelValue: []string{"fixture"}},
{name: "global_rsv_size_bytes", value: 1.6777216e+07},
{name: "commits_total", value: 258051, metricType: 1},
{name: "last_commit_seconds", value: 1.0},
{name: "max_commit_seconds", value: 51.462},
{name: "commit_seconds_total", value: 47836.090, metricType: 1},
{name: "reserved_bytes", value: 0, extraLabel: []string{"block_group_type"}, extraLabelValue: []string{"data"}},
{name: "used_bytes", value: 8.08189952e+08, extraLabel: []string{"block_group_type", "mode"}, extraLabelValue: []string{"data", "raid0"}},
{name: "size_bytes", value: 2.147483648e+09, extraLabel: []string{"block_group_type", "mode"}, extraLabelValue: []string{"data", "raid0"}},
{name: "allocation_ratio", value: 1, extraLabel: []string{"block_group_type", "mode"}, extraLabelValue: []string{"data", "raid0"}},
{name: "reserved_bytes", value: 0, extraLabel: []string{"block_group_type"}, extraLabelValue: []string{"metadata"}},
{name: "used_bytes", value: 933888, extraLabel: []string{"block_group_type", "mode"}, extraLabelValue: []string{"metadata", "raid1"}},
{name: "size_bytes", value: 1.073741824e+09, extraLabel: []string{"block_group_type", "mode"}, extraLabelValue: []string{"metadata", "raid1"}},
{name: "allocation_ratio", value: 2, extraLabel: []string{"block_group_type", "mode"}, extraLabelValue: []string{"metadata", "raid1"}},
{name: "reserved_bytes", value: 0, extraLabel: []string{"block_group_type"}, extraLabelValue: []string{"system"}},
{name: "used_bytes", value: 16384, extraLabel: []string{"block_group_type", "mode"}, extraLabelValue: []string{"system", "raid1"}},
{name: "size_bytes", value: 8.388608e+06, extraLabel: []string{"block_group_type", "mode"}, extraLabelValue: []string{"system", "raid1"}},
{name: "allocation_ratio", value: 2, extraLabel: []string{"block_group_type", "mode"}, extraLabelValue: []string{"system", "raid1"}},
{name: "device_size_bytes", value: 1.073741824e+10, extraLabel: []string{"device"}, extraLabelValue: []string{"loop25"}},
{name: "device_size_bytes", value: 1.073741824e+10, extraLabel: []string{"device"}, extraLabelValue: []string{"loop26"}},
},
{
{name: "info", value: 1, extraLabel: []string{"label"}, extraLabelValue: []string{""}},
{name: "global_rsv_size_bytes", value: 1.6777216e+07},
{name: "commits_total", value: 0, metricType: 1},
{name: "last_commit_seconds", value: 0},
{name: "max_commit_seconds", value: 0},
{name: "commit_seconds_total", value: 0, metricType: 1},
{name: "reserved_bytes", value: 0, extraLabel: []string{"block_group_type"}, extraLabelValue: []string{"data"}},
{name: "used_bytes", value: 0, extraLabel: []string{"block_group_type", "mode"}, extraLabelValue: []string{"data", "raid5"}},
{name: "size_bytes", value: 6.44087808e+08, extraLabel: []string{"block_group_type", "mode"}, extraLabelValue: []string{"data", "raid5"}},
{name: "allocation_ratio", value: 1.3333333333333333, extraLabel: []string{"block_group_type", "mode"}, extraLabelValue: []string{"data", "raid5"}},
{name: "reserved_bytes", value: 0, extraLabel: []string{"block_group_type"}, extraLabelValue: []string{"metadata"}},
{name: "used_bytes", value: 114688, extraLabel: []string{"block_group_type", "mode"}, extraLabelValue: []string{"metadata", "raid6"}},
{name: "size_bytes", value: 4.29391872e+08, extraLabel: []string{"block_group_type", "mode"}, extraLabelValue: []string{"metadata", "raid6"}},
{name: "allocation_ratio", value: 2, extraLabel: []string{"block_group_type", "mode"}, extraLabelValue: []string{"metadata", "raid6"}},
{name: "reserved_bytes", value: 0, extraLabel: []string{"block_group_type"}, extraLabelValue: []string{"system"}},
{name: "used_bytes", value: 16384, extraLabel: []string{"block_group_type", "mode"}, extraLabelValue: []string{"system", "raid6"}},
{name: "size_bytes", value: 1.6777216e+07, extraLabel: []string{"block_group_type", "mode"}, extraLabelValue: []string{"system", "raid6"}},
{name: "allocation_ratio", value: 2, extraLabel: []string{"block_group_type", "mode"}, extraLabelValue: []string{"system", "raid6"}},
{name: "device_size_bytes", value: 1.073741824e+10, extraLabel: []string{"device"}, extraLabelValue: []string{"loop22"}},
{name: "device_size_bytes", value: 1.073741824e+10, extraLabel: []string{"device"}, extraLabelValue: []string{"loop23"}},
{name: "device_size_bytes", value: 1.073741824e+10, extraLabel: []string{"device"}, extraLabelValue: []string{"loop24"}},
{name: "device_size_bytes", value: 1.073741824e+10, extraLabel: []string{"device"}, extraLabelValue: []string{"loop25"}},
},
}
func checkMetric(exp, got *btrfsMetric) bool {
if exp.name != got.name ||
exp.value != got.value ||
len(exp.extraLabel) != len(got.extraLabel) ||
len(exp.extraLabelValue) != len(got.extraLabelValue) {
return false
}
for i := range exp.extraLabel {
if exp.extraLabel[i] != got.extraLabel[i] {
return false
}
// Devices (loopXX) can appear in random order, so just check the first 4 characters.
if strings.HasPrefix(got.extraLabelValue[i], "loop") &&
exp.extraLabelValue[i][:4] == got.extraLabelValue[i][:4] {
continue
}
if exp.extraLabelValue[i] != got.extraLabelValue[i] {
return false
}
}
return true
}
func TestBtrfs(t *testing.T) {
fs, err := btrfs.NewFS("fixtures/sys")
if err != nil {
t.Fatal(err)
}
collector := &btrfsCollector{fs: fs}
stats, err := collector.fs.Stats()
if err != nil {
t.Fatalf("Failed to retrieve Btrfs stats: %v", err)
}
if len(stats) != len(expectedBtrfsMetrics) {
t.Fatalf("Unexpected number of Btrfs stats: expected %v, got %v", len(expectedBtrfsMetrics), len(stats))
}
for i, s := range stats {
metrics := collector.getMetrics(s, nil)
if len(metrics) != len(expectedBtrfsMetrics[i]) {
t.Fatalf("Unexpected number of Btrfs metrics: expected %v, got %v", len(expectedBtrfsMetrics[i]), len(metrics))
}
for j, m := range metrics {
exp := expectedBtrfsMetrics[i][j]
if !checkMetric(&exp, &m) {
t.Errorf("Incorrect btrfs metric: expected %#v, got: %#v", exp, m)
}
}
}
}
================================================
FILE: collector/buddyinfo.go
================================================
// Copyright 2017 The Prometheus Authors
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//go:build !nobuddyinfo && !netbsd
package collector
import (
"fmt"
"log/slog"
"strconv"
"github.com/prometheus/client_golang/prometheus"
"github.com/prometheus/procfs"
)
const (
buddyInfoSubsystem = "buddyinfo"
)
type buddyinfoCollector struct {
fs procfs.FS
desc *prometheus.Desc
logger *slog.Logger
}
func init() {
registerCollector("buddyinfo", defaultDisabled, NewBuddyinfoCollector)
}
// NewBuddyinfoCollector returns a new Collector exposing buddyinfo stats.
func NewBuddyinfoCollector(logger *slog.Logger) (Collector, error) {
desc := prometheus.NewDesc(
prometheus.BuildFQName(namespace, buddyInfoSubsystem, "blocks"),
"Count of free blocks according to size.",
[]string{"node", "zone", "size"}, nil,
)
fs, err := procfs.NewFS(*procPath)
if err != nil {
return nil, fmt.Errorf("failed to open procfs: %w", err)
}
return &buddyinfoCollector{fs, desc, logger}, nil
}
// Update calls (*buddyinfoCollector).getBuddyInfo to get the platform specific
// buddyinfo metrics.
func (c *buddyinfoCollector) Update(ch chan<- prometheus.Metric) error {
buddyInfo, err := c.fs.BuddyInfo()
if err != nil {
return fmt.Errorf("couldn't get buddyinfo: %w", err)
}
c.logger.Debug("Set node_buddy", "buddyInfo", buddyInfo)
for _, entry := range buddyInfo {
for size, value := range entry.Sizes {
ch <- prometheus.MustNewConstMetric(
c.desc,
prometheus.GaugeValue, value,
entry.Node, entry.Zone, strconv.Itoa(size),
)
}
}
return nil
}
================================================
FILE: collector/cgroups_linux.go
================================================
// Copyright 2022 The Prometheus Authors
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//go:build !nostat
package collector
import (
"fmt"
"log/slog"
"github.com/prometheus/client_golang/prometheus"
"github.com/prometheus/procfs"
)
const cgroupsCollectorSubsystem = "cgroups"
type cgroupSummaryCollector struct {
fs procfs.FS
cgroups *prometheus.Desc
enabled *prometheus.Desc
logger *slog.Logger
}
func init() {
registerCollector(cgroupsCollectorSubsystem, defaultDisabled, NewCgroupSummaryCollector)
}
// NewCgroupSummaryCollector returns a new Collector exposing a summary of cgroups.
func NewCgroupSummaryCollector(logger *slog.Logger) (Collector, error) {
fs, err := procfs.NewFS(*procPath)
if err != nil {
return nil, fmt.Errorf("failed to open procfs: %w", err)
}
return &cgroupSummaryCollector{
fs: fs,
cgroups: prometheus.NewDesc(
prometheus.BuildFQName(namespace, cgroupsCollectorSubsystem, "cgroups"),
"Current cgroup number of the subsystem.",
[]string{"subsys_name"}, nil,
),
enabled: prometheus.NewDesc(
prometheus.BuildFQName(namespace, cgroupsCollectorSubsystem, "enabled"),
"Current cgroup number of the subsystem.",
[]string{"subsys_name"}, nil,
),
logger: logger,
}, nil
}
// Update implements Collector and exposes cgroup statistics.
func (c *cgroupSummaryCollector) Update(ch chan<- prometheus.Metric) error {
cgroupSummarys, err := c.fs.CgroupSummarys()
if err != nil {
return err
}
for _, cs := range cgroupSummarys {
ch <- prometheus.MustNewConstMetric(c.cgroups, prometheus.GaugeValue, float64(cs.Cgroups), cs.SubsysName)
ch <- prometheus.MustNewConstMetric(c.enabled, prometheus.GaugeValue, float64(cs.Enabled), cs.SubsysName)
}
return nil
}
================================================
FILE: collector/collector.go
================================================
// Copyright 2015 The Prometheus Authors
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
// Package collector includes all individual collectors to gather and export system metrics.
package collector
import (
"errors"
"fmt"
"log/slog"
"sync"
"time"
"github.com/alecthomas/kingpin/v2"
"github.com/prometheus/client_golang/prometheus"
)
// Namespace defines the common namespace to be used by all metrics.
const namespace = "node"
var (
scrapeDurationDesc = prometheus.NewDesc(
prometheus.BuildFQName(namespace, "scrape", "collector_duration_seconds"),
"node_exporter: Duration of a collector scrape.",
[]string{"collector"},
nil,
)
scrapeSuccessDesc = prometheus.NewDesc(
prometheus.BuildFQName(namespace, "scrape", "collector_success"),
"node_exporter: Whether a collector succeeded.",
[]string{"collector"},
nil,
)
)
const (
defaultEnabled = true
defaultDisabled = false
)
var (
factories = make(map[string]func(logger *slog.Logger) (Collector, error))
initiatedCollectorsMtx = sync.Mutex{}
initiatedCollectors = make(map[string]Collector)
collectorState = make(map[string]*bool)
forcedCollectors = map[string]bool{} // collectors which have been explicitly enabled or disabled
)
func registerCollector(collector string, isDefaultEnabled bool, factory func(logger *slog.Logger) (Collector, error)) {
var helpDefaultState string
if isDefaultEnabled {
helpDefaultState = "enabled"
} else {
helpDefaultState = "disabled"
}
flagName := fmt.Sprintf("collector.%s", collector)
flagHelp := fmt.Sprintf("Enable the %s collector (default: %s).", collector, helpDefaultState)
defaultValue := fmt.Sprintf("%v", isDefaultEnabled)
flag := kingpin.Flag(flagName, flagHelp).Default(defaultValue).Action(collectorFlagAction(collector)).Bool()
collectorState[collector] = flag
factories[collector] = factory
}
// NodeCollector implements the prometheus.Collector interface.
type NodeCollector struct {
Collectors map[string]Collector
logger *slog.Logger
}
// DisableDefaultCollectors sets the collector state to false for all collectors which
// have not been explicitly enabled on the command line.
func DisableDefaultCollectors() {
for c := range collectorState {
if _, ok := forcedCollectors[c]; !ok {
*collectorState[c] = false
}
}
}
// collectorFlagAction generates a new action function for the given collector
// to track whether it has been explicitly enabled or disabled from the command line.
// A new action function is needed for each collector flag because the ParseContext
// does not contain information about which flag called the action.
// See: https://github.com/alecthomas/kingpin/issues/294
func collectorFlagAction(collector string) func(ctx *kingpin.ParseContext) error {
return func(ctx *kingpin.ParseContext) error {
forcedCollectors[collector] = true
return nil
}
}
// NewNodeCollector creates a new NodeCollector.
func NewNodeCollector(logger *slog.Logger, filters ...string) (*NodeCollector, error) {
f := make(map[string]bool)
for _, filter := range filters {
enabled, exist := collectorState[filter]
if !exist {
return nil, fmt.Errorf("missing collector: %s", filter)
}
if !*enabled {
return nil, fmt.Errorf("disabled collector: %s", filter)
}
f[filter] = true
}
collectors := make(map[string]Collector)
initiatedCollectorsMtx.Lock()
defer initiatedCollectorsMtx.Unlock()
for key, enabled := range collectorState {
if !*enabled || (len(f) > 0 && !f[key]) {
continue
}
if collector, ok := initiatedCollectors[key]; ok {
collectors[key] = collector
} else {
collector, err := factories[key](logger.With("collector", key))
if err != nil {
return nil, err
}
collectors[key] = collector
initiatedCollectors[key] = collector
}
}
return &NodeCollector{Collectors: collectors, logger: logger}, nil
}
// Describe implements the prometheus.Collector interface.
func (n NodeCollector) Describe(ch chan<- *prometheus.Desc) {
ch <- scrapeDurationDesc
ch <- scrapeSuccessDesc
}
// Collect implements the prometheus.Collector interface.
func (n NodeCollector) Collect(ch chan<- prometheus.Metric) {
wg := sync.WaitGroup{}
wg.Add(len(n.Collectors))
for name, c := range n.Collectors {
go func(name string, c Collector) {
execute(name, c, ch, n.logger)
wg.Done()
}(name, c)
}
wg.Wait()
}
func execute(name string, c Collector, ch chan<- prometheus.Metric, logger *slog.Logger) {
begin := time.Now()
err := c.Update(ch)
duration := time.Since(begin)
var success float64
if err != nil {
if IsNoDataError(err) {
logger.Debug("collector returned no data", "name", name, "duration_seconds", duration.Seconds(), "err", err)
} else {
logger.Error("collector failed", "name", name, "duration_seconds", duration.Seconds(), "err", err)
}
success = 0
} else {
logger.Debug("collector succeeded", "name", name, "duration_seconds", duration.Seconds())
success = 1
}
ch <- prometheus.MustNewConstMetric(scrapeDurationDesc, prometheus.GaugeValue, duration.Seconds(), name)
ch <- prometheus.MustNewConstMetric(scrapeSuccessDesc, prometheus.GaugeValue, success, name)
}
// Collector is the interface a collector has to implement.
type Collector interface {
// Get new metrics and expose them via prometheus registry.
Update(ch chan<- prometheus.Metric) error
}
type typedDesc struct {
desc *prometheus.Desc
valueType prometheus.ValueType
}
func (d *typedDesc) mustNewConstMetric(value float64, labels ...string) prometheus.Metric {
return prometheus.MustNewConstMetric(d.desc, d.valueType, value, labels...)
}
// ErrNoData indicates the collector found no data to collect, but had no other error.
var ErrNoData = errors.New("collector returned no data")
func IsNoDataError(err error) bool {
return err == ErrNoData
}
// pushMetric helps construct and convert a variety of value types into Prometheus float64 metrics.
func pushMetric(ch chan<- prometheus.Metric, fieldDesc *prometheus.Desc, name string, value any, valueType prometheus.ValueType, labelValues ...string) {
var fVal float64
switch val := value.(type) {
case uint8:
fVal = float64(val)
case uint16:
fVal = float64(val)
case uint32:
fVal = float64(val)
case uint64:
fVal = float64(val)
case int64:
fVal = float64(val)
case *uint8:
if val == nil {
return
}
fVal = float64(*val)
case *uint16:
if val == nil {
return
}
fVal = float64(*val)
case *uint32:
if val == nil {
return
}
fVal = float64(*val)
case *uint64:
if val == nil {
return
}
fVal = float64(*val)
case *int64:
if val == nil {
return
}
fVal = float64(*val)
default:
return
}
ch <- prometheus.MustNewConstMetric(fieldDesc, valueType, fVal, labelValues...)
}
================================================
FILE: collector/conntrack_linux.go
================================================
// Copyright 2015 The Prometheus Authors
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//go:build !noconntrack
package collector
import (
"errors"
"fmt"
"log/slog"
"os"
"github.com/prometheus/client_golang/prometheus"
"github.com/prometheus/procfs"
)
type conntrackCollector struct {
current *prometheus.Desc
limit *prometheus.Desc
found *prometheus.Desc
invalid *prometheus.Desc
ignore *prometheus.Desc
insert *prometheus.Desc
insertFailed *prometheus.Desc
drop *prometheus.Desc
earlyDrop *prometheus.Desc
searchRestart *prometheus.Desc
logger *slog.Logger
}
type conntrackStatistics struct {
found uint64 // Number of searched entries which were successful
invalid uint64 // Number of packets seen which can not be tracked
ignore uint64 // Number of packets seen which are already connected to a conntrack entry
insert uint64 // Number of entries inserted into the list
insertFailed uint64 // Number of entries for which list insertion was attempted but failed (happens if the same entry is already present)
drop uint64 // Number of packets dropped due to conntrack failure. Either new conntrack entry allocation failed, or protocol helper dropped the packet
earlyDrop uint64 // Number of dropped conntrack entries to make room for new ones, if maximum table size was reached
searchRestart uint64 // Number of conntrack table lookups which had to be restarted due to hashtable resizes
}
func init() {
registerCollector("conntrack", defaultEnabled, NewConntrackCollector)
}
// NewConntrackCollector returns a new Collector exposing conntrack stats.
func NewConntrackCollector(logger *slog.Logger) (Collector, error) {
return &conntrackCollector{
current: prometheus.NewDesc(
prometheus.BuildFQName(namespace, "", "nf_conntrack_entries"),
"Number of currently allocated flow entries for connection tracking.",
nil, nil,
),
limit: prometheus.NewDesc(
prometheus.BuildFQName(namespace, "", "nf_conntrack_entries_limit"),
"Maximum size of connection tracking table.",
nil, nil,
),
found: prometheus.NewDesc(
prometheus.BuildFQName(namespace, "", "nf_conntrack_stat_found"),
"Number of searched entries which were successful.",
nil, nil,
),
invalid: prometheus.NewDesc(
prometheus.BuildFQName(namespace, "", "nf_conntrack_stat_invalid"),
"Number of packets seen which can not be tracked.",
nil, nil,
),
ignore: prometheus.NewDesc(
prometheus.BuildFQName(namespace, "", "nf_conntrack_stat_ignore"),
"Number of packets seen which are already connected to a conntrack entry.",
nil, nil,
),
insert: prometheus.NewDesc(
prometheus.BuildFQName(namespace, "", "nf_conntrack_stat_insert"),
"Number of entries inserted into the list.",
nil, nil,
),
insertFailed: prometheus.NewDesc(
prometheus.BuildFQName(namespace, "", "nf_conntrack_stat_insert_failed"),
"Number of entries for which list insertion was attempted but failed.",
nil, nil,
),
drop: prometheus.NewDesc(
prometheus.BuildFQName(namespace, "", "nf_conntrack_stat_drop"),
"Number of packets dropped due to conntrack failure.",
nil, nil,
),
earlyDrop: prometheus.NewDesc(
prometheus.BuildFQName(namespace, "", "nf_conntrack_stat_early_drop"),
"Number of dropped conntrack entries to make room for new ones, if maximum table size was reached.",
nil, nil,
),
searchRestart: prometheus.NewDesc(
prometheus.BuildFQName(namespace, "", "nf_conntrack_stat_search_restart"),
"Number of conntrack table lookups which had to be restarted due to hashtable resizes.",
nil, nil,
),
logger: logger,
}, nil
}
func (c *conntrackCollector) Update(ch chan<- prometheus.Metric) error {
value, err := readUintFromFile(procFilePath("sys/net/netfilter/nf_conntrack_count"))
if err != nil {
return c.handleErr(err)
}
ch <- prometheus.MustNewConstMetric(
c.current, prometheus.GaugeValue, float64(value))
value, err = readUintFromFile(procFilePath("sys/net/netfilter/nf_conntrack_max"))
if err != nil {
return c.handleErr(err)
}
ch <- prometheus.MustNewConstMetric(
c.limit, prometheus.GaugeValue, float64(value))
conntrackStats, err := getConntrackStatistics()
if err != nil {
return c.handleErr(err)
}
ch <- prometheus.MustNewConstMetric(
c.found, prometheus.GaugeValue, float64(conntrackStats.found))
ch <- prometheus.MustNewConstMetric(
c.invalid, prometheus.GaugeValue, float64(conntrackStats.invalid))
ch <- prometheus.MustNewConstMetric(
c.ignore, prometheus.GaugeValue, float64(conntrackStats.ignore))
ch <- prometheus.MustNewConstMetric(
c.insert, prometheus.GaugeValue, float64(conntrackStats.insert))
ch <- prometheus.MustNewConstMetric(
c.insertFailed, prometheus.GaugeValue, float64(conntrackStats.insertFailed))
ch <- prometheus.MustNewConstMetric(
c.drop, prometheus.GaugeValue, float64(conntrackStats.drop))
ch <- prometheus.MustNewConstMetric(
c.earlyDrop, prometheus.GaugeValue, float64(conntrackStats.earlyDrop))
ch <- prometheus.MustNewConstMetric(
c.searchRestart, prometheus.GaugeValue, float64(conntrackStats.searchRestart))
return nil
}
func (c *conntrackCollector) handleErr(err error) error {
if errors.Is(err, os.ErrNotExist) {
c.logger.Debug("conntrack probably not loaded")
return ErrNoData
}
return fmt.Errorf("failed to retrieve conntrack stats: %w", err)
}
func getConntrackStatistics() (*conntrackStatistics, error) {
c := conntrackStatistics{}
fs, err := procfs.NewFS(*procPath)
if err != nil {
return nil, fmt.Errorf("failed to open procfs: %w", err)
}
connStats, err := fs.ConntrackStat()
if err != nil {
return nil, err
}
for _, connStat := range connStats {
c.found += connStat.Found
c.invalid += connStat.Invalid
c.ignore += connStat.Ignore
c.insert += connStat.Insert
c.insertFailed += connStat.InsertFailed
c.drop += connStat.Drop
c.earlyDrop += connStat.EarlyDrop
c.searchRestart += connStat.SearchRestart
}
return &c, nil
}
================================================
FILE: collector/cpu_aix.go
================================================
// Copyright 2024 The Prometheus Authors
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//go:build !nocpu
package collector
/*
#include <unistd.h> // Include the standard Unix header
#include <errno.h> // For errno
*/
import "C"
import (
"fmt"
"log/slog"
"strconv"
"github.com/power-devops/perfstat"
"github.com/prometheus/client_golang/prometheus"
)
var (
nodeCPUPhysicalSecondsDesc = prometheus.NewDesc(
prometheus.BuildFQName(namespace, cpuCollectorSubsystem, "physical_seconds_total"),
"Seconds the physical CPUs spent in each mode.",
[]string{"cpu", "mode"}, nil,
)
nodeCPUSRunQueueDesc = prometheus.NewDesc(
prometheus.BuildFQName(namespace, cpuCollectorSubsystem, "runqueue"),
"Length of the run queue.", []string{"cpu"}, nil,
)
nodeCPUFlagsDesc = prometheus.NewDesc(
prometheus.BuildFQName(namespace, cpuCollectorSubsystem, "flags"),
"CPU flags.",
[]string{"cpu", "flag"}, nil,
)
nodeCPUContextSwitchDesc = prometheus.NewDesc(
prometheus.BuildFQName(namespace, cpuCollectorSubsystem, "context_switches_total"),
"Number of context switches.",
[]string{"cpu"}, nil,
)
)
type cpuCollector struct {
cpu typedDesc
cpuPhysical typedDesc
cpuRunQueue typedDesc
cpuFlags typedDesc
cpuContextSwitch typedDesc
logger *slog.Logger
tickPerSecond float64
purrTicksPerSecond float64
}
func init() {
registerCollector("cpu", defaultEnabled, NewCpuCollector)
}
func tickPerSecond() (float64, error) {
ticks, err := C.sysconf(C._SC_CLK_TCK)
if ticks == -1 || err != nil {
return 0, fmt.Errorf("failed to get clock ticks per second: %v", err)
}
return float64(ticks), nil
}
func NewCpuCollector(logger *slog.Logger) (Collector, error) {
ticks, err := tickPerSecond()
if err != nil {
return nil, err
}
pconfig, err := perfstat.PartitionStat()
if err != nil {
return nil, err
}
return &cpuCollector{
cpu: typedDesc{nodeCPUSecondsDesc, prometheus.CounterValue},
cpuPhysical: typedDesc{nodeCPUPhysicalSecondsDesc, prometheus.CounterValue},
cpuRunQueue: typedDesc{nodeCPUSRunQueueDesc, prometheus.GaugeValue},
cpuFlags: typedDesc{nodeCPUFlagsDesc, prometheus.GaugeValue},
cpuContextSwitch: typedDesc{nodeCPUContextSwitchDesc, prometheus.CounterValue},
logger: logger,
tickPerSecond: ticks,
purrTicksPerSecond: float64(pconfig.ProcessorMhz * 1e6),
}, nil
}
func (c *cpuCollector) Update(ch chan<- prometheus.Metric) error {
stats, err := perfstat.CpuStat()
if err != nil {
return err
}
for n, stat := range stats {
// LPAR metrics
ch <- c.cpu.mustNewConstMetric(float64(stat.User)/c.tickPerSecond, strconv.Itoa(n), "user")
ch <- c.cpu.mustNewConstMetric(float64(stat.Sys)/c.tickPerSecond, strconv.Itoa(n), "system")
ch <- c.cpu.mustNewConstMetric(float64(stat.Idle)/c.tickPerSecond, strconv.Itoa(n), "idle")
ch <- c.cpu.mustNewConstMetric(float64(stat.Wait)/c.tickPerSecond, strconv.Itoa(n), "wait")
// Physical CPU metrics
ch <- c.cpuPhysical.mustNewConstMetric(float64(stat.PIdle)/c.purrTicks
gitextract_59ovhae2/ ├── .circleci/ │ └── config.yml ├── .dockerignore ├── .github/ │ ├── ISSUE_TEMPLATE.md │ ├── dependabot.yml │ └── workflows/ │ ├── bsd.yml │ ├── container_description.yml │ └── golangci-lint.yml ├── .gitignore ├── .golangci.yml ├── .promu-cgo.yml ├── .promu.yml ├── .yamllint ├── CHANGELOG.md ├── CODE_OF_CONDUCT.md ├── CONTRIBUTING.md ├── Dockerfile ├── LICENSE ├── MAINTAINERS.md ├── Makefile ├── Makefile.common ├── NOTICE ├── README.md ├── SECURITY.md ├── VERSION ├── checkmetrics.sh ├── collector/ │ ├── arp_linux.go │ ├── bcache_linux.go │ ├── bcachefs_linux.go │ ├── bonding_linux.go │ ├── bonding_linux_test.go │ ├── boot_time_bsd.go │ ├── boot_time_solaris.go │ ├── btrfs_linux.go │ ├── btrfs_linux_test.go │ ├── buddyinfo.go │ ├── cgroups_linux.go │ ├── collector.go │ ├── conntrack_linux.go │ ├── cpu_aix.go │ ├── cpu_common.go │ ├── cpu_darwin.go │ ├── cpu_dragonfly.go │ ├── cpu_dragonfly_test.go │ ├── cpu_freebsd.go │ ├── cpu_linux.go │ ├── cpu_linux_test.go │ ├── cpu_netbsd.go │ ├── cpu_netbsd_test.go │ ├── cpu_openbsd.go │ ├── cpu_solaris.go │ ├── cpu_vulnerabilities_linux.go │ ├── cpufreq_common.go │ ├── cpufreq_linux.go │ ├── cpufreq_solaris.go │ ├── device_filter.go │ ├── device_filter_test.go │ ├── devstat_dragonfly.go │ ├── devstat_freebsd.c │ ├── devstat_freebsd.go │ ├── devstat_freebsd.h │ ├── diskstats_aix.go │ ├── diskstats_common.go │ ├── diskstats_darwin.go │ ├── diskstats_linux.go │ ├── diskstats_linux_test.go │ ├── diskstats_openbsd.go │ ├── diskstats_openbsd_amd64.go │ ├── dmi.go │ ├── drbd_linux.go │ ├── drm_linux.go │ ├── edac_linux.go │ ├── entropy_linux.go │ ├── ethtool_linux.go │ ├── ethtool_linux_test.go │ ├── exec_bsd.go │ ├── fibrechannel_linux.go │ ├── filefd_linux.go │ ├── filefd_linux_test.go │ ├── filesystem_aix.go │ ├── filesystem_bsd.go │ ├── filesystem_common.go │ ├── filesystem_freebsd.go │ ├── filesystem_linux.go │ ├── filesystem_linux_test.go │ ├── filesystem_macos.go │ ├── filesystem_netbsd.go │ ├── filesystem_openbsd.go │ ├── fixtures/ │ │ ├── e2e-64k-page-output.txt │ │ ├── e2e-output-darwin.txt │ │ ├── e2e-output-dragonfly.txt │ │ ├── e2e-output-freebsd.txt │ │ ├── e2e-output-netbsd.txt │ │ ├── e2e-output-openbsd.txt │ │ ├── e2e-output-solaris.txt │ │ ├── e2e-output.txt │ │ ├── ethtool/ │ │ │ ├── bond0/ │ │ │ │ └── statistics │ │ │ └── eth0/ │ │ │ ├── driver │ │ │ ├── settings │ │ │ └── statistics │ │ ├── ip_vs_result.txt │ │ ├── ip_vs_result_lbs_local_address_local_port.txt │ │ ├── ip_vs_result_lbs_local_port.txt │ │ ├── ip_vs_result_lbs_none.txt │ │ ├── pci.ids │ │ ├── pcidevice-names-output.txt │ │ ├── proc/ │ │ │ ├── 1/ │ │ │ │ ├── mountinfo │ │ │ │ └── stat │ │ │ ├── 10/ │ │ │ │ ├── mountinfo │ │ │ │ ├── mountstats │ │ │ │ └── stat │ │ │ ├── 11/ │ │ │ │ ├── .missing_stat │ │ │ │ └── stat │ │ │ ├── buddyinfo │ │ │ ├── cgroups │ │ │ ├── cpuinfo │ │ │ ├── diskstats │ │ │ ├── drbd │ │ │ ├── interrupts │ │ │ ├── interrupts_aarch64 │ │ │ ├── loadavg │ │ │ ├── mdstat │ │ │ ├── meminfo │ │ │ ├── net/ │ │ │ │ ├── arp │ │ │ │ ├── ip_vs │ │ │ │ ├── ip_vs_stats │ │ │ │ ├── netstat │ │ │ │ ├── rpc/ │ │ │ │ │ ├── nfs │ │ │ │ │ └── nfsd │ │ │ │ ├── snmp │ │ │ │ ├── snmp6 │ │ │ │ ├── sockstat │ │ │ │ ├── sockstat6 │ │ │ │ ├── softnet_stat │ │ │ │ ├── stat/ │ │ │ │ │ ├── arp_cache │ │ │ │ │ ├── ndisc_cache │ │ │ │ │ └── nf_conntrack │ │ │ │ ├── udp │ │ │ │ └── xfrm_stat │ │ │ ├── pressure/ │ │ │ │ ├── cpu │ │ │ │ ├── io │ │ │ │ ├── irq │ │ │ │ └── memory │ │ │ ├── schedstat │ │ │ ├── slabinfo │ │ │ ├── softirqs │ │ │ ├── spl/ │ │ │ │ └── kstat/ │ │ │ │ └── zfs/ │ │ │ │ ├── abdstats │ │ │ │ ├── arcstats │ │ │ │ ├── dbufstats │ │ │ │ ├── dmu_tx │ │ │ │ ├── dnodestats │ │ │ │ ├── fm │ │ │ │ ├── pool1/ │ │ │ │ │ ├── io │ │ │ │ │ ├── objset-1 │ │ │ │ │ ├── objset-2 │ │ │ │ │ └── state │ │ │ │ ├── pool2/ │ │ │ │ │ └── state │ │ │ │ ├── pool3/ │ │ │ │ │ ├── io │ │ │ │ │ ├── objset-1 │ │ │ │ │ ├── objset-2 │ │ │ │ │ └── state │ │ │ │ ├── poolz1/ │ │ │ │ │ ├── io │ │ │ │ │ ├── objset-1 │ │ │ │ │ ├── objset-2 │ │ │ │ │ └── state │ │ │ │ ├── vdev_cache_stats │ │ │ │ ├── vdev_mirror_stats │ │ │ │ ├── xuio_stats │ │ │ │ ├── zfetchstats │ │ │ │ └── zil │ │ │ ├── stat │ │ │ ├── swaps │ │ │ ├── sys/ │ │ │ │ ├── fs/ │ │ │ │ │ └── file-nr │ │ │ │ ├── kernel/ │ │ │ │ │ ├── pid_max │ │ │ │ │ ├── random/ │ │ │ │ │ │ ├── entropy_avail │ │ │ │ │ │ └── poolsize │ │ │ │ │ ├── seccomp/ │ │ │ │ │ │ └── actions_avail │ │ │ │ │ └── threads-max │ │ │ │ ├── net/ │ │ │ │ │ └── netfilter/ │ │ │ │ │ ├── nf_conntrack_count │ │ │ │ │ └── nf_conntrack_max │ │ │ │ ├── pid_max │ │ │ │ └── threads-max │ │ │ ├── vmstat │ │ │ └── zoneinfo │ │ ├── qdisc/ │ │ │ └── results.json │ │ ├── sys.ttar │ │ ├── textfile/ │ │ │ ├── client_side_timestamp/ │ │ │ │ └── metrics.prom │ │ │ ├── client_side_timestamp.out │ │ │ ├── different_metric_types/ │ │ │ │ └── metrics.prom │ │ │ ├── different_metric_types.out │ │ │ ├── glob_extra_dimension.out │ │ │ ├── histogram/ │ │ │ │ └── metrics.prom │ │ │ ├── histogram.out │ │ │ ├── histogram_extra_dimension/ │ │ │ │ └── metrics.prom │ │ │ ├── histogram_extra_dimension.out │ │ │ ├── inconsistent_metrics/ │ │ │ │ └── metrics.prom │ │ │ ├── inconsistent_metrics.out │ │ │ ├── metrics_merge_different_help/ │ │ │ │ ├── a.prom │ │ │ │ └── b.prom │ │ │ ├── metrics_merge_different_help.out │ │ │ ├── metrics_merge_empty_help/ │ │ │ │ ├── a.prom │ │ │ │ └── b.prom │ │ │ ├── metrics_merge_empty_help.out │ │ │ ├── metrics_merge_no_help/ │ │ │ │ ├── a.prom │ │ │ │ └── b.prom │ │ │ ├── metrics_merge_no_help.out │ │ │ ├── metrics_merge_same_help/ │ │ │ │ ├── a.prom │ │ │ │ └── b.prom │ │ │ ├── metrics_merge_same_help.out │ │ │ ├── no_metric_files/ │ │ │ │ └── non_matching_file.txt │ │ │ ├── no_metric_files.out │ │ │ ├── nonexistent_path.out │ │ │ ├── summary/ │ │ │ │ └── metrics.prom │ │ │ ├── summary.out │ │ │ ├── summary_extra_dimension/ │ │ │ │ └── metrics.prom │ │ │ ├── summary_extra_dimension.out │ │ │ ├── two_metric_files/ │ │ │ │ ├── metrics1.prom │ │ │ │ ├── metrics2.prom │ │ │ │ └── non_matching_file.txt │ │ │ └── two_metric_files.out │ │ ├── udev.ttar │ │ ├── usr/ │ │ │ └── lib/ │ │ │ └── os-release │ │ └── wifi/ │ │ ├── interfaces.json │ │ └── wlan0/ │ │ ├── bss.json │ │ └── stationinfo.json │ ├── fixtures_bindmount/ │ │ └── proc/ │ │ └── 1/ │ │ └── mountinfo │ ├── fixtures_hidepid/ │ │ └── proc/ │ │ └── self/ │ │ └── mountinfo │ ├── helper.go │ ├── helper_test.go │ ├── hwmon_linux.go │ ├── infiniband_linux.go │ ├── interrupts_common.go │ ├── interrupts_linux.go │ ├── interrupts_linux_test.go │ ├── interrupts_openbsd.go │ ├── interrupts_openbsd_amd64.go │ ├── ipvs_linux.go │ ├── ipvs_linux_test.go │ ├── kernel_hung_linux.go │ ├── ksmd_linux.go │ ├── kvm_bsd.c │ ├── kvm_bsd.go │ ├── kvm_bsd.h │ ├── lnstat_linux.go │ ├── loadavg.go │ ├── loadavg_aix.go │ ├── loadavg_bsd.go │ ├── loadavg_linux.go │ ├── loadavg_linux_test.go │ ├── loadavg_solaris.go │ ├── logind_linux.go │ ├── logind_linux_test.go │ ├── mdadm_linux.go │ ├── mdadm_linux_test.go │ ├── meminfo.go │ ├── meminfo_aix.go │ ├── meminfo_darwin.go │ ├── meminfo_linux.go │ ├── meminfo_linux_test.go │ ├── meminfo_netbsd.go │ ├── meminfo_numa_linux.go │ ├── meminfo_numa_linux_test.go │ ├── meminfo_openbsd.go │ ├── meminfo_openbsd_amd64.go │ ├── memory_bsd.go │ ├── mountstats_linux.go │ ├── netclass_linux.go │ ├── netclass_rtnl_linux.go │ ├── netdev_aix.go │ ├── netdev_bsd.go │ ├── netdev_common.go │ ├── netdev_darwin.go │ ├── netdev_linux.go │ ├── netdev_linux_test.go │ ├── netdev_openbsd.go │ ├── netdev_openbsd_amd64.go │ ├── netinterface_aix.go │ ├── netisr_freebsd.go │ ├── netstat_freebsd.go │ ├── netstat_freebsd_test.go │ ├── netstat_linux.go │ ├── netstat_linux_test.go │ ├── network_route_linux.go │ ├── nfs_linux.go │ ├── nfsd_linux.go │ ├── ntp.go │ ├── nvme_linux.go │ ├── os_release.go │ ├── os_release_test.go │ ├── partition_aix.go │ ├── paths.go │ ├── paths_test.go │ ├── pcidevice_linux.go │ ├── pcidevice_linux_test.go │ ├── perf_linux.go │ ├── perf_linux_test.go │ ├── powersupplyclass.go │ ├── powersupplyclass_darwin.go │ ├── powersupplyclass_linux.go │ ├── pressure_linux.go │ ├── processes_linux.go │ ├── processes_linux_test.go │ ├── qdisc_linux.go │ ├── rapl_linux.go │ ├── runit.go │ ├── schedstat_linux.go │ ├── selinux_linux.go │ ├── slabinfo_linux.go │ ├── sockstat_linux.go │ ├── softirqs_common.go │ ├── softirqs_linux.go │ ├── softnet_linux.go │ ├── stat_linux.go │ ├── supervisord.go │ ├── swap_linux.go │ ├── swap_linux_test.go │ ├── sysctl_bsd.go │ ├── sysctl_linux.go │ ├── sysctl_openbsd_amd64.go │ ├── systemd_linux.go │ ├── systemd_linux_test.go │ ├── tapestats_linux.go │ ├── tcpstat_linux.go │ ├── tcpstat_linux_test.go │ ├── textfile.go │ ├── textfile_test.go │ ├── thermal_darwin.go │ ├── thermal_darwin_amd64.go │ ├── thermal_darwin_arm64.go │ ├── thermal_zone_linux.go │ ├── time.go │ ├── time_linux.go │ ├── time_other.go │ ├── timex.go │ ├── udp_queues_linux.go │ ├── uname.go │ ├── uname_bsd.go │ ├── uname_linux.go │ ├── utils/ │ │ ├── utils.go │ │ └── utils_test.go │ ├── vmstat_linux.go │ ├── watchdog.go │ ├── watchdog_test.go │ ├── wifi_linux.go │ ├── xfrm.go │ ├── xfrm_test.go │ ├── xfs_linux.go │ ├── zfs_common.go │ ├── zfs_freebsd.go │ ├── zfs_linux.go │ ├── zfs_linux_test.go │ ├── zfs_solaris.go │ └── zoneinfo_linux.go ├── docs/ │ ├── TIME.md │ ├── V0_16_UPGRADE_GUIDE.md │ ├── example-16-compatibility-rules-new-to-old.yml │ ├── example-16-compatibility-rules.yml │ ├── example-17-compatibility-rules-new-to-old.yml │ ├── example-17-compatibility-rules.yml │ └── node-mixin/ │ ├── .gitignore │ ├── Makefile │ ├── README.md │ ├── alerts/ │ │ └── alerts.libsonnet │ ├── alerts.jsonnet │ ├── config.libsonnet │ ├── dashboards/ │ │ ├── dashboards.libsonnet │ │ ├── node.libsonnet │ │ └── use.libsonnet │ ├── dashboards.jsonnet │ ├── jsonnetfile.json │ ├── lib/ │ │ └── prom-mixin.libsonnet │ ├── mixin.libsonnet │ ├── rules/ │ │ └── rules.libsonnet │ └── rules.jsonnet ├── end-to-end-test.sh ├── example-rules.yml ├── examples/ │ ├── init.d/ │ │ └── node_exporter │ ├── launchctl/ │ │ ├── README.md │ │ └── io.prometheus.node_exporter.plist │ ├── openbsd-rc.d/ │ │ └── node_exporter │ ├── openwrt-init.d/ │ │ └── node_exporter │ └── systemd/ │ ├── README.md │ ├── node_exporter.service │ ├── node_exporter.socket │ └── sysconfig.node_exporter ├── go.mod ├── go.sum ├── node_exporter.go ├── node_exporter_test.go ├── staticcheck.conf ├── test_image.sh ├── text_collector_examples/ │ └── README.md ├── tls_config_noAuth.bad.yml ├── tools/ │ └── main.go └── ttar
SYMBOL INDEX (1092 symbols across 189 files)
FILE: collector/arp_linux.go
type arpCollector (line 35) | type arpCollector struct
method Update (line 102) | func (c *arpCollector) Update(ch chan<- prometheus.Metric) error {
function init (line 42) | func init() {
function NewARPCollector (line 47) | func NewARPCollector(logger *slog.Logger) (Collector, error) {
function getTotalArpEntries (line 65) | func getTotalArpEntries(deviceEntries []procfs.ARPEntry) map[string]uint...
function getTotalArpEntriesRTNL (line 75) | func getTotalArpEntriesRTNL() (map[string]uint32, error) {
FILE: collector/bcache_linux.go
function init (line 31) | func init() {
type bcacheCollector (line 36) | type bcacheCollector struct
method Update (line 57) | func (c *bcacheCollector) Update(ch chan<- prometheus.Metric) error {
method updateBcacheStats (line 154) | func (c *bcacheCollector) updateBcacheStats(ch chan<- prometheus.Metri...
function NewBcacheCollector (line 43) | func NewBcacheCollector(logger *slog.Logger) (Collector, error) {
type bcacheMetric (line 75) | type bcacheMetric struct
function bcachePeriodStatsToMetric (line 84) | func bcachePeriodStatsToMetric(ps *bcache.PeriodStats, labelValue string...
FILE: collector/bcachefs_linux.go
constant subsystem (line 27) | subsystem = "bcachefs"
function init (line 110) | func init() {
type bcachefsCollector (line 115) | type bcachefsCollector struct
method Update (line 134) | func (c *bcachefsCollector) Update(ch chan<- prometheus.Metric) error {
function NewBcachefsCollector (line 121) | func NewBcachefsCollector(logger *slog.Logger) (Collector, error) {
FILE: collector/bonding_linux.go
type bondingCollector (line 29) | type bondingCollector struct
method Update (line 57) | func (c *bondingCollector) Update(ch chan<- prometheus.Metric) error {
function init (line 34) | func init() {
function NewBondingCollector (line 40) | func NewBondingCollector(logger *slog.Logger) (Collector, error) {
function readBondingStats (line 74) | func readBondingStats(root string) (status map[string][2]int, err error) {
FILE: collector/bonding_linux_test.go
function TestBonding (line 22) | func TestBonding(t *testing.T) {
FILE: collector/boot_time_bsd.go
type bootTimeCollector (line 25) | type bootTimeCollector struct
method Update (line 41) | func (c *bootTimeCollector) Update(ch chan<- prometheus.Metric) error {
function init (line 29) | func init() {
function newBootTimeCollector (line 34) | func newBootTimeCollector(logger *slog.Logger) (Collector, error) {
FILE: collector/boot_time_solaris.go
type bootTimeCollector (line 25) | type bootTimeCollector struct
method Update (line 48) | func (c *bootTimeCollector) Update(ch chan<- prometheus.Metric) error {
function init (line 30) | func init() {
function newBootTimeCollector (line 34) | func newBootTimeCollector(logger *slog.Logger) (Collector, error) {
FILE: collector/btrfs_linux.go
type btrfsCollector (line 31) | type btrfsCollector struct
method Update (line 55) | func (c *btrfsCollector) Update(ch chan<- prometheus.Metric) error {
method getIoctlStats (line 101) | func (c *btrfsCollector) getIoctlStats() (map[string]*btrfsIoctlFsStat...
method getIoctlDeviceStats (line 174) | func (c *btrfsCollector) getIoctlDeviceStats(fs *dennwc.FS, fsInfo *de...
method updateBtrfsStats (line 225) | func (c *btrfsCollector) updateBtrfsStats(ch chan<- prometheus.Metric,...
method getMetrics (line 260) | func (c *btrfsCollector) getMetrics(s *btrfs.Stats, ioctlStats *btrfsI...
method getAllocationStats (line 386) | func (c *btrfsCollector) getAllocationStats(a string, s *btrfs.Allocat...
method getLayoutStats (line 407) | func (c *btrfsCollector) getLayoutStats(a, l string, s *btrfs.LayoutUs...
function init (line 36) | func init() {
function NewBtrfsCollector (line 41) | func NewBtrfsCollector(logger *slog.Logger) (Collector, error) {
type btrfsIoctlFsDevStats (line 79) | type btrfsIoctlFsDevStats struct
type btrfsIoctlFsStats (line 96) | type btrfsIoctlFsStats struct
type btrfsMetric (line 215) | type btrfsMetric struct
FILE: collector/btrfs_linux_test.go
function checkMetric (line 74) | func checkMetric(exp, got *btrfsMetric) bool {
function TestBtrfs (line 101) | func TestBtrfs(t *testing.T) {
FILE: collector/buddyinfo.go
constant buddyInfoSubsystem (line 28) | buddyInfoSubsystem = "buddyinfo"
type buddyinfoCollector (line 31) | type buddyinfoCollector struct
method Update (line 57) | func (c *buddyinfoCollector) Update(ch chan<- prometheus.Metric) error {
function init (line 37) | func init() {
function NewBuddyinfoCollector (line 42) | func NewBuddyinfoCollector(logger *slog.Logger) (Collector, error) {
FILE: collector/cgroups_linux.go
constant cgroupsCollectorSubsystem (line 26) | cgroupsCollectorSubsystem = "cgroups"
type cgroupSummaryCollector (line 28) | type cgroupSummaryCollector struct
method Update (line 62) | func (c *cgroupSummaryCollector) Update(ch chan<- prometheus.Metric) e...
function init (line 35) | func init() {
function NewCgroupSummaryCollector (line 40) | func NewCgroupSummaryCollector(logger *slog.Logger) (Collector, error) {
FILE: collector/collector.go
constant namespace (line 29) | namespace = "node"
constant defaultEnabled (line 47) | defaultEnabled = true
constant defaultDisabled (line 48) | defaultDisabled = false
function registerCollector (line 59) | func registerCollector(collector string, isDefaultEnabled bool, factory ...
type NodeCollector (line 78) | type NodeCollector struct
method Describe (line 140) | func (n NodeCollector) Describe(ch chan<- *prometheus.Desc) {
method Collect (line 146) | func (n NodeCollector) Collect(ch chan<- prometheus.Metric) {
function DisableDefaultCollectors (line 85) | func DisableDefaultCollectors() {
function collectorFlagAction (line 98) | func collectorFlagAction(collector string) func(ctx *kingpin.ParseContex...
function NewNodeCollector (line 106) | func NewNodeCollector(logger *slog.Logger, filters ...string) (*NodeColl...
function execute (line 158) | func execute(name string, c Collector, ch chan<- prometheus.Metric, logg...
type Collector (line 180) | type Collector interface
type typedDesc (line 185) | type typedDesc struct
method mustNewConstMetric (line 190) | func (d *typedDesc) mustNewConstMetric(value float64, labels ...string...
function IsNoDataError (line 197) | func IsNoDataError(err error) bool {
function pushMetric (line 202) | func pushMetric(ch chan<- prometheus.Metric, fieldDesc *prometheus.Desc,...
FILE: collector/conntrack_linux.go
type conntrackCollector (line 28) | type conntrackCollector struct
method Update (line 114) | func (c *conntrackCollector) Update(ch chan<- prometheus.Metric) error {
method handleErr (line 153) | func (c *conntrackCollector) handleErr(err error) error {
type conntrackStatistics (line 42) | type conntrackStatistics struct
function init (line 53) | func init() {
function NewConntrackCollector (line 58) | func NewConntrackCollector(logger *slog.Logger) (Collector, error) {
function getConntrackStatistics (line 161) | func getConntrackStatistics() (*conntrackStatistics, error) {
FILE: collector/cpu_aix.go
type cpuCollector (line 54) | type cpuCollector struct
method Update (line 102) | func (c *cpuCollector) Update(ch chan<- prometheus.Metric) error {
function init (line 66) | func init() {
function tickPerSecond (line 70) | func tickPerSecond() (float64, error) {
function NewCpuCollector (line 78) | func NewCpuCollector(logger *slog.Logger) (Collector, error) {
FILE: collector/cpu_common.go
constant cpuCollectorSubsystem (line 23) | cpuCollectorSubsystem = "cpu"
FILE: collector/cpu_darwin.go
constant ClocksPerSec (line 51) | ClocksPerSec = float64(C.CLK_TCK)
type statCollector (line 53) | type statCollector struct
method Update (line 70) | func (c *statCollector) Update(ch chan<- prometheus.Metric) error {
function init (line 58) | func init() {
function NewCPUCollector (line 63) | func NewCPUCollector(logger *slog.Logger) (Collector, error) {
FILE: collector/cpu_dragonfly.go
constant maxCPUTimesLen (line 76) | maxCPUTimesLen = C.MAXCPU * C.CPUSTATES
type statCollector (line 78) | type statCollector struct
method Update (line 124) | func (c *statCollector) Update(ch chan<- prometheus.Metric) error {
function init (line 83) | func init() {
function NewStatCollector (line 88) | func NewStatCollector(logger *slog.Logger) (Collector, error) {
function getDragonFlyCPUTimes (line 95) | func getDragonFlyCPUTimes() ([]float64, error) {
FILE: collector/cpu_dragonfly_test.go
function TestCPU (line 23) | func TestCPU(t *testing.T) {
FILE: collector/cpu_freebsd.go
type clockinfo (line 29) | type clockinfo struct
type cputime (line 37) | type cputime struct
function getCPUTimes (line 45) | func getCPUTimes() ([]cputime, error) {
type statCollector (line 83) | type statCollector struct
method Update (line 107) | func (c *statCollector) Update(ch chan<- prometheus.Metric) error {
function init (line 89) | func init() {
function NewStatCollector (line 94) | func NewStatCollector(logger *slog.Logger) (Collector, error) {
FILE: collector/cpu_linux.go
type cpuCollector (line 36) | type cpuCollector struct
method compileIncludeFlags (line 153) | func (c *cpuCollector) compileIncludeFlags(flagsIncludeFlag, bugsInclu...
method Update (line 176) | func (c *cpuCollector) Update(ch chan<- prometheus.Metric) error {
method updateInfo (line 201) | func (c *cpuCollector) updateInfo(ch chan<- prometheus.Metric) error {
method updateThermalThrottle (line 268) | func (c *cpuCollector) updateThermalThrottle(ch chan<- prometheus.Metr...
method updateIsolated (line 346) | func (c *cpuCollector) updateIsolated(ch chan<- prometheus.Metric) {
method updateOnline (line 354) | func (c *cpuCollector) updateOnline(ch chan<- prometheus.Metric) error {
method updateStat (line 376) | func (c *cpuCollector) updateStat(ch chan<- prometheus.Metric) error {
method updateCPUStats (line 409) | func (c *cpuCollector) updateCPUStats(newStats map[int64]procfs.CPUSta...
constant jumpBackSeconds (line 59) | jumpBackSeconds = 3.0
function init (line 69) | func init() {
function NewCPUCollector (line 74) | func NewCPUCollector(logger *slog.Logger) (Collector, error) {
function updateFieldInfo (line 249) | func updateFieldInfo(valueList []string, filter *regexp.Regexp, desc *pr...
FILE: collector/cpu_linux_test.go
function copyStats (line 27) | func copyStats(d, s map[int64]procfs.CPUStat) {
function makeTestCPUCollector (line 34) | func makeTestCPUCollector(s map[int64]procfs.CPUStat) *cpuCollector {
function TestCPU (line 43) | func TestCPU(t *testing.T) {
function TestCPUOffline (line 119) | func TestCPUOffline(t *testing.T) {
FILE: collector/cpu_netbsd.go
constant _IOC_OUT (line 35) | _IOC_OUT = uint(0x40000000)
constant _IOC_IN (line 36) | _IOC_IN = uint(0x80000000)
constant _IOC_INOUT (line 37) | _IOC_INOUT = (_IOC_IN | _IOC_OUT)
constant _IOCPARM_MASK (line 38) | _IOCPARM_MASK = uint(0x1fff)
constant _IOCPARM_SHIFT (line 39) | _IOCPARM_SHIFT = uint(16)
constant _IOCGROUP_SHIFT (line 40) | _IOCGROUP_SHIFT = uint(8)
type clockinfo (line 43) | type clockinfo struct
type cputime (line 51) | type cputime struct
type plistref (line 59) | type plistref struct
type sysmonValues (line 64) | type sysmonValues struct
type sysmonProperty (line 71) | type sysmonProperty
type sysmonProperties (line 73) | type sysmonProperties
function _IOC (line 75) | func _IOC(inout uint, group byte, num uint, len uintptr) uint {
function _IOWR (line 79) | func _IOWR(group byte, num uint, len uintptr) uint {
function ioctl (line 83) | func ioctl(fd int, nr uint, typ byte, size uintptr, retptr unsafe.Pointe...
function readSysmonProperties (line 96) | func readSysmonProperties() (sysmonProperties, error) {
function sortFilterSysmonProperties (line 118) | func sortFilterSysmonProperties(props sysmonProperties, prefix string) [...
function convertTemperatures (line 130) | func convertTemperatures(prop sysmonProperty, res map[int]float64) error {
function getCPUTemperatures (line 146) | func getCPUTemperatures() (map[int]float64, error) {
function getCPUTimes (line 164) | func getCPUTimes() ([]cputime, error) {
type statCollector (line 215) | type statCollector struct
method Update (line 239) | func (c *statCollector) Update(ch chan<- prometheus.Metric) error {
function init (line 221) | func init() {
function NewStatCollector (line 226) | func NewStatCollector(logger *slog.Logger) (Collector, error) {
FILE: collector/cpu_netbsd_test.go
function TestCPUTimes (line 23) | func TestCPUTimes(t *testing.T) {
function TestCPUTemperatures (line 38) | func TestCPUTemperatures(t *testing.T) {
FILE: collector/cpu_openbsd.go
constant CP_USER (line 28) | CP_USER = iota
constant CP_NICE (line 29) | CP_NICE
constant CP_SYS (line 30) | CP_SYS
constant CP_SPIN (line 31) | CP_SPIN
constant CP_INTR (line 32) | CP_INTR
constant CP_IDLE (line 33) | CP_IDLE
constant CPUSTATES (line 34) | CPUSTATES
constant CP_USER_O63 (line 37) | CP_USER_O63 = iota
constant CP_NICE_O63 (line 38) | CP_NICE_O63
constant CP_SYS_O63 (line 39) | CP_SYS_O63
constant CP_INTR_O63 (line 40) | CP_INTR_O63
constant CP_IDLE_O63 (line 41) | CP_IDLE_O63
constant CPUSTATES_O63 (line 42) | CPUSTATES_O63
type cpuCollector (line 45) | type cpuCollector struct
method Update (line 61) | func (c *cpuCollector) Update(ch chan<- prometheus.Metric) (err error) {
function init (line 50) | func init() {
function NewCPUCollector (line 54) | func NewCPUCollector(logger *slog.Logger) (Collector, error) {
FILE: collector/cpu_solaris.go
type cpuCollector (line 29) | type cpuCollector struct
method Update (line 45) | func (c *cpuCollector) Update(ch chan<- prometheus.Metric) error {
function init (line 34) | func init() {
function NewCpuCollector (line 38) | func NewCpuCollector(logger *slog.Logger) (Collector, error) {
FILE: collector/cpu_vulnerabilities_linux.go
constant cpuVulnerabilitiesCollectorSubsystem (line 25) | cpuVulnerabilitiesCollectorSubsystem = "cpu_vulnerabilities"
type cpuVulnerabilitiesCollector (line 37) | type cpuVulnerabilitiesCollector struct
method Update (line 47) | func (v *cpuVulnerabilitiesCollector) Update(ch chan<- prometheus.Metr...
function init (line 39) | func init() {
function NewVulnerabilitySysfsCollector (line 43) | func NewVulnerabilitySysfsCollector(logger *slog.Logger) (Collector, err...
FILE: collector/cpufreq_linux.go
type cpuFreqCollector (line 27) | type cpuFreqCollector struct
method Update (line 50) | func (c *cpuFreqCollector) Update(ch chan<- prometheus.Metric) error {
function init (line 32) | func init() {
function NewCPUFreqCollector (line 37) | func NewCPUFreqCollector(logger *slog.Logger) (Collector, error) {
FILE: collector/cpufreq_solaris.go
type cpuFreqCollector (line 30) | type cpuFreqCollector struct
method Update (line 44) | func (c *cpuFreqCollector) Update(ch chan<- prometheus.Metric) error {
function init (line 34) | func init() {
function NewCpuFreqCollector (line 38) | func NewCpuFreqCollector(logger *slog.Logger) (Collector, error) {
FILE: collector/device_filter.go
type deviceFilter (line 20) | type deviceFilter struct
method ignored (line 38) | func (f *deviceFilter) ignored(name string) bool {
function newDeviceFilter (line 25) | func newDeviceFilter(ignoredPattern, acceptPattern string) (f deviceFilt...
FILE: collector/device_filter_test.go
function TestDeviceFilter (line 20) | func TestDeviceFilter(t *testing.T) {
FILE: collector/devstat_dragonfly.go
constant devstatSubsystem (line 93) | devstatSubsystem = "devstat"
type devstatCollector (line 96) | type devstatCollector struct
method Update (line 129) | func (c *devstatCollector) Update(ch chan<- prometheus.Metric) error {
function init (line 103) | func init() {
function NewDevstatCollector (line 108) | func NewDevstatCollector(logger *slog.Logger) (Collector, error) {
FILE: collector/devstat_freebsd.c
function _get_stats (line 26) | int _get_stats(struct devinfo *info, Stats **stats) {
FILE: collector/devstat_freebsd.go
constant devstatSubsystem (line 33) | devstatSubsystem = "devstat"
type devstatCollector (line 36) | type devstatCollector struct
method Update (line 85) | func (c *devstatCollector) Update(ch chan<- prometheus.Metric) error {
function init (line 48) | func init() {
function NewDevstatCollector (line 53) | func NewDevstatCollector(logger *slog.Logger) (Collector, error) {
FILE: collector/devstat_freebsd.h
type Bytes (line 22) | typedef struct {
type Transfers (line 28) | typedef struct {
type Duration (line 35) | typedef struct {
type Stats (line 42) | typedef struct {
type devinfo (line 54) | struct devinfo
FILE: collector/diskstats_aix.go
constant diskstatsDefaultIgnoredDevices (line 26) | diskstatsDefaultIgnoredDevices = ""
type diskstatsCollector (line 28) | type diskstatsCollector struct
method Update (line 122) | func (c *diskstatsCollector) Update(ch chan<- prometheus.Metric) error {
function init (line 47) | func init() {
function NewDiskstatsCollector (line 52) | func NewDiskstatsCollector(logger *slog.Logger) (Collector, error) {
FILE: collector/diskstats_common.go
constant diskSubsystem (line 27) | diskSubsystem = "disk"
function newDiskstatsDeviceFilter (line 93) | func newDiskstatsDeviceFilter(logger *slog.Logger) (deviceFilter, error) {
FILE: collector/diskstats_darwin.go
constant diskstatsDefaultIgnoredDevices (line 26) | diskstatsDefaultIgnoredDevices = ""
type typedDescFunc (line 28) | type typedDescFunc struct
type diskstatsCollector (line 33) | type diskstatsCollector struct
method Update (line 200) | func (c *diskstatsCollector) Update(ch chan<- prometheus.Metric) error {
function init (line 40) | func init() {
function NewDiskstatsCollector (line 45) | func NewDiskstatsCollector(logger *slog.Logger) (Collector, error) {
FILE: collector/diskstats_linux.go
constant secondsPerTick (line 31) | secondsPerTick = 1.0 / 1000.0
constant unixSectorSize (line 35) | unixSectorSize = 512.0
constant diskstatsDefaultIgnoredDevices (line 37) | diskstatsDefaultIgnoredDevices = "^(z?ram|loop|fd|(h|s|v|xv)d[a-z]|nvme\...
constant udevDevicePropertyPrefix (line 40) | udevDevicePropertyPrefix = "E:"
constant udevDMLVLayer (line 43) | udevDMLVLayer = "DM_LV_LAYER"
constant udevDMLVName (line 44) | udevDMLVName = "DM_LV_NAME"
constant udevDMName (line 45) | udevDMName = "DM_NAME"
constant udevDMUUID (line 46) | udevDMUUID = "DM_UUID"
constant udevDMVGName (line 47) | udevDMVGName = "DM_VG_NAME"
constant udevIDATA (line 48) | udevIDATA = "ID_ATA"
constant udevIDATARotationRateRPM (line 49) | udevIDATARotationRateRPM = "ID_ATA_ROTATION_RATE_RPM"
constant udevIDATASATA (line 50) | udevIDATASATA = "ID_ATA_SATA"
constant udevIDATASATASignalRateGen1 (line 51) | udevIDATASATASignalRateGen1 = "ID_ATA_SATA_SIGNAL_RATE_GEN1"
constant udevIDATASATASignalRateGen2 (line 52) | udevIDATASATASignalRateGen2 = "ID_ATA_SATA_SIGNAL_RATE_GEN2"
constant udevIDATAWriteCache (line 53) | udevIDATAWriteCache = "ID_ATA_WRITE_CACHE"
constant udevIDATAWriteCacheEnabled (line 54) | udevIDATAWriteCacheEnabled = "ID_ATA_WRITE_CACHE_ENABLED"
constant udevIDFSType (line 55) | udevIDFSType = "ID_FS_TYPE"
constant udevIDFSUsage (line 56) | udevIDFSUsage = "ID_FS_USAGE"
constant udevIDFSUUID (line 57) | udevIDFSUUID = "ID_FS_UUID"
constant udevIDFSVersion (line 58) | udevIDFSVersion = "ID_FS_VERSION"
constant udevIDModel (line 59) | udevIDModel = "ID_MODEL"
constant udevIDPath (line 60) | udevIDPath = "ID_PATH"
constant udevIDRevision (line 61) | udevIDRevision = "ID_REVISION"
constant udevIDSerial (line 62) | udevIDSerial = "ID_SERIAL"
constant udevIDSerialShort (line 63) | udevIDSerialShort = "ID_SERIAL_SHORT"
constant udevIDWWN (line 64) | udevIDWWN = "ID_WWN"
constant udevSCSIIdentSerial (line 65) | udevSCSIIdentSerial = "SCSI_IDENT_SERIAL"
type udevInfo (line 68) | type udevInfo
type diskstatsCollector (line 70) | type diskstatsCollector struct
method Update (line 263) | func (c *diskstatsCollector) Update(ch chan<- prometheus.Metric) error {
function init (line 82) | func init() {
function NewDiskstatsCollector (line 88) | func NewDiskstatsCollector(logger *slog.Logger) (Collector, error) {
function getUdevDeviceProperties (line 375) | func getUdevDeviceProperties(major, minor uint32) (udevInfo, error) {
FILE: collector/diskstats_linux_test.go
type testDiskStatsCollector (line 29) | type testDiskStatsCollector struct
method Collect (line 33) | func (c testDiskStatsCollector) Collect(ch chan<- prometheus.Metric) {
method Describe (line 37) | func (c testDiskStatsCollector) Describe(ch chan<- *prometheus.Desc) {
function NewTestDiskStatsCollector (line 41) | func NewTestDiskStatsCollector(logger *slog.Logger) (prometheus.Collecto...
function TestDiskStats (line 51) | func TestDiskStats(t *testing.T) {
FILE: collector/diskstats_openbsd.go
constant diskstatsDefaultIgnoredDevices (line 33) | diskstatsDefaultIgnoredDevices = ""
type diskstatsCollector (line 35) | type diskstatsCollector struct
method Update (line 69) | func (c *diskstatsCollector) Update(ch chan<- prometheus.Metric) (err ...
function init (line 46) | func init() {
function NewDiskstatsCollector (line 51) | func NewDiskstatsCollector(logger *slog.Logger) (Collector, error) {
FILE: collector/diskstats_openbsd_amd64.go
constant DS_DISKNAMELEN (line 28) | DS_DISKNAMELEN = 16
constant diskstatsDefaultIgnoredDevices (line 30) | diskstatsDefaultIgnoredDevices = ""
type DiskStats (line 33) | type DiskStats struct
type diskstatsCollector (line 46) | type diskstatsCollector struct
method Update (line 80) | func (c *diskstatsCollector) Update(ch chan<- prometheus.Metric) (err ...
function init (line 57) | func init() {
function NewDiskstatsCollector (line 62) | func NewDiskstatsCollector(logger *slog.Logger) (Collector, error) {
FILE: collector/dmi.go
type dmiCollector (line 29) | type dmiCollector struct
method Update (line 98) | func (c *dmiCollector) Update(ch chan<- prometheus.Metric) error {
function init (line 34) | func init() {
function NewDMICollector (line 39) | func NewDMICollector(logger *slog.Logger) (Collector, error) {
FILE: collector/drbd_linux.go
type drbdNumericalMetric (line 31) | type drbdNumericalMetric struct
function newDRBDNumericalMetric (line 37) | func newDRBDNumericalMetric(name, desc string, valueType prometheus.Valu...
type drbdStringPairMetric (line 51) | type drbdStringPairMetric struct
method isOkay (line 56) | func (m *drbdStringPairMetric) isOkay(v string) float64 {
function newDRBDStringPairMetric (line 64) | func newDRBDStringPairMetric(name, desc, valueOK string) drbdStringPairM...
type drbdCollector (line 76) | type drbdCollector struct
method Update (line 187) | func (c *drbdCollector) Update(ch chan<- prometheus.Metric) error {
function init (line 83) | func init() {
function newDRBDCollector (line 87) | func newDRBDCollector(logger *slog.Logger) (Collector, error) {
FILE: collector/drm_linux.go
constant drmCollectorSubsystem (line 27) | drmCollectorSubsystem = "drm"
type drmCollector (line 30) | type drmCollector struct
method Update (line 100) | func (c *drmCollector) Update(ch chan<- prometheus.Metric) error {
method updateAMDCards (line 104) | func (c *drmCollector) updateAMDCards(ch chan<- prometheus.Metric) err...
function init (line 43) | func init() {
function NewDrmCollector (line 48) | func NewDrmCollector(logger *slog.Logger) (Collector, error) {
FILE: collector/edac_linux.go
constant edacSubsystem (line 28) | edacSubsystem = "edac"
type edacCollector (line 36) | type edacCollector struct
method Update (line 75) | func (c *edacCollector) Update(ch chan<- prometheus.Metric) error {
function init (line 44) | func init() {
function NewEdacCollector (line 49) | func NewEdacCollector(logger *slog.Logger) (Collector, error) {
FILE: collector/entropy_linux.go
type entropyCollector (line 26) | type entropyCollector struct
method Update (line 60) | func (c *entropyCollector) Update(ch chan<- prometheus.Metric) error {
function init (line 33) | func init() {
function NewEntropyCollector (line 38) | func NewEntropyCollector(logger *slog.Logger) (Collector, error) {
FILE: collector/ethtool_linux.go
type Ethtool (line 48) | type Ethtool interface
type ethtoolLibrary (line 54) | type ethtoolLibrary struct
method DriverInfo (line 58) | func (e *ethtoolLibrary) DriverInfo(intf string) (ethtool.DrvInfo, err...
method Stats (line 62) | func (e *ethtoolLibrary) Stats(intf string) (map[string]uint64, error) {
method LinkInfo (line 66) | func (e *ethtoolLibrary) LinkInfo(intf string) (ethtool.EthtoolCmd, er...
type ethtoolCollector (line 72) | type ethtoolCollector struct
method updatePortCapabilities (line 231) | func (c *ethtoolCollector) updatePortCapabilities(ch chan<- prometheus...
method updatePortInfo (line 254) | func (c *ethtoolCollector) updatePortInfo(ch chan<- prometheus.Metric,...
method updateSpeeds (line 273) | func (c *ethtoolCollector) updateSpeeds(ch chan<- prometheus.Metric, p...
method Update (line 373) | func (c *ethtoolCollector) Update(ch chan<- prometheus.Metric) error {
method entryWithCreate (line 501) | func (c *ethtoolCollector) entryWithCreate(key, metricFQName string) *...
method entry (line 516) | func (c *ethtoolCollector) entry(key string) *prometheus.Desc {
function makeEthtoolCollector (line 86) | func makeEthtoolCollector(logger *slog.Logger) (*ethtoolCollector, error) {
function init (line 211) | func init() {
function buildEthtoolFQName (line 216) | func buildEthtoolFQName(metric string) string {
function NewEthtoolCollector (line 224) | func NewEthtoolCollector(logger *slog.Logger) (Collector, error) {
FILE: collector/ethtool_linux_test.go
type EthtoolFixture (line 36) | type EthtoolFixture struct
method DriverInfo (line 62) | func (e *EthtoolFixture) DriverInfo(intf string) (ethtool.DrvInfo, err...
method Stats (line 101) | func (e *EthtoolFixture) Stats(intf string) (map[string]uint64, error) {
method LinkInfo (line 176) | func (e *EthtoolFixture) LinkInfo(intf string) (ethtool.EthtoolCmd, er...
type testEthtoolCollector (line 40) | type testEthtoolCollector struct
method Collect (line 44) | func (c testEthtoolCollector) Collect(ch chan<- prometheus.Metric) {
method Describe (line 48) | func (c testEthtoolCollector) Describe(ch chan<- *prometheus.Desc) {
function NewTestEthtoolCollector (line 52) | func NewTestEthtoolCollector(logger *slog.Logger) (prometheus.Collector,...
function readModes (line 139) | func readModes(modes string) uint32 {
function readPortTypes (line 162) | func readPortTypes(portTypes string) uint32 {
function NewEthtoolTestCollector (line 260) | func NewEthtoolTestCollector(logger *slog.Logger) (Collector, error) {
function TestBuildEthtoolFQName (line 271) | func TestBuildEthtoolFQName(t *testing.T) {
function TestEthToolCollector (line 290) | func TestEthToolCollector(t *testing.T) {
FILE: collector/exec_bsd.go
type execCollector (line 24) | type execCollector struct
method Update (line 83) | func (c *execCollector) Update(ch chan<- prometheus.Metric) error {
function init (line 29) | func init() {
function NewExecCollector (line 34) | func NewExecCollector(logger *slog.Logger) (Collector, error) {
FILE: collector/fibrechannel_linux.go
constant maxUint64 (line 29) | maxUint64 = ^uint64(0)
type fibrechannelCollector (line 31) | type fibrechannelCollector struct
method pushMetric (line 86) | func (c *fibrechannelCollector) pushMetric(ch chan<- prometheus.Metric...
method pushCounter (line 90) | func (c *fibrechannelCollector) pushCounter(ch chan<- prometheus.Metri...
method Update (line 97) | func (c *fibrechannelCollector) Update(ch chan<- prometheus.Metric) er...
function init (line 38) | func init() {
function NewFibreChannelCollector (line 43) | func NewFibreChannelCollector(logger *slog.Logger) (Collector, error) {
FILE: collector/filefd_linux.go
constant fileFDStatSubsystem (line 30) | fileFDStatSubsystem = "filefd"
type fileFDStatCollector (line 33) | type fileFDStatCollector struct
method Update (line 46) | func (c *fileFDStatCollector) Update(ch chan<- prometheus.Metric) error {
function init (line 37) | func init() {
function NewFileFDStatCollector (line 42) | func NewFileFDStatCollector(logger *slog.Logger) (Collector, error) {
function parseFileFDStats (line 68) | func parseFileFDStats(filename string) (map[string]string, error) {
FILE: collector/filefd_linux_test.go
function TestFileFDStats (line 20) | func TestFileFDStats(t *testing.T) {
FILE: collector/filesystem_aix.go
constant defMountPointsExcluded (line 23) | defMountPointsExcluded = "^/(dev|aha)($|/)"
constant defFSTypesExcluded (line 24) | defFSTypesExcluded = "^procfs$"
method GetStats (line 28) | func (c *filesystemCollector) GetStats() (stats []filesystemStats, err e...
FILE: collector/filesystem_bsd.go
constant defMountPointsExcluded (line 32) | defMountPointsExcluded = "^/(dev)($|/)"
constant defFSTypesExcluded (line 33) | defFSTypesExcluded = "^devfs$"
constant readOnly (line 34) | readOnly = 0x1
method GetStats (line 38) | func (c *filesystemCollector) GetStats() (stats []filesystemStats, err e...
FILE: collector/filesystem_common.go
type filesystemCollector (line 71) | type filesystemCollector struct
method Update (line 183) | func (c *filesystemCollector) Update(ch chan<- prometheus.Metric) error {
type filesystemLabels (line 82) | type filesystemLabels struct
type filesystemStats (line 86) | type filesystemStats struct
function init (line 94) | func init() {
function NewFilesystemCollector (line 99) | func NewFilesystemCollector(logger *slog.Logger) (Collector, error) {
function newMountPointsFilter (line 243) | func newMountPointsFilter(logger *slog.Logger) (deviceFilter, error) {
function newFSTypeFilter (line 272) | func newFSTypeFilter(logger *slog.Logger) (deviceFilter, error) {
FILE: collector/filesystem_freebsd.go
constant defMountPointsExcluded (line 23) | defMountPointsExcluded = "^/(dev)($|/)"
constant defFSTypesExcluded (line 24) | defFSTypesExcluded = "^devfs$"
method GetStats (line 28) | func (c *filesystemCollector) GetStats() ([]filesystemStats, error) {
FILE: collector/filesystem_linux.go
constant defMountPointsExcluded (line 37) | defMountPointsExcluded = "^/(dev|proc|run/credentials/.+|sys|var/lib/doc...
constant defFSTypesExcluded (line 38) | defFSTypesExcluded = "^(autofs|binfmt_misc|bpf|cgroup2?|configfs|deb...
method GetStats (line 51) | func (c *filesystemCollector) GetStats() ([]filesystemStats, error) {
method processStat (line 110) | func (c *filesystemCollector) processStat(labels filesystemLabels) files...
function stuckMountWatcher (line 161) | func stuckMountWatcher(mountPoint string, success chan struct{}, logger ...
function mountPointDetails (line 181) | func mountPointDetails(logger *slog.Logger) ([]filesystemLabels, error) {
function parseFilesystemLabels (line 199) | func parseFilesystemLabels(mountInfo []*procfs.MountInfo) ([]filesystemL...
function isFilesystemReadOnly (line 231) | func isFilesystemReadOnly(labels filesystemLabels) bool {
function mountOptionsString (line 239) | func mountOptionsString(m map[string]string) string {
FILE: collector/filesystem_linux_test.go
function Test_parseFilesystemLabelsError (line 28) | func Test_parseFilesystemLabelsError(t *testing.T) {
function Test_isFilesystemReadOnly (line 52) | func Test_isFilesystemReadOnly(t *testing.T) {
function TestMountPointDetails (line 91) | func TestMountPointDetails(t *testing.T) {
function TestMountsFallback (line 150) | func TestMountsFallback(t *testing.T) {
function TestPathRootfs (line 171) | func TestPathRootfs(t *testing.T) {
FILE: collector/filesystem_macos.go
constant defMountPointsExcluded (line 57) | defMountPointsExcluded = "^/(dev)($|/)"
constant defFSTypesExcluded (line 58) | defFSTypesExcluded = "^devfs$"
constant readOnly (line 59) | readOnly = 0x1
method GetStats (line 63) | func (c *filesystemCollector) GetStats() (stats []filesystemStats, err e...
FILE: collector/filesystem_netbsd.go
constant defMountPointsExcluded (line 27) | defMountPointsExcluded = "^/(dev)($|/)"
constant defFSTypesExcluded (line 28) | defFSTypesExcluded = "^(kernfs|procfs|ptyfs|fdesc)$"
constant _VFS_NAMELEN (line 29) | _VFS_NAMELEN = 32
constant _VFS_MNAMELEN (line 30) | _VFS_MNAMELEN = 1024
type statvfs90 (line 38) | type statvfs90 struct
method GetStats (line 73) | func (c *filesystemCollector) GetStats() (stats []filesystemStats, err e...
FILE: collector/filesystem_openbsd.go
constant defMountPointsExcluded (line 23) | defMountPointsExcluded = "^/(dev)($|/)"
constant defFSTypesExcluded (line 24) | defFSTypesExcluded = "^devfs$"
method GetStats (line 28) | func (c *filesystemCollector) GetStats() (stats []filesystemStats, err e...
FILE: collector/helper.go
function readUintFromFile (line 23) | func readUintFromFile(path string) (uint64, error) {
function SanitizeMetricName (line 48) | func SanitizeMetricName(metricName string) string {
FILE: collector/helper_test.go
function TestSanitizeMetricName (line 20) | func TestSanitizeMetricName(t *testing.T) {
FILE: collector/hwmon_linux.go
function init (line 51) | func init() {
type hwMonCollector (line 55) | type hwMonCollector struct
method updateHwmon (line 164) | func (c *hwMonCollector) updateHwmon(ch chan<- prometheus.Metric, dir ...
method hwmonName (line 377) | func (c *hwMonCollector) hwmonName(dir string) (string, error) {
method hwmonHumanReadableChipName (line 437) | func (c *hwMonCollector) hwmonHumanReadableChipName(dir string) (strin...
method Update (line 453) | func (c *hwMonCollector) Update(ch chan<- prometheus.Metric) error {
function NewHwMonCollector (line 63) | func NewHwMonCollector(logger *slog.Logger) (Collector, error) {
function cleanMetricName (line 72) | func cleanMetricName(name string) string {
function addValueFile (line 79) | func addValueFile(data map[string]map[string]string, sensor string, prop...
function sysReadFile (line 94) | func sysReadFile(file string) ([]byte, error) {
function explodeSensorFilename (line 119) | func explodeSensorFilename(filename string) (ok bool, sensorType string,...
function collectSensorData (line 145) | func collectSensorData(dir string, data map[string]map[string]string) er...
FILE: collector/infiniband_linux.go
type infinibandCollector (line 29) | type infinibandCollector struct
method pushMetric (line 135) | func (c *infinibandCollector) pushMetric(ch chan<- prometheus.Metric, ...
method pushCounter (line 139) | func (c *infinibandCollector) pushCounter(ch chan<- prometheus.Metric,...
method Update (line 145) | func (c *infinibandCollector) Update(ch chan<- prometheus.Metric) error {
function init (line 36) | func init() {
function NewInfiniBandCollector (line 41) | func NewInfiniBandCollector(logger *slog.Logger) (Collector, error) {
FILE: collector/interrupts_common.go
type interruptsCollector (line 25) | type interruptsCollector struct
function init (line 32) | func init() {
function NewInterruptsCollector (line 43) | func NewInterruptsCollector(logger *slog.Logger) (Collector, error) {
FILE: collector/interrupts_linux.go
method Update (line 34) | func (c *interruptsCollector) Update(ch chan<- prometheus.Metric) (err e...
type interrupt (line 60) | type interrupt struct
function getInterrupts (line 66) | func getInterrupts() (map[string]interrupt, error) {
function parseInterrupts (line 76) | func parseInterrupts(r io.Reader) (map[string]interrupt, error) {
FILE: collector/interrupts_linux_test.go
function TestInterrupts (line 23) | func TestInterrupts(t *testing.T) {
function TestInterruptsArm (line 56) | func TestInterruptsArm(t *testing.T) {
FILE: collector/interrupts_openbsd.go
method Update (line 101) | func (c *interruptsCollector) Update(ch chan<- prometheus.Metric) error {
type interrupt (line 129) | type interrupt struct
function getInterrupts (line 135) | func getInterrupts() (map[string]interrupt, error) {
FILE: collector/interrupts_openbsd_amd64.go
constant KERN_INTRCNT (line 30) | KERN_INTRCNT = 63
constant KERN_INTRCNT_NUM (line 31) | KERN_INTRCNT_NUM = 1
constant KERN_INTRCNT_CNT (line 32) | KERN_INTRCNT_CNT = 2
constant KERN_INTRCNT_NAME (line 33) | KERN_INTRCNT_NAME = 3
constant KERN_INTRCNT_VECTOR (line 34) | KERN_INTRCNT_VECTOR = 4
function nintr (line 37) | func nintr() _C_int {
function intr (line 46) | func intr(idx _C_int) (itr interrupt, err error) {
method Update (line 74) | func (c *interruptsCollector) Update(ch chan<- prometheus.Metric) error {
type interrupt (line 102) | type interrupt struct
function getInterrupts (line 108) | func getInterrupts() (map[string]interrupt, error) {
FILE: collector/ipvs_linux.go
type ipvsCollector (line 32) | type ipvsCollector struct
method Update (line 139) | func (c *ipvsCollector) Update(ch chan<- prometheus.Metric) error {
method parseIpvsLabels (line 203) | func (c *ipvsCollector) parseIpvsLabels(labelString string) ([]string,...
type ipvsBackendStatus (line 41) | type ipvsBackendStatus struct
constant ipvsLabelLocalAddress (line 48) | ipvsLabelLocalAddress = "local_address"
constant ipvsLabelLocalPort (line 49) | ipvsLabelLocalPort = "local_port"
constant ipvsLabelRemoteAddress (line 50) | ipvsLabelRemoteAddress = "remote_address"
constant ipvsLabelRemotePort (line 51) | ipvsLabelRemotePort = "remote_port"
constant ipvsLabelProto (line 52) | ipvsLabelProto = "proto"
constant ipvsLabelLocalMark (line 53) | ipvsLabelLocalMark = "local_mark"
function init (line 68) | func init() {
function NewIPVSCollector (line 74) | func NewIPVSCollector(logger *slog.Logger) (Collector, error) {
function newIPVSCollector (line 78) | func newIPVSCollector(logger *slog.Logger) (*ipvsCollector, error) {
FILE: collector/ipvs_linux_test.go
function TestIPVSCollector (line 34) | func TestIPVSCollector(t *testing.T) {
type miniCollector (line 148) | type miniCollector struct
method Collect (line 152) | func (c miniCollector) Collect(ch chan<- prometheus.Metric) {
method Describe (line 156) | func (c miniCollector) Describe(ch chan<- *prometheus.Desc) {
function TestIPVSCollectorResponse (line 165) | func TestIPVSCollectorResponse(t *testing.T) {
FILE: collector/kernel_hung_linux.go
type kernelHungCollector (line 26) | type kernelHungCollector struct
method Update (line 54) | func (c *kernelHungCollector) Update(ch chan<- prometheus.Metric) error {
function init (line 31) | func init() {
function NewKernelHungCollector (line 35) | func NewKernelHungCollector(logger *slog.Logger) (Collector, error) {
FILE: collector/ksmd_linux.go
type ksmdCollector (line 31) | type ksmdCollector struct
method Update (line 65) | func (c *ksmdCollector) Update(ch chan<- prometheus.Metric) error {
function init (line 36) | func init() {
function getCanonicalMetricName (line 40) | func getCanonicalMetricName(filename string) string {
function NewKsmdCollector (line 52) | func NewKsmdCollector(logger *slog.Logger) (Collector, error) {
FILE: collector/kvm_bsd.c
function _kvm_swap_used_pages (line 23) | int _kvm_swap_used_pages(uint64_t *out) {
FILE: collector/kvm_bsd.go
type kvm (line 27) | type kvm struct
method SwapUsedPages (line 32) | func (k *kvm) SwapUsedPages() (value uint64, err error) {
FILE: collector/lnstat_linux.go
type lnstatCollector (line 27) | type lnstatCollector struct
method Update (line 39) | func (c *lnstatCollector) Update(ch chan<- prometheus.Metric) error {
function init (line 31) | func init() {
function NewLnstatCollector (line 35) | func NewLnstatCollector(logger *slog.Logger) (Collector, error) {
FILE: collector/loadavg.go
type loadavgCollector (line 25) | type loadavgCollector struct
method Update (line 46) | func (c *loadavgCollector) Update(ch chan<- prometheus.Metric) error {
function init (line 30) | func init() {
function NewLoadavgCollector (line 35) | func NewLoadavgCollector(logger *slog.Logger) (Collector, error) {
FILE: collector/loadavg_aix.go
function getLoad (line 22) | func getLoad() ([]float64, error) {
FILE: collector/loadavg_bsd.go
function getLoad (line 24) | func getLoad() ([]float64, error) {
FILE: collector/loadavg_linux.go
function getLoad (line 26) | func getLoad() (loads []float64, err error) {
function parseLoad (line 39) | func parseLoad(data string) (loads []float64, err error) {
FILE: collector/loadavg_linux_test.go
function TestLoad (line 20) | func TestLoad(t *testing.T) {
FILE: collector/loadavg_solaris.go
function kstatToFloat (line 28) | func kstatToFloat(ks *kstat.KStat, kstatKey string) float64 {
function getLoad (line 45) | func getLoad() ([]float64, error) {
FILE: collector/logind_linux.go
constant logindSubsystem (line 30) | logindSubsystem = "logind"
constant dbusObject (line 31) | dbusObject = "org.freedesktop.login1"
constant dbusPath (line 32) | dbusPath = "/org/freedesktop/login1"
type logindCollector (line 48) | type logindCollector struct
method Update (line 93) | func (lc *logindCollector) Update(ch chan<- prometheus.Metric) error {
type logindDbus (line 52) | type logindDbus struct
method listSeats (line 176) | func (c *logindDbus) listSeats() ([]string, error) {
method listSessions (line 209) | func (c *logindDbus) listSessions() ([]logindSessionEntry, error) {
method getSession (line 235) | func (c *logindDbus) getSession(session logindSessionEntry) *logindSes...
type logindInterface (line 57) | type logindInterface interface
type logindSession (line 63) | type logindSession struct
type logindSessionEntry (line 71) | type logindSessionEntry struct
type logindSeatEntry (line 79) | type logindSeatEntry struct
function init (line 84) | func init() {
function NewLogindCollector (line 89) | func NewLogindCollector(logger *slog.Logger) (Collector, error) {
function collectMetrics (line 103) | func collectMetrics(ch chan<- prometheus.Metric, c logindInterface) error {
function knownStringOrOther (line 140) | func knownStringOrOther(value string, known []string) string {
function newDbus (line 148) | func newDbus() (*logindDbus, error) {
FILE: collector/logind_linux_test.go
type testLogindInterface (line 25) | type testLogindInterface struct
method listSeats (line 29) | func (c *testLogindInterface) listSeats() ([]string, error) {
method listSessions (line 33) | func (c *testLogindInterface) listSessions() ([]logindSessionEntry, er...
method getSession (line 52) | func (c *testLogindInterface) getSession(session logindSessionEntry) *...
function TestLogindCollectorKnownStringOrOther (line 71) | func TestLogindCollectorKnownStringOrOther(t *testing.T) {
function TestLogindCollectorCollectMetrics (line 88) | func TestLogindCollectorCollectMetrics(t *testing.T) {
FILE: collector/mdadm_linux.go
type mdadmCollector (line 30) | type mdadmCollector struct
method Update (line 118) | func (c *mdadmCollector) Update(ch chan<- prometheus.Metric) error {
function init (line 34) | func init() {
function NewMdadmCollector (line 39) | func NewMdadmCollector(logger *slog.Logger) (Collector, error) {
FILE: collector/mdadm_linux_test.go
type testMdadmCollector (line 28) | type testMdadmCollector struct
method Collect (line 32) | func (c testMdadmCollector) Collect(ch chan<- prometheus.Metric) {
method Describe (line 36) | func (c testMdadmCollector) Describe(ch chan<- *prometheus.Desc) {
function NewTestMdadmCollector (line 40) | func NewTestMdadmCollector(logger *slog.Logger) (prometheus.Collector, e...
function TestMdadmStats (line 48) | func TestMdadmStats(t *testing.T) {
FILE: collector/meminfo.go
constant memInfoSubsystem (line 26) | memInfoSubsystem = "memory"
function init (line 29) | func init() {
method Update (line 35) | func (c *meminfoCollector) Update(ch chan<- prometheus.Metric) error {
FILE: collector/meminfo_aix.go
type meminfoCollector (line 24) | type meminfoCollector struct
method getMemInfo (line 35) | func (c *meminfoCollector) getMemInfo() (map[string]float64, error) {
function NewMeminfoCollector (line 29) | func NewMeminfoCollector(logger *slog.Logger) (Collector, error) {
FILE: collector/meminfo_darwin.go
type meminfoCollector (line 32) | type meminfoCollector struct
method getMemInfo (line 43) | func (c *meminfoCollector) getMemInfo() (map[string]float64, error) {
function NewMeminfoCollector (line 37) | func NewMeminfoCollector(logger *slog.Logger) (Collector, error) {
FILE: collector/meminfo_linux.go
type meminfoCollector (line 25) | type meminfoCollector struct
method getMemInfo (line 43) | func (c *meminfoCollector) getMemInfo() (map[string]float64, error) {
function NewMeminfoCollector (line 31) | func NewMeminfoCollector(logger *slog.Logger) (Collector, error) {
FILE: collector/meminfo_linux_test.go
function TestMemInfo (line 24) | func TestMemInfo(t *testing.T) {
FILE: collector/meminfo_netbsd.go
type meminfoCollector (line 24) | type meminfoCollector struct
method getMemInfo (line 35) | func (c *meminfoCollector) getMemInfo() (map[string]float64, error) {
function NewMeminfoCollector (line 29) | func NewMeminfoCollector(logger *slog.Logger) (Collector, error) {
FILE: collector/meminfo_numa_linux.go
constant memInfoNumaSubsystem (line 33) | memInfoNumaSubsystem = "memory_numa"
type meminfoMetric (line 38) | type meminfoMetric struct
type meminfoNumaCollector (line 45) | type meminfoNumaCollector struct
method Update (line 62) | func (c *meminfoNumaCollector) Update(ch chan<- prometheus.Metric) err...
function init (line 50) | func init() {
function NewMeminfoNumaCollector (line 55) | func NewMeminfoNumaCollector(logger *slog.Logger) (Collector, error) {
function getMemInfoNuma (line 81) | func getMemInfoNuma() ([]meminfoMetric, error) {
function parseMemInfoNuma (line 124) | func parseMemInfoNuma(r io.Reader) ([]meminfoMetric, error) {
function parseMemInfoNumaStat (line 159) | func parseMemInfoNumaStat(r io.Reader, nodeNumber string) ([]meminfoMetr...
FILE: collector/meminfo_numa_linux_test.go
function TestMemInfoNuma (line 23) | func TestMemInfoNuma(t *testing.T) {
function TestMemInfoNumaStat (line 67) | func TestMemInfoNumaStat(t *testing.T) {
FILE: collector/meminfo_openbsd.go
type meminfoCollector (line 56) | type meminfoCollector struct
method getMemInfo (line 67) | func (c *meminfoCollector) getMemInfo() (map[string]float64, error) {
function NewMeminfoCollector (line 61) | func NewMeminfoCollector(logger *slog.Logger) (Collector, error) {
FILE: collector/meminfo_openbsd_amd64.go
constant CTL_VFS (line 26) | CTL_VFS = 10
constant VFS_GENERIC (line 27) | VFS_GENERIC = 0
constant VFS_BCACHESTAT (line 28) | VFS_BCACHESTAT = 3
type bcachestats (line 31) | type bcachestats struct
type meminfoCollector (line 52) | type meminfoCollector struct
method getMemInfo (line 63) | func (c *meminfoCollector) getMemInfo() (map[string]float64, error) {
function NewMeminfoCollector (line 57) | func NewMeminfoCollector(logger *slog.Logger) (Collector, error) {
FILE: collector/memory_bsd.go
constant memorySubsystem (line 27) | memorySubsystem = "memory"
type memoryCollector (line 30) | type memoryCollector struct
method Update (line 147) | func (c *memoryCollector) Update(ch chan<- prometheus.Metric) error {
function init (line 37) | func init() {
function NewMemoryCollector (line 42) | func NewMemoryCollector(logger *slog.Logger) (Collector, error) {
FILE: collector/mountstats_linux.go
type mountStatsCollector (line 32) | type mountStatsCollector struct
method Update (line 512) | func (c *mountStatsCollector) Update(ch chan<- prometheus.Metric) error {
method updateNFSStats (line 556) | func (c *mountStatsCollector) updateNFSStats(ch chan<- prometheus.Metr...
type nfsDeviceIdentifier (line 102) | type nfsDeviceIdentifier struct
function init (line 108) | func init() {
function NewMountStatsCollector (line 113) | func NewMountStatsCollector(logger *slog.Logger) (Collector, error) {
FILE: collector/netclass_linux.go
type netClassCollector (line 38) | type netClassCollector struct
method Update (line 67) | func (c *netClassCollector) Update(ch chan<- prometheus.Metric) error {
method netClassSysfsUpdate (line 74) | func (c *netClassCollector) netClassSysfsUpdate(ch chan<- prometheus.M...
method getFieldDesc (line 138) | func (c *netClassCollector) getFieldDesc(name string) *prometheus.Desc {
method getNetClassInfo (line 157) | func (c *netClassCollector) getNetClassInfo() (sysfs.NetClass, error) {
function init (line 47) | func init() {
function NewNetClassCollector (line 52) | func NewNetClassCollector(logger *slog.Logger) (Collector, error) {
function getAdminState (line 178) | func getAdminState(flags *int64) string {
FILE: collector/netclass_rtnl_linux.go
method netClassRTNLUpdate (line 40) | func (c *netClassCollector) netClassRTNLUpdate(ch chan<- prometheus.Metr...
method getNetClassInfoRTNL (line 198) | func (c *netClassCollector) getNetClassInfoRTNL() ([]rtnetlink.LinkMessa...
method getLinkModes (line 211) | func (c *netClassCollector) getLinkModes() ([]*ethtool.LinkMode, error) {
function getSysfsAttributes (line 225) | func getSysfsAttributes(links []rtnetlink.LinkMessage) (sysfs.NetClass, ...
FILE: collector/netdev_aix.go
function getNetDevStats (line 24) | func getNetDevStats(filter *deviceFilter, logger *slog.Logger) (netDevSt...
function getNetDevLabels (line 54) | func getNetDevLabels() (map[string]map[string]string, error) {
FILE: collector/netdev_bsd.go
function getNetDevStats (line 33) | func getNetDevStats(filter *deviceFilter, logger *slog.Logger) (netDevSt...
function getNetDevLabels (line 72) | func getNetDevLabels() (map[string]map[string]string, error) {
FILE: collector/netdev_common.go
type netDevCollector (line 39) | type netDevCollector struct
method metricDesc (line 93) | func (c *netDevCollector) metricDesc(key string, labels []string) *pro...
method Update (line 109) | func (c *netDevCollector) Update(ch chan<- prometheus.Metric) error {
type netDevStats (line 47) | type netDevStats
function init (line 49) | func init() {
function NewNetDevCollector (line 54) | func NewNetDevCollector(logger *slog.Logger) (Collector, error) {
type addrInfo (line 157) | type addrInfo struct
function scope (line 164) | func scope(ip net.IP) string {
function getAddrsInfo (line 181) | func getAddrsInfo(interfaces []net.Interface, filter *deviceFilter, logg...
function legacy (line 210) | func legacy(metrics map[string]uint64) {
function pop (line 246) | func pop(m map[string]uint64, key string) (uint64, bool) {
function popz (line 252) | func popz(m map[string]uint64, key string) uint64 {
FILE: collector/netdev_darwin.go
function getNetDevStats (line 29) | func getNetDevStats(filter *deviceFilter, logger *slog.Logger) (netDevSt...
function getIfaceData (line 67) | func getIfaceData(index int) (*ifMsghdr2, error) {
type ifMsghdr2 (line 119) | type ifMsghdr2 struct
type ifData64 (line 135) | type ifData64 struct
type ifMibData (line 166) | type ifMibData struct
function getNetDevLabels (line 177) | func getNetDevLabels() (map[string]map[string]string, error) {
FILE: collector/netdev_linux.go
function getNetDevStats (line 33) | func getNetDevStats(filter *deviceFilter, logger *slog.Logger) (netDevSt...
function netlinkStats (line 40) | func netlinkStats(filter *deviceFilter, logger *slog.Logger) (netDevStat...
function parseNetlinkStats (line 55) | func parseNetlinkStats(links []rtnetlink.LinkMessage, filter *deviceFilt...
function procNetDevStats (line 144) | func procNetDevStats(filter *deviceFilter, logger *slog.Logger) (netDevS...
function getNetDevLabels (line 188) | func getNetDevLabels() (map[string]map[string]string, error) {
FILE: collector/netdev_linux_test.go
function TestNetDevStatsIgnore (line 165) | func TestNetDevStatsIgnore(t *testing.T) {
function TestNetDevStatsAccept (line 199) | func TestNetDevStatsAccept(t *testing.T) {
function TestNetDevLegacyMetricNames (line 211) | func TestNetDevLegacyMetricNames(t *testing.T) {
function TestNetDevLegacyMetricValues (line 244) | func TestNetDevLegacyMetricValues(t *testing.T) {
function TestNetDevMetricValues (line 285) | func TestNetDevMetricValues(t *testing.T) {
FILE: collector/netdev_openbsd.go
function getNetDevStats (line 31) | func getNetDevStats(filter *deviceFilter, logger *slog.Logger) (netDevSt...
function getNetDevLabels (line 73) | func getNetDevLabels() (map[string]map[string]string, error) {
FILE: collector/netdev_openbsd_amd64.go
function getNetDevStats (line 26) | func getNetDevStats(filter *deviceFilter, logger *slog.Logger) (netDevSt...
function getNetDevLabels (line 79) | func getNetDevLabels() (map[string]map[string]string, error) {
FILE: collector/netinterface_aix.go
type netinterfaceCollector (line 25) | type netinterfaceCollector struct
method Update (line 69) | func (c *netinterfaceCollector) Update(ch chan<- prometheus.Metric) er...
constant netinterfaceSubsystem (line 35) | netinterfaceSubsystem = "netinterface"
function init (line 38) | func init() {
function NewNetinterfaceCollector (line 42) | func NewNetinterfaceCollector(logger *slog.Logger) (Collector, error) {
FILE: collector/netisr_freebsd.go
type netisrCollector (line 25) | type netisrCollector struct
method Update (line 88) | func (c *netisrCollector) Update(ch chan<- prometheus.Metric) error {
constant netisrCollectorSubsystem (line 31) | netisrCollectorSubsystem = "netisr"
function init (line 34) | func init() {
function NewNetisrCollector (line 38) | func NewNetisrCollector(logger *slog.Logger) (Collector, error) {
FILE: collector/netstat_freebsd.go
type netStatCollector (line 52) | type netStatCollector struct
method Describe (line 64) | func (c *netStatCollector) Describe(ch chan<- *prometheus.Desc) {
method Collect (line 68) | func (c *netStatCollector) Collect(ch chan<- prometheus.Metric) {
method Update (line 85) | func (c *netStatCollector) Update(ch chan<- prometheus.Metric) error {
function init (line 56) | func init() {
function NewNetStatCollector (line 60) | func NewNetStatCollector(logger *slog.Logger) (Collector, error) {
function getData (line 72) | func getData(queryString string) ([]byte, error) {
FILE: collector/netstat_freebsd_test.go
function TestNetStatCollectorDescribe (line 26) | func TestNetStatCollectorDescribe(t *testing.T) {
function TestGetData (line 39) | func TestGetData(t *testing.T) {
function TestNetStatCollectorUpdate (line 50) | func TestNetStatCollectorUpdate(t *testing.T) {
function TestNewNetStatCollector (line 69) | func TestNewNetStatCollector(t *testing.T) {
FILE: collector/netstat_linux.go
constant netStatsSubsystem (line 35) | netStatsSubsystem = "netstat"
type netStatCollector (line 42) | type netStatCollector struct
method Update (line 61) | func (c *netStatCollector) Update(ch chan<- prometheus.Metric) error {
function init (line 47) | func init() {
function NewNetStatCollector (line 53) | func NewNetStatCollector(logger *slog.Logger) (Collector, error) {
function getNetStats (line 101) | func getNetStats(fileName string) (map[string]map[string]string, error) {
function parseNetStats (line 111) | func parseNetStats(r io.Reader, fileName string) (map[string]map[string]...
function getSNMP6Stats (line 136) | func getSNMP6Stats(fileName string) (map[string]map[string]string, error) {
function parseSNMP6Stats (line 152) | func parseSNMP6Stats(r io.Reader) (map[string]map[string]string, error) {
FILE: collector/netstat_linux_test.go
function TestNetStats (line 23) | func TestNetStats(t *testing.T) {
function testNetStats (line 29) | func testNetStats(t *testing.T, fileName string) {
function testSNMPStats (line 50) | func testSNMPStats(t *testing.T, fileName string) {
function testSNMP6Stats (line 71) | func testSNMP6Stats(t *testing.T, fileName string) {
FILE: collector/network_route_linux.go
type networkRouteCollector (line 29) | type networkRouteCollector struct
method Update (line 59) | func (n networkRouteCollector) Update(ch chan<- prometheus.Metric) err...
function init (line 35) | func init() {
function NewNetworkRouteCollector (line 40) | func NewNetworkRouteCollector(logger *slog.Logger) (Collector, error) {
function networkRouteIPWithPrefixToString (line 134) | func networkRouteIPWithPrefixToString(ip net.IP, len uint8) string {
function networkRouteIPToString (line 149) | func networkRouteIPToString(ip net.IP) string {
function networkRouteProtocolToString (line 156) | func networkRouteProtocolToString(protocol uint8) string {
FILE: collector/nfs_linux.go
constant nfsSubsystem (line 30) | nfsSubsystem = "nfs"
type nfsCollector (line 33) | type nfsCollector struct
method Update (line 97) | func (c *nfsCollector) Update(ch chan<- prometheus.Metric) error {
method updateNFSNetworkStats (line 117) | func (c *nfsCollector) updateNFSNetworkStats(ch chan<- prometheus.Metr...
method updateNFSClientRPCStats (line 127) | func (c *nfsCollector) updateNFSClientRPCStats(ch chan<- prometheus.Me...
method updateNFSRequestsv2Stats (line 137) | func (c *nfsCollector) updateNFSRequestsv2Stats(ch chan<- prometheus.M...
method updateNFSRequestsv3Stats (line 150) | func (c *nfsCollector) updateNFSRequestsv3Stats(ch chan<- prometheus.M...
method updateNFSRequestsv4Stats (line 163) | func (c *nfsCollector) updateNFSRequestsv4Stats(ch chan<- prometheus.M...
function init (line 44) | func init() {
function NewNfsCollector (line 49) | func NewNfsCollector(logger *slog.Logger) (Collector, error) {
FILE: collector/nfsd_linux.go
type nfsdCollector (line 30) | type nfsdCollector struct
method Update (line 63) | func (c *nfsdCollector) Update(ch chan<- prometheus.Metric) error {
method updateNFSdReplyCacheStats (line 90) | func (c *nfsdCollector) updateNFSdReplyCacheStats(ch chan<- prometheus...
method updateNFSdFileHandlesStats (line 121) | func (c *nfsdCollector) updateNFSdFileHandlesStats(ch chan<- prometheu...
method updateNFSdInputOutputStats (line 135) | func (c *nfsdCollector) updateNFSdInputOutputStats(ch chan<- prometheu...
method updateNFSdThreadsStats (line 157) | func (c *nfsdCollector) updateNFSdThreadsStats(ch chan<- prometheus.Me...
method updateNFSdReadAheadCacheStats (line 170) | func (c *nfsdCollector) updateNFSdReadAheadCacheStats(ch chan<- promet...
method updateNFSdNetworkStats (line 192) | func (c *nfsdCollector) updateNFSdNetworkStats(ch chan<- prometheus.Me...
method updateNFSdServerRPCStats (line 219) | func (c *nfsdCollector) updateNFSdServerRPCStats(ch chan<- prometheus....
method updateNFSdRequestsv2Stats (line 250) | func (c *nfsdCollector) updateNFSdRequestsv2Stats(ch chan<- prometheus...
method updateNFSdRequestsv3Stats (line 289) | func (c *nfsdCollector) updateNFSdRequestsv3Stats(ch chan<- prometheus...
method updateNFSdRequestsv4Stats (line 336) | func (c *nfsdCollector) updateNFSdRequestsv4Stats(ch chan<- prometheus...
function init (line 36) | func init() {
constant nfsdSubsystem (line 41) | nfsdSubsystem = "nfsd"
function NewNFSdCollector (line 45) | func NewNFSdCollector(logger *slog.Logger) (Collector, error) {
FILE: collector/ntp.go
constant hour24 (line 31) | hour24 = 24 * time.Hour
constant ntpSubsystem (line 32) | ntpSubsystem = "ntp"
type ntpCollector (line 50) | type ntpCollector struct
method Update (line 127) | func (c *ntpCollector) Update(ch chan<- prometheus.Metric) error {
function init (line 55) | func init() {
function NewNtpCollector (line 63) | func NewNtpCollector(logger *slog.Logger) (Collector, error) {
FILE: collector/nvme_linux.go
type nvmeCollector (line 28) | type nvmeCollector struct
method Update (line 98) | func (c *nvmeCollector) Update(ch chan<- prometheus.Metric) error {
function init (line 39) | func init() {
function NewNVMeCollector (line 44) | func NewNVMeCollector(logger *slog.Logger) (Collector, error) {
FILE: collector/os_release.go
constant etcOSRelease (line 35) | etcOSRelease = "/etc/os-release"
constant usrLibOSRelease (line 36) | usrLibOSRelease = "/usr/lib/os-release"
constant systemVersionPlist (line 37) | systemVersionPlist = "/System/Library/CoreServices/SystemVersion.plist"
type osRelease (line 44) | type osRelease struct
type osReleaseCollector (line 60) | type osReleaseCollector struct
method UpdateStruct (line 129) | func (c *osReleaseCollector) UpdateStruct(path string) error {
method Update (line 174) | func (c *osReleaseCollector) Update(ch chan<- prometheus.Metric) error {
type Plist (line 72) | type Plist struct
type Dict (line 76) | type Dict struct
function init (line 81) | func init() {
function NewOSCollector (line 86) | func NewOSCollector(logger *slog.Logger) (Collector, error) {
function parseOSRelease (line 110) | func parseOSRelease(r io.Reader) (*osRelease, error) {
function getMacosProductVersion (line 205) | func getMacosProductVersion(filename string) (*osRelease, error) {
FILE: collector/os_release_test.go
constant debianBullseye (line 25) | debianBullseye string = `PRETTY_NAME="Debian GNU/Linux 11 (bullseye)"
constant nixosTapir (line 36) | nixosTapir string = `BUG_REPORT_URL="https://github.com/NixOS/nixpkgs/is...
function TestParseOSRelease (line 51) | func TestParseOSRelease(t *testing.T) {
function TestParseOSSupportEnd (line 94) | func TestParseOSSupportEnd(t *testing.T) {
function TestUpdateStruct (line 120) | func TestUpdateStruct(t *testing.T) {
FILE: collector/partition_aix.go
type partitionCollector (line 25) | type partitionCollector struct
method Update (line 91) | func (c *partitionCollector) Update(ch chan<- prometheus.Metric) error {
constant partitionCollectorSubsystem (line 38) | partitionCollectorSubsystem = "partition"
function init (line 41) | func init() {
function NewPartitionCollector (line 45) | func NewPartitionCollector(logger *slog.Logger) (Collector, error) {
FILE: collector/paths.go
function procFilePath (line 32) | func procFilePath(name string) string {
function sysFilePath (line 36) | func sysFilePath(name string) string {
function rootfsFilePath (line 40) | func rootfsFilePath(name string) string {
function udevDataFilePath (line 44) | func udevDataFilePath(name string) string {
function rootfsStripPrefix (line 48) | func rootfsStripPrefix(path string) string {
FILE: collector/paths_test.go
function TestDefaultProcPath (line 23) | func TestDefaultProcPath(t *testing.T) {
function TestCustomProcPath (line 37) | func TestCustomProcPath(t *testing.T) {
function TestDefaultSysPath (line 51) | func TestDefaultSysPath(t *testing.T) {
function TestCustomSysPath (line 65) | func TestCustomSysPath(t *testing.T) {
FILE: collector/pcidevice_linux.go
constant pcideviceSubsystem (line 32) | pcideviceSubsystem = "pcidevice"
type pcideviceCollector (line 144) | type pcideviceCollector struct
method Update (line 199) | func (c *pcideviceCollector) Update(ch chan<- prometheus.Metric) error {
method loadPCIIds (line 357) | func (c *pcideviceCollector) loadPCIIds() {
method getPCIVendorName (line 512) | func (c *pcideviceCollector) getPCIVendorName(vendorID string) string {
method getPCIDeviceName (line 529) | func (c *pcideviceCollector) getPCIDeviceName(vendorID, deviceID strin...
method getPCISubsystemName (line 550) | func (c *pcideviceCollector) getPCISubsystemName(vendorID, deviceID, s...
method getPCIClassName (line 574) | func (c *pcideviceCollector) getPCIClassName(classID string) string {
function init (line 157) | func init() {
function NewPcideviceCollector (line 162) | func NewPcideviceCollector(logger *slog.Logger) (Collector, error) {
FILE: collector/pcidevice_linux_test.go
function TestPCICollectorWithNameResolution (line 31) | func TestPCICollectorWithNameResolution(t *testing.T) {
type testPCICollector (line 67) | type testPCICollector struct
method Collect (line 71) | func (tc *testPCICollector) Collect(ch chan<- prometheus.Metric) {
method Describe (line 86) | func (tc *testPCICollector) Describe(ch chan<- *prometheus.Desc) {
FILE: collector/perf_linux.go
constant perfSubsystem (line 32) | perfSubsystem = "perf"
function init (line 46) | func init() {
function perfTracepointFlagToTracepoints (line 100) | func perfTracepointFlagToTracepoints(tracepointsFlag []string) ([]*perfT...
function perfCPUFlagToCPUs (line 117) | func perfCPUFlagToCPUs(cpuFlag string) ([]int, error) {
type perfTracepoint (line 162) | type perfTracepoint struct
method label (line 168) | func (t *perfTracepoint) label() string {
method tracepoint (line 173) | func (t *perfTracepoint) tracepoint() string {
type perfCollector (line 182) | type perfCollector struct
method Update (line 723) | func (c *perfCollector) Update(ch chan<- prometheus.Metric) error {
method updateHardwareStats (line 742) | func (c *perfCollector) updateHardwareStats(ch chan<- prometheus.Metri...
method updateSoftwareStats (line 827) | func (c *perfCollector) updateSoftwareStats(ch chan<- prometheus.Metri...
method updateCacheStats (line 880) | func (c *perfCollector) updateCacheStats(ch chan<- prometheus.Metric) ...
type perfTracepointCollector (line 194) | type perfTracepointCollector struct
method update (line 205) | func (c *perfTracepointCollector) update(ch chan<- prometheus.Metric) ...
method updateCPU (line 215) | func (c *perfTracepointCollector) updateCPU(cpu int, ch chan<- prometh...
function newPerfTracepointCollector (line 240) | func newPerfTracepointCollector(
function NewPerfCollector (line 302) | func NewPerfCollector(logger *slog.Logger) (Collector, error) {
FILE: collector/perf_linux_test.go
function canTestPerf (line 30) | func canTestPerf(t *testing.T) {
function TestPerfCollector (line 45) | func TestPerfCollector(t *testing.T) {
function TestPerfCollectorStride (line 66) | func TestPerfCollectorStride(t *testing.T) {
function TestPerfCPUFlagToCPUs (line 121) | func TestPerfCPUFlagToCPUs(t *testing.T) {
function TestPerfTracepointFlagToTracepoints (line 194) | func TestPerfTracepointFlagToTracepoints(t *testing.T) {
FILE: collector/powersupplyclass.go
type powerSupplyClassCollector (line 30) | type powerSupplyClassCollector struct
function init (line 37) | func init() {
function NewPowerSupplyClassCollector (line 41) | func NewPowerSupplyClassCollector(logger *slog.Logger) (Collector, error) {
FILE: collector/powersupplyclass_darwin.go
method Update (line 190) | func (c *powerSupplyClassCollector) Update(ch chan<- prometheus.Metric) ...
function getPowerSourceList (line 265) | func getPowerSourceList() ([]*C.struct_macos_powersupply, error) {
function getPowerSourceDescriptorMap (line 310) | func getPowerSourceDescriptorMap(info *C.struct_macos_powersupply) map[s...
function getPowerSourceDescriptorLabels (line 328) | func getPowerSourceDescriptorLabels(info *C.struct_macos_powersupply) ma...
function getPowerSourceDescriptorState (line 338) | func getPowerSourceDescriptorState(info *C.struct_macos_powersupply) map...
function getPowerSourceDescriptorBatteryHealth (line 352) | func getPowerSourceDescriptorBatteryHealth(info *C.struct_macos_powersup...
function convertValue (line 370) | func convertValue(value *C.int) *float64 {
function scaleValue (line 380) | func scaleValue(value *C.int, scale float64) *float64 {
function minutesToSeconds (line 395) | func minutesToSeconds(minutes *C.int) *float64 {
function pushEnumMetric (line 408) | func pushEnumMetric(ch chan<- prometheus.Metric, values map[string]float...
FILE: collector/powersupplyclass_linux.go
method Update (line 29) | func (c *powerSupplyClassCollector) Update(ch chan<- prometheus.Metric) ...
function pushPowerSupplyMetric (line 146) | func pushPowerSupplyMetric(ch chan<- prometheus.Metric, subsystem string...
function getPowerSupplyClassInfo (line 157) | func getPowerSupplyClassInfo(ignore *regexp.Regexp) (sysfs.PowerSupplyCl...
FILE: collector/pressure_linux.go
constant psiResourceCPU (line 30) | psiResourceCPU = "cpu"
constant psiResourceIO (line 31) | psiResourceIO = "io"
constant psiResourceMemory (line 32) | psiResourceMemory = "memory"
constant psiResourceIRQ (line 33) | psiResourceIRQ = "irq"
type pressureStatsCollector (line 40) | type pressureStatsCollector struct
method Update (line 101) | func (c *pressureStatsCollector) Update(ch chan<- prometheus.Metric) e...
function init (line 53) | func init() {
function NewPressureStatsCollector (line 58) | func NewPressureStatsCollector(logger *slog.Logger) (Collector, error) {
FILE: collector/processes_linux.go
type processCollector (line 32) | type processCollector struct
method Update (line 85) | func (c *processCollector) Update(ch chan<- prometheus.Metric) error {
method getAllocatedThreads (line 116) | func (c *processCollector) getAllocatedThreads() (int, map[string]int3...
method getThreadStates (line 148) | func (c *processCollector) getThreadStates(pid int, pidStat procfs.Pro...
method isIgnoredError (line 187) | func (c *processCollector) isIgnoredError(err error) bool {
function init (line 43) | func init() {
function NewProcessStatCollector (line 48) | func NewProcessStatCollector(logger *slog.Logger) (Collector, error) {
FILE: collector/processes_linux_test.go
function TestReadProcessStatus (line 27) | func TestReadProcessStatus(t *testing.T) {
FILE: collector/qdisc_linux.go
type qdiscStatCollector (line 30) | type qdiscStatCollector struct
method Update (line 131) | func (c *qdiscStatCollector) Update(ch chan<- prometheus.Metric) error {
function init (line 50) | func init() {
function NewQdiscStatCollector (line 55) | func NewQdiscStatCollector(logger *slog.Logger) (Collector, error) {
function testQdiscGet (line 119) | func testQdiscGet(fixtures string) ([]qdisc.QdiscInfo, error) {
FILE: collector/rapl_linux.go
constant raplCollectorSubsystem (line 30) | raplCollectorSubsystem = "rapl"
type raplCollector (line 32) | type raplCollector struct
method Update (line 70) | func (c *raplCollector) Update(ch chan<- prometheus.Metric) error {
method joulesMetric (line 106) | func (c *raplCollector) joulesMetric(z sysfs.RaplZone, v float64) prom...
method joulesMetricWithZoneLabel (line 127) | func (c *raplCollector) joulesMetricWithZoneLabel(z sysfs.RaplZone, v ...
function init (line 39) | func init() {
function NewRaplCollector (line 48) | func NewRaplCollector(logger *slog.Logger) (Collector, error) {
FILE: collector/runit.go
type runitCollector (line 28) | type runitCollector struct
method Update (line 75) | func (c *runitCollector) Update(ch chan<- prometheus.Metric) error {
function init (line 36) | func init() {
function NewRunitCollector (line 41) | func NewRunitCollector(logger *slog.Logger) (Collector, error) {
FILE: collector/schedstat_linux.go
constant nsPerSec (line 28) | nsPerSec = 1e9
function NewSchedstatCollector (line 54) | func NewSchedstatCollector(logger *slog.Logger) (Collector, error) {
type schedstatCollector (line 63) | type schedstatCollector struct
method Update (line 72) | func (c *schedstatCollector) Update(ch chan<- prometheus.Metric) error {
function init (line 68) | func init() {
FILE: collector/selinux_linux.go
type selinuxCollector (line 25) | type selinuxCollector struct
method Update (line 60) | func (c *selinuxCollector) Update(ch chan<- prometheus.Metric) error {
function init (line 32) | func init() {
function NewSelinuxCollector (line 37) | func NewSelinuxCollector(logger *slog.Logger) (Collector, error) {
FILE: collector/slabinfo_linux.go
type slabinfoCollector (line 32) | type slabinfoCollector struct
method Update (line 58) | func (c *slabinfoCollector) Update(ch chan<- prometheus.Metric) error {
method activeObjects (line 78) | func (c *slabinfoCollector) activeObjects(label string, val int64) pro...
method objects (line 89) | func (c *slabinfoCollector) objects(label string, val int64) prometheu...
method objectSizeBytes (line 100) | func (c *slabinfoCollector) objectSizeBytes(label string, val int64) p...
method objectsPerSlab (line 111) | func (c *slabinfoCollector) objectsPerSlab(label string, val int64) pr...
method pagesPerSlab (line 122) | func (c *slabinfoCollector) pagesPerSlab(label string, val int64) prom...
function init (line 40) | func init() {
function NewSlabinfoCollector (line 44) | func NewSlabinfoCollector(logger *slog.Logger) (Collector, error) {
FILE: collector/sockstat_linux.go
constant sockStatSubsystem (line 29) | sockStatSubsystem = "sockstat"
type sockStatCollector (line 35) | type sockStatCollector struct
method Update (line 48) | func (c *sockStatCollector) Update(ch chan<- prometheus.Metric) error {
method update (line 93) | func (c *sockStatCollector) update(ch chan<- prometheus.Metric, isIPv6...
function init (line 39) | func init() {
function NewSockStatCollector (line 44) | func NewSockStatCollector(logger *slog.Logger) (Collector, error) {
FILE: collector/softirqs_common.go
type softirqsCollector (line 26) | type softirqsCollector struct
function init (line 32) | func init() {
function NewSoftirqsCollector (line 37) | func NewSoftirqsCollector(logger *slog.Logger) (Collector, error) {
FILE: collector/softirqs_linux.go
method Update (line 29) | func (c *softirqsCollector) Update(ch chan<- prometheus.Metric) (err err...
FILE: collector/softnet_linux.go
type softnetCollector (line 27) | type softnetCollector struct
method Update (line 96) | func (c *softnetCollector) Update(ch chan<- prometheus.Metric) error {
constant softnetSubsystem (line 40) | softnetSubsystem = "softnet"
function init (line 43) | func init() {
function NewSoftnetCollector (line 48) | func NewSoftnetCollector(logger *slog.Logger) (Collector, error) {
FILE: collector/stat_linux.go
type statCollector (line 27) | type statCollector struct
method Update (line 93) | func (c *statCollector) Update(ch chan<- prometheus.Metric) error {
function init (line 41) | func init() {
function NewStatCollector (line 46) | func NewStatCollector(logger *slog.Logger) (Collector, error) {
FILE: collector/supervisord.go
type supervisordCollector (line 37) | type supervisordCollector struct
method isRunning (line 101) | func (c *supervisordCollector) isRunning(state int) bool {
method Update (line 120) | func (c *supervisordCollector) Update(ch chan<- prometheus.Metric) err...
function init (line 45) | func init() {
function NewSupervisordCollector (line 50) | func NewSupervisordCollector(logger *slog.Logger) (Collector, error) {
FILE: collector/swap_linux.go
constant swapSubsystem (line 27) | swapSubsystem = "swap"
type swapCollector (line 32) | type swapCollector struct
method getSwapInfo (line 62) | func (c *swapCollector) getSwapInfo() ([]SwapsEntry, error) {
method Update (line 78) | func (c *swapCollector) Update(ch chan<- prometheus.Metric) error {
function init (line 37) | func init() {
function NewSwapCollector (line 42) | func NewSwapCollector(logger *slog.Logger) (Collector, error) {
type SwapsEntry (line 54) | type SwapsEntry struct
FILE: collector/swap_linux_test.go
function TestSwap (line 24) | func TestSwap(t *testing.T) {
FILE: collector/sysctl_bsd.go
type bsdSysctlType (line 29) | type bsdSysctlType
constant bsdSysctlTypeUint32 (line 35) | bsdSysctlTypeUint32 bsdSysctlType = iota
constant bsdSysctlTypeUint64 (line 36) | bsdSysctlTypeUint64
constant bsdSysctlTypeCLong (line 37) | bsdSysctlTypeCLong
type bsdSysctl (line 42) | type bsdSysctl struct
method Value (line 62) | func (b bsdSysctl) Value() (float64, error) {
method getCLong (line 90) | func (b bsdSysctl) getCLong() (float64, error) {
FILE: collector/sysctl_linux.go
type sysctlCollector (line 34) | type sysctlCollector struct
method Update (line 73) | func (c *sysctlCollector) Update(ch chan<- prometheus.Metric) error {
method newMetrics (line 87) | func (c *sysctlCollector) newMetrics(s *sysctl) ([]prometheus.Metric, ...
function init (line 40) | func init() {
function NewSysctlCollector (line 44) | func NewSysctlCollector(logger *slog.Logger) (Collector, error) {
type sysctl (line 131) | type sysctl struct
method metricName (line 150) | func (s *sysctl) metricName() string {
method newConstMetric (line 154) | func (s *sysctl) newConstMetric(v any) prometheus.Metric {
method newIndexedMetrics (line 174) | func (s *sysctl) newIndexedMetrics(v any) []prometheus.Metric {
method newMappedMetrics (line 198) | func (s *sysctl) newMappedMetrics(v any) ([]prometheus.Metric, error) {
function newSysctl (line 137) | func newSysctl(include string, numeric bool) (*sysctl, error) {
FILE: collector/sysctl_openbsd_amd64.go
function int8ToString (line 23) | func int8ToString(a []int8) string {
type _C_int (line 36) | type _C_int
function errnoErr (line 40) | func errnoErr(e syscall.Errno) error {
function _sysctl (line 54) | func _sysctl(mib []_C_int, old *byte, oldlen *uintptr, new *byte, newlen...
function sysctl (line 73) | func sysctl(mib []_C_int) ([]byte, error) {
FILE: collector/systemd_linux.go
constant minSystemdVersionSystemState (line 39) | minSystemdVersionSystemState = 212
type systemdCollector (line 63) | type systemdCollector struct
method Update (line 182) | func (c *systemdCollector) Update(ch chan<- prometheus.Metric) error {
method collectUnitStatusMetrics (line 282) | func (c *systemdCollector) collectUnitStatusMetrics(conn *dbus.Conn, c...
method collectSockets (line 323) | func (c *systemdCollector) collectSockets(conn *dbus.Conn, ch chan<- p...
method collectUnitStartTimeMetrics (line 357) | func (c *systemdCollector) collectUnitStartTimeMetrics(conn *dbus.Conn...
method collectUnitTasksMetrics (line 378) | func (c *systemdCollector) collectUnitTasksMetrics(conn *dbus.Conn, ch...
method collectTimers (line 410) | func (c *systemdCollector) collectTimers(conn *dbus.Conn, ch chan<- pr...
method collectSummaryMetrics (line 428) | func (c *systemdCollector) collectSummaryMetrics(ch chan<- prometheus....
method collectSystemState (line 435) | func (c *systemdCollector) collectSystemState(conn *dbus.Conn, ch chan...
method getAllUnits (line 459) | func (c *systemdCollector) getAllUnits(conn *dbus.Conn) ([]unit, error) {
method getSystemdVersion (line 504) | func (c *systemdCollector) getSystemdVersion(conn *dbus.Conn) (float64...
method getSystemdVirtualization (line 521) | func (c *systemdCollector) getSystemdVirtualization(conn *dbus.Conn) s...
function init (line 85) | func init() {
function NewSystemdCollector (line 90) | func NewSystemdCollector(logger *slog.Logger) (Collector, error) {
function newSystemdDbusConn (line 448) | func newSystemdDbusConn() (*dbus.Conn, error) {
type unit (line 455) | type unit struct
function summarizeUnits (line 476) | func summarizeUnits(units []unit) map[string]float64 {
function filterUnits (line 490) | func filterUnits(units []unit, includePattern, excludePattern *regexp.Re...
FILE: collector/systemd_linux_test.go
function getUnitListFixtures (line 28) | func getUnitListFixtures() [][]unit {
function TestSystemdIgnoreFilter (line 93) | func TestSystemdIgnoreFilter(t *testing.T) {
function TestSystemdIgnoreFilterDefaultKeepsAll (line 104) | func TestSystemdIgnoreFilterDefaultKeepsAll(t *testing.T) {
function TestSystemdSummary (line 119) | func TestSystemdSummary(t *testing.T) {
function testSummaryHelper (line 135) | func testSummaryHelper(t *testing.T, state string, actual float64, expec...
FILE: collector/tapestats_linux.go
type tapestatsCollector (line 33) | type tapestatsCollector struct
method Update (line 123) | func (c *tapestatsCollector) Update(ch chan<- prometheus.Metric) error {
function init (line 49) | func init() {
function NewTapestatsCollector (line 55) | func NewTapestatsCollector(logger *slog.Logger) (Collector, error) {
FILE: collector/tcpstat_linux.go
type tcpConnectionState (line 29) | type tcpConnectionState
method String (line 201) | func (st tcpConnectionState) String() string {
constant tcpEstablished (line 33) | tcpEstablished tcpConnectionState = iota + 1
constant tcpSynSent (line 35) | tcpSynSent
constant tcpSynRecv (line 37) | tcpSynRecv
constant tcpFinWait1 (line 39) | tcpFinWait1
constant tcpFinWait2 (line 41) | tcpFinWait2
constant tcpTimeWait (line 43) | tcpTimeWait
constant tcpClose (line 45) | tcpClose
constant tcpCloseWait (line 47) | tcpCloseWait
constant tcpLastAck (line 49) | tcpLastAck
constant tcpListen (line 51) | tcpListen
constant tcpClosing (line 53) | tcpClosing
constant tcpRxQueuedBytes (line 55) | tcpRxQueuedBytes
constant tcpTxQueuedBytes (line 57) | tcpTxQueuedBytes
type tcpStatCollector (line 60) | type tcpStatCollector struct
method Update (line 130) | func (c *tcpStatCollector) Update(ch chan<- prometheus.Metric) error {
function init (line 65) | func init() {
function NewTCPStatCollector (line 70) | func NewTCPStatCollector(logger *slog.Logger) (Collector, error) {
type InetDiagSockID (line 83) | type InetDiagSockID struct
type InetDiagReqV2 (line 94) | type InetDiagReqV2 struct
method Serialize (line 105) | func (req *InetDiagReqV2) Serialize() []byte {
method Len (line 109) | func (req *InetDiagReqV2) Len() int {
constant sizeOfDiagRequest (line 103) | sizeOfDiagRequest = 0x38
type InetDiagMsg (line 113) | type InetDiagMsg struct
function parseInetDiagMsg (line 126) | func parseInetDiagMsg(b []byte) *InetDiagMsg {
function getTCPStats (line 155) | func getTCPStats(family uint8) (map[tcpConnectionState]float64, error) {
function parseTCPStats (line 187) | func parseTCPStats(msgs []netlink.Message) (map[tcpConnectionState]float...
FILE: collector/tcpstat_linux_test.go
function Test_parseTCPStats (line 27) | func Test_parseTCPStats(t *testing.T) {
FILE: collector/textfile.go
type textFileCollector (line 45) | type textFileCollector struct
method exportMTimes (line 160) | func (c *textFileCollector) exportMTimes(mtimes map[string]time.Time, ...
method Update (line 183) | func (c *textFileCollector) Update(ch chan<- prometheus.Metric) error {
method processFile (line 288) | func (c *textFileCollector) processFile(dir, name string, ch chan<- pr...
function init (line 52) | func init() {
function NewTextFileCollector (line 58) | func NewTextFileCollector(logger *slog.Logger) (Collector, error) {
function convertMetricFamily (line 66) | func convertMetricFamily(metricFamily *dto.MetricFamily, ch chan<- prome...
function hasTimestamps (line 318) | func hasTimestamps(parsedFamilies map[string]*dto.MetricFamily) bool {
FILE: collector/textfile_test.go
type collectorAdapter (line 34) | type collectorAdapter struct
method Describe (line 39) | func (a collectorAdapter) Describe(ch chan<- *prometheus.Desc) {
method Collect (line 46) | func (a collectorAdapter) Collect(ch chan<- prometheus.Metric) {
function TestTextfileCollector (line 52) | func TestTextfileCollector(t *testing.T) {
FILE: collector/thermal_darwin.go
type thermCollector (line 57) | type thermCollector struct
method Update (line 113) | func (c *thermCollector) Update(ch chan<- prometheus.Metric) error {
constant thermal (line 65) | thermal = "thermal"
function init (line 67) | func init() {
function NewThermCollector (line 72) | func NewThermCollector(logger *slog.Logger) (Collector, error) {
function fetchCPUPowerStatus (line 131) | func fetchCPUPowerStatus() (map[string]int, error) {
type CFDict (line 152) | type CFDict
function mappingCFDictToMap (line 154) | func mappingCFDictToMap(dict CFDict) map[string]int {
function mappingCFStringToString (line 175) | func mappingCFStringToString(s C.CFStringRef) string {
function mappingCFNumberLongToInt (line 194) | func mappingCFNumberLongToInt(n C.CFNumberRef) int {
FILE: collector/thermal_darwin_amd64.go
method updateTemperatures (line 20) | func (c *thermCollector) updateTemperatures(ch chan<- prometheus.Metric)...
FILE: collector/thermal_darwin_arm64.go
constant absoluteZeroCelsius (line 52) | absoluteZeroCelsius = -273.15
method updateTemperatures (line 54) | func (c *thermCollector) updateTemperatures(ch chan<- prometheus.Metric)...
function cfStringToString (line 134) | func cfStringToString(s C.CFStringRef) string {
FILE: collector/thermal_zone_linux.go
constant coolingDevice (line 28) | coolingDevice = "cooling_device"
constant thermalZone (line 29) | thermalZone = "thermal_zone"
type thermalZoneCollector (line 31) | type thermalZoneCollector struct
method Update (line 71) | func (c *thermalZoneCollector) Update(ch chan<- prometheus.Metric) err...
function init (line 39) | func init() {
function NewThermalZoneCollector (line 44) | func NewThermalZoneCollector(logger *slog.Logger) (Collector, error) {
FILE: collector/time.go
type timeCollector (line 25) | type timeCollector struct
method Update (line 66) | func (c *timeCollector) Update(ch chan<- prometheus.Metric) error {
function init (line 33) | func init() {
function NewTimeCollector (line 39) | func NewTimeCollector(logger *slog.Logger) (Collector, error) {
FILE: collector/time_linux.go
method update (line 26) | func (c *timeCollector) update(ch chan<- prometheus.Metric) error {
FILE: collector/time_other.go
method update (line 22) | func (c *timeCollector) update(ch chan<- prometheus.Metric) error {
FILE: collector/timex.go
constant timeError (line 31) | timeError = 5
constant staNano (line 34) | staNano = 0x2000
constant nanoSeconds (line 37) | nanoSeconds = 1000000000
constant microSeconds (line 38) | microSeconds = 1000000
constant ppm16frac (line 41) | ppm16frac = 1000000.0 * 65536.0
type timexCollector (line 44) | type timexCollector struct
method Update (line 163) | func (c *timexCollector) Update(ch chan<- prometheus.Metric) error {
function init (line 65) | func init() {
function NewTimexCollector (line 70) | func NewTimexCollector(logger *slog.Logger) (Collector, error) {
FILE: collector/udp_queues_linux.go
type udpQueuesCollector (line 29) | type udpQueuesCollector struct
method Update (line 57) | func (c *udpQueuesCollector) Update(ch chan<- prometheus.Metric) error {
function init (line 36) | func init() {
function NewUDPqueuesCollector (line 41) | func NewUDPqueuesCollector(logger *slog.Logger) (Collector, error) {
FILE: collector/uname.go
type unameCollector (line 38) | type unameCollector struct
method Update (line 59) | func (c *unameCollector) Update(ch chan<- prometheus.Metric) error {
type uname (line 41) | type uname struct
function init (line 50) | func init() {
function NewUnameCollector (line 55) | func NewUnameCollector(logger *slog.Logger) (Collector, error) {
FILE: collector/uname_bsd.go
function getUname (line 24) | func getUname() (uname, error) {
function parseHostNameAndDomainName (line 46) | func parseHostNameAndDomainName(utsname unix.Utsname) (hostname string, ...
FILE: collector/uname_linux.go
function getUname (line 20) | func getUname() (uname, error) {
FILE: collector/utils/utils.go
function SafeDereference (line 21) | func SafeDereference[T any](s ...*T) []T {
function SafeBytesToString (line 38) | func SafeBytesToString(b []byte) string {
FILE: collector/utils/utils_test.go
function TestSafeBytesToString (line 20) | func TestSafeBytesToString(t *testing.T) {
FILE: collector/vmstat_linux.go
constant vmStatSubsystem (line 32) | vmStatSubsystem = "vmstat"
type vmStatCollector (line 39) | type vmStatCollector struct
method Update (line 57) | func (c *vmStatCollector) Update(ch chan<- prometheus.Metric) error {
function init (line 44) | func init() {
function NewvmStatCollector (line 49) | func NewvmStatCollector(logger *slog.Logger) (Collector, error) {
FILE: collector/watchdog.go
type watchdogCollector (line 28) | type watchdogCollector struct
method Update (line 100) | func (c *watchdogCollector) Update(ch chan<- prometheus.Metric) error {
function init (line 33) | func init() {
function NewWatchdogCollector (line 38) | func NewWatchdogCollector(logger *slog.Logger) (Collector, error) {
function toLabelValue (line 93) | func toLabelValue(ptr *string) string {
FILE: collector/watchdog_test.go
type testWatchdogCollector (line 29) | type testWatchdogCollector struct
method Collect (line 33) | func (c testWatchdogCollector) Collect(ch chan<- prometheus.Metric) {
method Describe (line 37) | func (c testWatchdogCollector) Describe(ch chan<- *prometheus.Desc) {
function TestWatchdogStats (line 41) | func TestWatchdogStats(t *testing.T) {
FILE: collector/wifi_linux.go
type wifiCollector (line 31) | type wifiCollector struct
method Update (line 181) | func (c *wifiCollector) Update(ch chan<- prometheus.Metric) error {
method updateBSSStats (line 250) | func (c *wifiCollector) updateBSSStats(ch chan<- prometheus.Metric, de...
method updateStationStats (line 263) | func (c *wifiCollector) updateStationStats(ch chan<- prometheus.Metric...
function init (line 55) | func init() {
type wifiStater (line 62) | type wifiStater interface
function NewWifiCollector (line 70) | func NewWifiCollector(logger *slog.Logger) (Collector, error) {
function mHzToHz (line 361) | func mHzToHz(mHz int) float64 {
function bssStatusMode (line 365) | func bssStatusMode(status wifi.BSSStatus) string {
function newWifiStater (line 381) | func newWifiStater(fixtures string) (wifiStater, error) {
type mockWifiStater (line 393) | type mockWifiStater struct
method unmarshalJSONFile (line 397) | func (s *mockWifiStater) unmarshalJSONFile(filename string, v any) err...
method Close (line 406) | func (s *mockWifiStater) Close() error { return nil }
method BSS (line 408) | func (s *mockWifiStater) BSS(ifi *wifi.Interface) (*wifi.BSS, error) {
method Interfaces (line 419) | func (s *mockWifiStater) Interfaces() ([]*wifi.Interface, error) {
method StationInfo (line 428) | func (s *mockWifiStater) StationInfo(ifi *wifi.Interface) ([]*wifi.Sta...
FILE: collector/xfrm.go
type xfrmCollector (line 26) | type xfrmCollector struct
method Update (line 191) | func (c *xfrmCollector) Update(ch chan<- prometheus.Metric) error {
function init (line 31) | func init() {
function NewXfrmCollector (line 36) | func NewXfrmCollector(logger *slog.Logger) (Collector, error) {
FILE: collector/xfrm_test.go
type testXfrmCollector (line 29) | type testXfrmCollector struct
method Collect (line 33) | func (c testXfrmCollector) Collect(ch chan<- prometheus.Metric) {
method Describe (line 37) | func (c testXfrmCollector) Describe(ch chan<- *prometheus.Desc) {
function TestXfrmStats (line 41) | func TestXfrmStats(t *testing.T) {
FILE: collector/xfs_linux.go
type xfsCollector (line 27) | type xfsCollector struct
method Update (line 50) | func (c *xfsCollector) Update(ch chan<- prometheus.Metric) error {
method updateXFSStats (line 64) | func (c *xfsCollector) updateXFSStats(ch chan<- prometheus.Metric, s *...
function init (line 32) | func init() {
function NewXFSCollector (line 37) | func NewXFSCollector(logger *slog.Logger) (Collector, error) {
FILE: collector/zfs_common.go
function init (line 18) | func init() {
FILE: collector/zfs_freebsd.go
type zfsCollector (line 24) | type zfsCollector struct
method Update (line 266) | func (c *zfsCollector) Update(ch chan<- prometheus.Metric) error {
constant zfsCollectorSubsystem (line 30) | zfsCollectorSubsystem = "zfs"
function NewZFSCollector (line 33) | func NewZFSCollector(logger *slog.Logger) (Collector, error) {
FILE: collector/zfs_linux.go
constant kstatDataInt64 (line 38) | kstatDataInt64 = "3"
constant kstatDataUint64 (line 39) | kstatDataUint64 = "4"
type zfsCollector (line 51) | type zfsCollector struct
method Update (line 84) | func (c *zfsCollector) Update(ch chan<- prometheus.Metric) error {
method openProcFile (line 107) | func (c *zfsCollector) openProcFile(path string) (*os.File, error) {
method updateZfsStats (line 119) | func (c *zfsCollector) updateZfsStats(subsystem string, ch chan<- prom...
method updatePoolStats (line 138) | func (c *zfsCollector) updatePoolStats(ch chan<- prometheus.Metric) er...
method parseProcfsFile (line 214) | func (c *zfsCollector) parseProcfsFile(reader io.Reader, fmtExt string...
method parsePoolProcfsFile (line 256) | func (c *zfsCollector) parsePoolProcfsFile(reader io.Reader, zpoolPath...
method parsePoolObjsetFile (line 297) | func (c *zfsCollector) parsePoolObjsetFile(reader io.Reader, zpoolPath...
method parsePoolStateFile (line 338) | func (c *zfsCollector) parsePoolStateFile(reader io.Reader, zpoolPath ...
method constSysctlMetric (line 370) | func (c *zfsCollector) constSysctlMetric(subsystem string, sysctl zfsS...
method constPoolMetric (line 385) | func (c *zfsCollector) constPoolMetric(poolName string, sysctl zfsSysc...
method constPoolObjsetMetric (line 401) | func (c *zfsCollector) constPoolObjsetMetric(poolName string, datasetN...
method constPoolStateMetric (line 418) | func (c *zfsCollector) constPoolStateMetric(poolName string, stateName...
function NewZFSCollector (line 61) | func NewZFSCollector(logger *slog.Logger) (Collector, error) {
type zfsSysctl (line 433) | type zfsSysctl
method metricName (line 435) | func (s zfsSysctl) metricName() string {
FILE: collector/zfs_linux_test.go
function TestArcstatsParsing (line 24) | func TestArcstatsParsing(t *testing.T) {
function TestZfetchstatsParsing (line 61) | func TestZfetchstatsParsing(t *testing.T) {
function TestZilParsing (line 97) | func TestZilParsing(t *testing.T) {
function TestVdevCacheStatsParsing (line 133) | func TestVdevCacheStatsParsing(t *testing.T) {
function TestXuioStatsParsing (line 169) | func TestXuioStatsParsing(t *testing.T) {
function TestFmParsing (line 205) | func TestFmParsing(t *testing.T) {
function TestDmuTxParsing (line 241) | func TestDmuTxParsing(t *testing.T) {
function TestZpoolParsing (line 277) | func TestZpoolParsing(t *testing.T) {
function TestZpoolObjsetParsingWithSpace (line 317) | func TestZpoolObjsetParsingWithSpace(t *testing.T) {
function TestZpoolObjsetParsing (line 366) | func TestZpoolObjsetParsing(t *testing.T) {
function TestAbdstatsParsing (line 406) | func TestAbdstatsParsing(t *testing.T) {
function TestDbufstatsParsing (line 442) | func TestDbufstatsParsing(t *testing.T) {
function TestDnodestatsParsing (line 478) | func TestDnodestatsParsing(t *testing.T) {
function TestVdevMirrorstatsParsing (line 514) | func TestVdevMirrorstatsParsing(t *testing.T) {
function TestPoolStateParsing (line 550) | func TestPoolStateParsing(t *testing.T) {
FILE: collector/zfs_solaris.go
type zfsCollector (line 26) | type zfsCollector struct
method updateZfsAbdStats (line 185) | func (c *zfsCollector) updateZfsAbdStats(ch chan<- prometheus.Metric) ...
method updateZfsArcStats (line 229) | func (c *zfsCollector) updateZfsArcStats(ch chan<- prometheus.Metric) ...
method updateZfsFetchStats (line 288) | func (c *zfsCollector) updateZfsFetchStats(ch chan<- prometheus.Metric...
method Update (line 320) | func (c *zfsCollector) Update(ch chan<- prometheus.Metric) error {
constant zfsCollectorSubsystem (line 60) | zfsCollectorSubsystem = "zfs"
function NewZFSCollector (line 63) | func NewZFSCollector(logger *slog.Logger) (Collector, error) {
FILE: collector/zoneinfo_linux.go
constant zoneinfoSubsystem (line 25) | zoneinfoSubsystem = "zoneinfo"
type zoneinfoCollector (line 27) | type zoneinfoCollector struct
method Update (line 52) | func (c *zoneinfoCollector) Update(ch chan<- prometheus.Metric) error {
function init (line 34) | func init() {
function NewZoneinfoCollector (line 39) | func NewZoneinfoCollector(logger *slog.Logger) (Collector, error) {
function createGaugeMetricDescriptions (line 95) | func createGaugeMetricDescriptions() map[string]*prometheus.Desc {
function createCounterMetricDescriptions (line 204) | func createCounterMetricDescriptions() map[string]*prometheus.Desc {
FILE: node_exporter.go
type handler (line 45) | type handler struct
method ServeHTTP (line 79) | func (h *handler) ServeHTTP(w http.ResponseWriter, r *http.Request) {
method innerHandler (line 127) | func (h *handler) innerHandler(filters ...string) (http.Handler, error) {
function newHandler (line 57) | func newHandler(includeExporterMetrics bool, maxRequests int, logger *sl...
function main (line 182) | func main() {
FILE: node_exporter_test.go
constant address (line 34) | address = "localhost:19100"
function TestFileDescriptorLeak (line 37) | func TestFileDescriptorLeak(t *testing.T) {
function TestHandlingOfDuplicatedMetrics (line 82) | func TestHandlingOfDuplicatedMetrics(t *testing.T) {
function queryExporter (line 111) | func queryExporter(address string) error {
function runCommandAndTests (line 129) | func runCommandAndTests(cmd *exec.Cmd, address string, fn func(pid int) ...
FILE: tools/main.go
function main (line 25) | func main() {
Condensed preview — 394 files, each showing path, character count, and a content snippet. Download the .json file or copy for the full structured content (2,844K chars).
[
{
"path": ".circleci/config.yml",
"chars": 3981,
"preview": "---\nversion: 2.1\norbs:\n prometheus: prometheus/prometheus@0.17.1\nexecutors:\n # Whenever the Go version is updated here"
},
{
"path": ".dockerignore",
"chars": 122,
"preview": ".build/\n.tarballs/\n\n!.build/linux-amd64\n!.build/linux-armv7\n!.build/linux-arm64\n!.build/linux-ppc64le\n!.build/linux-s390"
},
{
"path": ".github/ISSUE_TEMPLATE.md",
"chars": 1175,
"preview": "<!--\n\tPlease note: GitHub issues should only be used for feature requests and\n\tbug reports. For general discussions, ple"
},
{
"path": ".github/dependabot.yml",
"chars": 209,
"preview": "version: 2\nupdates:\n - package-ecosystem: \"gomod\"\n directory: \"/\"\n schedule:\n interval: \"monthly\"\n - packag"
},
{
"path": ".github/workflows/bsd.yml",
"chars": 10702,
"preview": "name: bsd\n\non:\n push:\n branches:\n - master\n pull_request:\n branches:\n - master\n\npermissions:\n content"
},
{
"path": ".github/workflows/container_description.yml",
"chars": 2461,
"preview": "---\nname: Push README to Docker Hub\non:\n push:\n paths:\n - \"README.md\"\n - \"README-containers.md\"\n - \"."
},
{
"path": ".github/workflows/golangci-lint.yml",
"chars": 1562,
"preview": "---\n# This action is synced from https://github.com/prometheus/prometheus\nname: golangci-lint\non:\n push:\n branches: "
},
{
"path": ".gitignore",
"chars": 453,
"preview": "# Compiled Object files, Static and Dynamic libs (Shared Objects)\n*.o\n*.a\n*.so\n\n# Folders\n_obj\n_test\n\n# Architecture spe"
},
{
"path": ".golangci.yml",
"chars": 941,
"preview": "version: \"2\"\nlinters:\n enable:\n - depguard\n - misspell\n - revive\n settings:\n depguard:\n rules:\n "
},
{
"path": ".promu-cgo.yml",
"chars": 813,
"preview": "go:\n # Whenever the Go version is updated here, .circle/config.yml and\n # .promu.yml should also be updated.\n v"
},
{
"path": ".promu.yml",
"chars": 753,
"preview": "go:\n # Whenever the Go version is updated here, .circle/config.yml and\n # .promu-cgo.yml should also be updated.\n "
},
{
"path": ".yamllint",
"chars": 507,
"preview": "---\nextends: default\nignore: |\n **/node_modules\n web/api/v1/testdata/openapi_*_golden.yaml\n\nrules:\n braces:\n max-s"
},
{
"path": "CHANGELOG.md",
"chars": 39291,
"preview": "## master / unreleased\n\n* [CHANGE]\n* [FEATURE]\n* [ENHANCEMENT]\n* [BUGFIX]\n\n## 1.10.2 / 2025-10-25\n\n* [BUGFIX] meminfo: F"
},
{
"path": "CODE_OF_CONDUCT.md",
"chars": 152,
"preview": "# Prometheus Community Code of Conduct\n\nPrometheus follows the [CNCF Code of Conduct](https://github.com/cncf/foundation"
},
{
"path": "CONTRIBUTING.md",
"chars": 2358,
"preview": "# Contributing\n\nPrometheus uses GitHub to manage reviews of pull requests.\n\n* If you have a trivial fix or improvement, "
},
{
"path": "Dockerfile",
"chars": 334,
"preview": "ARG ARCH=\"amd64\"\nARG OS=\"linux\"\nFROM quay.io/prometheus/busybox-${OS}-${ARCH}:latest\nLABEL maintainer=\"The Prometheus Au"
},
{
"path": "LICENSE",
"chars": 11357,
"preview": " Apache License\n Version 2.0, January 2004\n "
},
{
"path": "MAINTAINERS.md",
"chars": 104,
"preview": "* Ben Kochie <superq@gmail.com> @SuperQ\n* Johannes 'fish' Ziemke <github@freigeist.org> @discordianfish\n"
},
{
"path": "Makefile",
"chars": 4613,
"preview": "# Copyright 2015 The Prometheus Authors\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not "
},
{
"path": "Makefile.common",
"chars": 19997,
"preview": "# Copyright The Prometheus Authors\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use t"
},
{
"path": "NOTICE",
"chars": 463,
"preview": "Configurable modular Prometheus exporter for various node metrics.\nCopyright 2013-2015 The Prometheus Authors\n\nThis prod"
},
{
"path": "README.md",
"chars": 20243,
"preview": "# Node exporter\n\n[][circleci]\n"
},
{
"path": "SECURITY.md",
"chars": 172,
"preview": "# Reporting a security issue\n\nThe Prometheus security policy, including how to report vulnerabilities, can be\nfound here"
},
{
"path": "VERSION",
"chars": 7,
"preview": "1.10.2\n"
},
{
"path": "checkmetrics.sh",
"chars": 444,
"preview": "#!/usr/bin/env bash\n\nif [[ ( -z \"$1\" ) || ( -z \"$2\" ) ]]; then\n echo \"usage: ./checkmetrics.sh /usr/bin/promtool e2e-"
},
{
"path": "collector/arp_linux.go",
"chars": 3590,
"preview": "// Copyright 2017 The Prometheus Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may n"
},
{
"path": "collector/bcache_linux.go",
"chars": 11717,
"preview": "// Copyright 2017 The Prometheus Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may n"
},
{
"path": "collector/bcachefs_linux.go",
"chars": 7420,
"preview": "// Copyright The Prometheus Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not us"
},
{
"path": "collector/bonding_linux.go",
"chars": 3257,
"preview": "// Copyright 2015 The Prometheus Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may n"
},
{
"path": "collector/bonding_linux_test.go",
"chars": 1116,
"preview": "// Copyright 2015 The Prometheus Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may n"
},
{
"path": "collector/boot_time_bsd.go",
"chars": 1727,
"preview": "// Copyright 2018 The Prometheus Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may n"
},
{
"path": "collector/boot_time_solaris.go",
"chars": 1746,
"preview": "// Copyright 2018 The Prometheus Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may n"
},
{
"path": "collector/btrfs_linux.go",
"chars": 12615,
"preview": "// Copyright 2019 The Prometheus Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may n"
},
{
"path": "collector/btrfs_linux_test.go",
"chars": 6911,
"preview": "// Copyright 2019 The Prometheus Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may n"
},
{
"path": "collector/buddyinfo.go",
"chars": 2086,
"preview": "// Copyright 2017 The Prometheus Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may n"
},
{
"path": "collector/cgroups_linux.go",
"chars": 2245,
"preview": "// Copyright 2022 The Prometheus Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may n"
},
{
"path": "collector/collector.go",
"chars": 7276,
"preview": "// Copyright 2015 The Prometheus Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may n"
},
{
"path": "collector/conntrack_linux.go",
"chars": 6561,
"preview": "// Copyright 2015 The Prometheus Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may n"
},
{
"path": "collector/cpu_aix.go",
"chars": 4300,
"preview": "// Copyright 2024 The Prometheus Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may n"
},
{
"path": "collector/cpu_common.go",
"chars": 939,
"preview": "// Copyright 2016 The Prometheus Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may n"
},
{
"path": "collector/cpu_darwin.go",
"chars": 3207,
"preview": "// Copyright 2016 The Prometheus Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may n"
},
{
"path": "collector/cpu_dragonfly.go",
"chars": 3474,
"preview": "// Copyright 2016 The Prometheus Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may n"
},
{
"path": "collector/cpu_dragonfly_test.go",
"chars": 1020,
"preview": "// Copyright 2016 The Prometheus Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may n"
},
{
"path": "collector/cpu_freebsd.go",
"chars": 4567,
"preview": "// Copyright 2015 The Prometheus Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may n"
},
{
"path": "collector/cpu_linux.go",
"chars": 16684,
"preview": "// Copyright 2015 The Prometheus Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may n"
},
{
"path": "collector/cpu_linux_test.go",
"chars": 4332,
"preview": "// Copyright 2021 The Prometheus Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may n"
},
{
"path": "collector/cpu_netbsd.go",
"chars": 6937,
"preview": "// Copyright 2023 The Prometheus Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may n"
},
{
"path": "collector/cpu_netbsd_test.go",
"chars": 1144,
"preview": "// Copyright 2023 The Prometheus Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may n"
},
{
"path": "collector/cpu_openbsd.go",
"chars": 2584,
"preview": "// Copyright 2018 The Prometheus Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may n"
},
{
"path": "collector/cpu_solaris.go",
"chars": 1782,
"preview": "// Copyright 2018 The Prometheus Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may n"
},
{
"path": "collector/cpu_vulnerabilities_linux.go",
"chars": 2065,
"preview": "// Copyright 2023 The Prometheus Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may n"
},
{
"path": "collector/cpufreq_common.go",
"chars": 2136,
"preview": "// Copyright 2023 The Prometheus Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may n"
},
{
"path": "collector/cpufreq_linux.go",
"chars": 3347,
"preview": "// Copyright 2019 The Prometheus Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may n"
},
{
"path": "collector/cpufreq_solaris.go",
"chars": 1943,
"preview": "// Copyright 2019 The Prometheus Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may n"
},
{
"path": "collector/device_filter.go",
"chars": 1230,
"preview": "// Copyright 2018 The Prometheus Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may n"
},
{
"path": "collector/device_filter_test.go",
"chars": 1283,
"preview": "// Copyright 2018 The Prometheus Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may n"
},
{
"path": "collector/devstat_dragonfly.go",
"chars": 3868,
"preview": "// Copyright 2016 The Prometheus Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may n"
},
{
"path": "collector/devstat_freebsd.c",
"chars": 2610,
"preview": "// Copyright 2017 The Prometheus Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may n"
},
{
"path": "collector/devstat_freebsd.go",
"chars": 3904,
"preview": "// Copyright 2015 The Prometheus Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may n"
},
{
"path": "collector/devstat_freebsd.h",
"chars": 1235,
"preview": "// Copyright 2017 The Prometheus Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may n"
},
{
"path": "collector/diskstats_aix.go",
"chars": 4115,
"preview": "// Copyright 2024 The Prometheus Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may n"
},
{
"path": "collector/diskstats_common.go",
"chars": 3979,
"preview": "// Copyright 2019 The Prometheus Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may n"
},
{
"path": "collector/diskstats_darwin.go",
"chars": 5573,
"preview": "// Copyright 2017 The Prometheus Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may n"
},
{
"path": "collector/diskstats_linux.go",
"chars": 12368,
"preview": "// Copyright 2015 The Prometheus Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may n"
},
{
"path": "collector/diskstats_linux_test.go",
"chars": 19552,
"preview": "// Copyright 2015 The Prometheus Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may n"
},
{
"path": "collector/diskstats_openbsd.go",
"chars": 2753,
"preview": "// Copyright 2019 The Prometheus Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may n"
},
{
"path": "collector/diskstats_openbsd_amd64.go",
"chars": 2983,
"preview": "// Copyright 2020 The Prometheus Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may n"
},
{
"path": "collector/dmi.go",
"chars": 3386,
"preview": "// Copyright 2021 The Prometheus Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may n"
},
{
"path": "collector/drbd_linux.go",
"chars": 6519,
"preview": "// Copyright 2016 The Prometheus Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may n"
},
{
"path": "collector/drm_linux.go",
"chars": 4639,
"preview": "// Copyright 2021 The Prometheus Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may n"
},
{
"path": "collector/edac_linux.go",
"chars": 5009,
"preview": "// Copyright 2015 The Prometheus Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may n"
},
{
"path": "collector/entropy_linux.go",
"chars": 2223,
"preview": "// Copyright 2015 The Prometheus Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may n"
},
{
"path": "collector/ethtool_linux.go",
"chars": 22538,
"preview": "// Copyright 2021 The Prometheus Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may n"
},
{
"path": "collector/ethtool_linux_test.go",
"chars": 14219,
"preview": "// Copyright 2021 The Prometheus Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may n"
},
{
"path": "collector/exec_bsd.go",
"chars": 2962,
"preview": "// Copyright 2017 The Prometheus Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may n"
},
{
"path": "collector/fibrechannel_linux.go",
"chars": 5883,
"preview": "// Copyright 2021 The Prometheus Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may n"
},
{
"path": "collector/filefd_linux.go",
"chars": 2451,
"preview": "// Copyright 2015 The Prometheus Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may n"
},
{
"path": "collector/filefd_linux_test.go",
"chars": 1049,
"preview": "// Copyright 2015 The Prometheus Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may n"
},
{
"path": "collector/filesystem_aix.go",
"chars": 1851,
"preview": "// Copyright 2024 The Prometheus Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may n"
},
{
"path": "collector/filesystem_bsd.go",
"chars": 2253,
"preview": "// Copyright 2015 The Prometheus Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may n"
},
{
"path": "collector/filesystem_common.go",
"chars": 10336,
"preview": "// Copyright 2015 The Prometheus Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may n"
},
{
"path": "collector/filesystem_freebsd.go",
"chars": 2183,
"preview": "// Copyright 2015 The Prometheus Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may n"
},
{
"path": "collector/filesystem_linux.go",
"chars": 7564,
"preview": "// Copyright 2015 The Prometheus Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may n"
},
{
"path": "collector/filesystem_linux_test.go",
"chars": 5568,
"preview": "// Copyright 2015 The Prometheus Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may n"
},
{
"path": "collector/filesystem_macos.go",
"chars": 3138,
"preview": "// Copyright 2015 The Prometheus Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may n"
},
{
"path": "collector/filesystem_netbsd.go",
"chars": 3372,
"preview": "// Copyright 2024 The Prometheus Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may n"
},
{
"path": "collector/filesystem_openbsd.go",
"chars": 2077,
"preview": "// Copyright 2020 The Prometheus Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may n"
},
{
"path": "collector/fixtures/e2e-64k-page-output.txt",
"chars": 367648,
"preview": "# HELP go_gc_duration_seconds A summary of the wall-time pause (stop-the-world) duration in garbage collection cycles.\n#"
},
{
"path": "collector/fixtures/e2e-output-darwin.txt",
"chars": 19535,
"preview": "# HELP go_gc_duration_seconds A summary of the wall-time pause (stop-the-world) duration in garbage collection cycles.\n#"
},
{
"path": "collector/fixtures/e2e-output-dragonfly.txt",
"chars": 17190,
"preview": "# HELP go_gc_duration_seconds A summary of the wall-time pause (stop-the-world) duration in garbage collection cycles.\n#"
},
{
"path": "collector/fixtures/e2e-output-freebsd.txt",
"chars": 19389,
"preview": "# HELP go_gc_duration_seconds A summary of the wall-time pause (stop-the-world) duration in garbage collection cycles.\n#"
},
{
"path": "collector/fixtures/e2e-output-netbsd.txt",
"chars": 14765,
"preview": "# HELP go_gc_duration_seconds A summary of the wall-time pause (stop-the-world) duration in garbage collection cycles.\n#"
},
{
"path": "collector/fixtures/e2e-output-openbsd.txt",
"chars": 18608,
"preview": "# HELP go_gc_duration_seconds A summary of the wall-time pause (stop-the-world) duration in garbage collection cycles.\n#"
},
{
"path": "collector/fixtures/e2e-output-solaris.txt",
"chars": 16122,
"preview": "# HELP go_gc_duration_seconds A summary of the wall-time pause (stop-the-world) duration in garbage collection cycles.\n#"
},
{
"path": "collector/fixtures/e2e-output.txt",
"chars": 370515,
"preview": "# HELP go_gc_duration_seconds A summary of the wall-time pause (stop-the-world) duration in garbage collection cycles.\n#"
},
{
"path": "collector/fixtures/ethtool/bond0/statistics",
"chars": 8,
"preview": "ERROR: 1"
},
{
"path": "collector/fixtures/ethtool/eth0/driver",
"chars": 256,
"preview": "# ethtool -i eth0\ndriver: e1000e\nversion: 5.11.0-22-generic\nfirmware-version: 0.5-4\nexpansion-rom-version: \nbus-info: 00"
},
{
"path": "collector/fixtures/ethtool/eth0/settings",
"chars": 859,
"preview": "# ethtool eth0\nSettings for eth0:\n\tSupported ports: [ TP\t MII ]\n\tSupported link modes: 10baseT/Half 10baseT/Full\n\t "
},
{
"path": "collector/fixtures/ethtool/eth0/statistics",
"chars": 408,
"preview": "# ethtool -S eth0\nNIC statistics:\n tx_packets: 961500\n rx_packets: 1260062\n tx_errors: 0\n rx_errors: 0\n "
},
{
"path": "collector/fixtures/ip_vs_result.txt",
"chars": 6034,
"preview": "# HELP node_ipvs_backend_connections_active The current active connections by local and remote address.\n# TYPE node_ipvs"
},
{
"path": "collector/fixtures/ip_vs_result_lbs_local_address_local_port.txt",
"chars": 2230,
"preview": "# HELP node_ipvs_backend_connections_active The current active connections by local and remote address.\n# TYPE node_ipvs"
},
{
"path": "collector/fixtures/ip_vs_result_lbs_local_port.txt",
"chars": 1584,
"preview": "# HELP node_ipvs_backend_connections_active The current active connections by local and remote address.\n# TYPE node_ipvs"
},
{
"path": "collector/fixtures/ip_vs_result_lbs_none.txt",
"chars": 1369,
"preview": "# HELP node_ipvs_backend_connections_active The current active connections by local and remote address.\n# TYPE node_ipvs"
},
{
"path": "collector/fixtures/pci.ids",
"chars": 732,
"preview": "# Test PCI IDs file for node_exporter testing\n# This file contains sample entries for testing PCI name resolution\n\n# Cla"
},
{
"path": "collector/fixtures/pcidevice-names-output.txt",
"chars": 7983,
"preview": "# Test output for PCI device collector with name resolution enabled\n# This file demonstrates the --collector.pcidevice.n"
},
{
"path": "collector/fixtures/proc/1/mountinfo",
"chars": 3545,
"preview": "24 29 0:22 / /sys rw,nosuid,nodev,noexec,relatime shared:7 - sysfs sysfs rw\n25 29 0:23 / /proc rw,nosuid,nodev,noexec,re"
},
{
"path": "collector/fixtures/proc/1/stat",
"chars": 190,
"preview": "1 (systemd) S 0 1 1 0 -1 4194560 9061 9416027 94 2620 36 98 54406 13885 20 0 1 0 29 109604864 2507 18446744073709551615 "
},
{
"path": "collector/fixtures/proc/10/mountinfo",
"chars": 1108,
"preview": "1 1 0:5 / /root rw,nosuid shared:8 - rootfs rootfs rw\n16 21 0:16 / /sys rw,nosuid,nodev,noexec,relatime shared:7 - sysf"
},
{
"path": "collector/fixtures/proc/10/mountstats",
"chars": 2908,
"preview": "device rootfs mounted on / with fstype rootfs\ndevice sysfs mounted on /sys with fstype sysfs\ndevice proc mounted on /pro"
},
{
"path": "collector/fixtures/proc/10/stat",
"chars": 154,
"preview": "17 (khungtaskd) S 2 0 0 0 -1 2129984 0 0 0 0 14 0 0 0 20 0 1 0 24 0 0 18446744073709551615 0 0 0 0 0 0 0 2147483647 0 0 "
},
{
"path": "collector/fixtures/proc/11/.missing_stat",
"chars": 0,
"preview": ""
},
{
"path": "collector/fixtures/proc/11/stat",
"chars": 157,
"preview": "11 (rcu_preempt) I 2 0 0 0 -1 2129984 0 0 0 0 0 346 0 0 -2 0 1 0 32 0 0 18446744073709551615 0 0 0 0 0 0 0 2147483647 0 "
},
{
"path": "collector/fixtures/proc/buddyinfo",
"chars": 300,
"preview": "Node 0, zone DMA 1 0 1 0 2 1 1 0 1 1 3 \nNode 0, zone DMA3"
},
{
"path": "collector/fixtures/proc/cgroups",
"chars": 219,
"preview": "#subsys_name\thierarchy\tnum_cgroups\tenabled\ncpuset\t5\t47\t1\ncpu\t3\t172\t1\ncpuacct\t3\t172\t1\nblkio\t6\t170\t1\nmemory\t7\t234\t1\ndevice"
},
{
"path": "collector/fixtures/proc/cpuinfo",
"chars": 10496,
"preview": "processor\t: 0\nvendor_id\t: GenuineIntel\ncpu family\t: 6\nmodel\t\t: 142\nmodel name\t: Intel(R) Core(TM) i7-8650U CPU @ 1.90GHz"
},
{
"path": "collector/fixtures/proc/diskstats",
"chars": 2950,
"preview": " 1 0 ram0 0 0 0 0 0 0 0 0 0 0 0\n 1 1 ram1 0 0 0 0 0 0 0 0 0 0 0\n 1 2 ram2 0 0 0 0 0 0 0 0 0 0 0\n"
},
{
"path": "collector/fixtures/proc/drbd",
"chars": 264,
"preview": "version: 8.4.3 (api:1/proto:86-101)\nsrcversion: 1A9F77B1CA5FF92235C2213 \n\n 1: cs:Connected ro:Primary/Primary ds:UpToDat"
},
{
"path": "collector/fixtures/proc/interrupts",
"chars": 2237,
"preview": " CPU0 CPU1 CPU2 CPU3 \n 0: 18 0 0 0 IR-IO-APIC-edg"
},
{
"path": "collector/fixtures/proc/interrupts_aarch64",
"chars": 7562,
"preview": " CPU0 CPU1 CPU2 CPU3 CPU4 CPU5 CPU6 CPU7\n 10: 3287008667 3310445093 3"
},
{
"path": "collector/fixtures/proc/loadavg",
"chars": 27,
"preview": "0.21 0.37 0.39 1/719 19737\n"
},
{
"path": "collector/fixtures/proc/mdstat",
"chars": 2136,
"preview": "Personalities : [linear] [multipath] [raid0] [raid1] [raid6] [raid5] [raid4] [raid10]\n\nmd3 : active raid6 sda1[8] sdh1[7"
},
{
"path": "collector/fixtures/proc/meminfo",
"chars": 1170,
"preview": "MemTotal: 3742148 kB\nMemFree: 225472 kB\nBuffers: 22040 kB\nCached: 930888 kB\nSwapCach"
},
{
"path": "collector/fixtures/proc/net/arp",
"chars": 604,
"preview": "IP address HW type Flags HW address Mask Device\n192.168.1.1 0x1 0x2 cc"
},
{
"path": "collector/fixtures/proc/net/ip_vs",
"chars": 849,
"preview": "IP Virtual Server version 1.2.1 (size=4096)\nProt LocalAddress:Port Scheduler Flags\n -> RemoteAddress:Port Forward Weigh"
},
{
"path": "collector/fixtures/proc/net/ip_vs_stats",
"chars": 306,
"preview": " Total Incoming Outgoing Incoming Outgoing\n Conns Packets Packets Bytes Byte"
},
{
"path": "collector/fixtures/proc/net/netstat",
"chars": 1721,
"preview": "TcpExt: SyncookiesSent SyncookiesRecv SyncookiesFailed EmbryonicRsts PruneCalled RcvPruned OfoPruned OutOfWindowIcmps Lo"
},
{
"path": "collector/fixtures/proc/net/rpc/nfs",
"chars": 384,
"preview": "net 70 70 69 45\nrpc 1218785755 374636 1218815394\nproc2 18 16 57 74 52 71 73 45 86 0 52 83 61 17 53 50 23 70 82\nproc3 22 "
},
{
"path": "collector/fixtures/proc/net/rpc/nfsd",
"chars": 501,
"preview": "rc 0 6 18622\nfh 0 0 0 0 0\nio 157286400 72864\nth 8 0 0.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000\nra 32 0 "
},
{
"path": "collector/fixtures/proc/net/snmp",
"chars": 1202,
"preview": "Ip: Forwarding DefaultTTL InReceives InHdrErrors InAddrErrors ForwDatagrams InUnknownProtos InDiscards InDelivers OutReq"
},
{
"path": "collector/fixtures/proc/net/snmp6",
"chars": 2987,
"preview": "Ip6InReceives \t7\nIp6InHdrErrors \t0\nIp6InTooBigErrors \t0\nIp6InNoRoutes "
},
{
"path": "collector/fixtures/proc/net/sockstat",
"chars": 132,
"preview": "sockets: used 229\nTCP: inuse 4 orphan 0 tw 4 alloc 17 mem 1\nUDP: inuse 0 mem 0\nUDPLITE: inuse 0\nRAW: inuse 0\nFRAG: inuse"
},
{
"path": "collector/fixtures/proc/net/sockstat6",
"chars": 85,
"preview": "TCP6: inuse 17\nUDP6: inuse 9\nUDPLITE6: inuse 0\nRAW6: inuse 1\nFRAG6: inuse 0 memory 0\n"
},
{
"path": "collector/fixtures/proc/net/softnet_stat",
"chars": 395,
"preview": "00049279 00000000 00000001 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000\n000dfb82 00000029 000"
},
{
"path": "collector/fixtures/proc/net/stat/arp_cache",
"chars": 406,
"preview": "entries allocs destroys hash_grows lookups hits res_failed rcv_probes_mcast rcv_probes_ucast periodic_gc_runs force"
},
{
"path": "collector/fixtures/proc/net/stat/ndisc_cache",
"chars": 406,
"preview": "entries allocs destroys hash_grows lookups hits res_failed rcv_probes_mcast rcv_probes_ucast periodic_gc_runs force"
},
{
"path": "collector/fixtures/proc/net/stat/nf_conntrack",
"chars": 785,
"preview": "entries searched found new invalid ignore delete delete_list insert insert_failed drop early_drop icmp_error expect_ne"
},
{
"path": "collector/fixtures/proc/net/udp",
"chars": 300,
"preview": " sl local_address rem_address st tx_queue rx_queue tr tm->when retrnsmt uid timeout inode "
},
{
"path": "collector/fixtures/proc/net/xfrm_stat",
"chars": 1018,
"preview": "XfrmInError 1\nXfrmInBufferError 2\nXfrmInHdrError 4\nXfrmInNoStates "
},
{
"path": "collector/fixtures/proc/pressure/cpu",
"chars": 101,
"preview": "some avg10=0.00 avg60=0.00 avg300=0.00 total=14036781\nfull avg10=0.00 avg60=0.00 avg300=0.00 total=0\n"
},
{
"path": "collector/fixtures/proc/pressure/io",
"chars": 110,
"preview": "some avg10=0.18 avg60=0.34 avg300=0.10 total=159886802\nfull avg10=0.18 avg60=0.34 avg300=0.10 total=159229614\n"
},
{
"path": "collector/fixtures/proc/pressure/irq",
"chars": 49,
"preview": "full avg10=0.00 avg60=0.00 avg300=0.00 total=8494"
},
{
"path": "collector/fixtures/proc/pressure/memory",
"chars": 94,
"preview": "some avg10=0.00 avg60=0.00 avg300=0.00 total=0\nfull avg10=0.00 avg60=0.00 avg300=0.00 total=0\n"
},
{
"path": "collector/fixtures/proc/schedstat",
"chars": 803,
"preview": "version 15\ntimestamp 15819019232\ncpu0 498494191 0 3533438552 2553969831 3853684107 2465731542 2045936778163039 343796328"
},
{
"path": "collector/fixtures/proc/slabinfo",
"chars": 634,
"preview": "slabinfo - version: 2.1\n# name <active_objs> <num_objs> <objsize> <objperslab> <pagesperslab> : tunables <lim"
},
{
"path": "collector/fixtures/proc/softirqs",
"chars": 403,
"preview": " CPU0 CPU1 \n HI: 7 1\n TIMER: 424191 108342\n "
},
{
"path": "collector/fixtures/proc/spl/kstat/zfs/abdstats",
"chars": 922,
"preview": "7 1 0x01 21 5712 73163810083184 309946154984654\nname type data\nstruct_size "
},
{
"path": "collector/fixtures/proc/spl/kstat/zfs/arcstats",
"chars": 4015,
"preview": "6 1 0x01 91 4368 5266997922 97951858082072\nname type data\nanon_evictable_data 4 "
},
{
"path": "collector/fixtures/proc/spl/kstat/zfs/dbufstats",
"chars": 2630,
"preview": "15 1 0x01 63 17136 73163812943503 309964267073187\nname type data\ndbuf_cache_count "
},
{
"path": "collector/fixtures/proc/spl/kstat/zfs/dmu_tx",
"chars": 520,
"preview": "5 1 0x01 11 528 8010436841 354962070418194\nname type data\ndmu_tx_assigned 4 "
},
{
"path": "collector/fixtures/proc/spl/kstat/zfs/dnodestats",
"chars": 1188,
"preview": "10 1 0x01 28 7616 73163810135894 309969103316276\nname type data\ndnode_hold_dbuf_hold "
},
{
"path": "collector/fixtures/proc/spl/kstat/zfs/fm",
"chars": 241,
"preview": "0 1 0x01 4 192 8007255140 354329591145385\nname type data\nerpt-dropped 4 "
},
{
"path": "collector/fixtures/proc/spl/kstat/zfs/pool1/io",
"chars": 276,
"preview": "12 3 0x00 1 80 79205351707403 395818011156865\nnread nwritten reads writes wtime wlentime wupdate rtime rl"
},
{
"path": "collector/fixtures/proc/spl/kstat/zfs/pool1/objset-1",
"chars": 363,
"preview": "23 1 0x01 7 2160 221578688875 6665999035587\nname type data\ndataset_name 7 "
},
{
"path": "collector/fixtures/proc/spl/kstat/zfs/pool1/objset-2",
"chars": 377,
"preview": "24 1 0x01 7 2160 221611904716 7145015038451\nname type data\ndataset_name 7 "
},
{
"path": "collector/fixtures/proc/spl/kstat/zfs/pool1/state",
"chars": 7,
"preview": "ONLINE\n"
},
{
"path": "collector/fixtures/proc/spl/kstat/zfs/pool2/state",
"chars": 10,
"preview": "SUSPENDED\n"
},
{
"path": "collector/fixtures/proc/spl/kstat/zfs/pool3/io",
"chars": 276,
"preview": "12 3 0x00 1 80 79205351707403 395818011156865\nnread nwritten reads writes wtime wlentime wupdate rtime rl"
},
{
"path": "collector/fixtures/proc/spl/kstat/zfs/pool3/objset-1",
"chars": 363,
"preview": "23 1 0x01 7 2160 221578688875 6665999035587\nname type data\ndataset_name 7 "
},
{
"path": "collector/fixtures/proc/spl/kstat/zfs/pool3/objset-2",
"chars": 388,
"preview": "24 1 0x01 7 2160 221611904716 7145015038451\nname type data\ndataset_name 7 "
},
{
"path": "collector/fixtures/proc/spl/kstat/zfs/pool3/state",
"chars": 7,
"preview": "ONLINE\n"
},
{
"path": "collector/fixtures/proc/spl/kstat/zfs/poolz1/io",
"chars": 292,
"preview": "16 3 0x00 1 80 79568650431241 395832279341621\nnread nwritten reads writes wtime wlentime wupdate rtime rl"
},
{
"path": "collector/fixtures/proc/spl/kstat/zfs/poolz1/objset-1",
"chars": 363,
"preview": "30 1 0x01 7 2160 217993779684 2621674546179\nname type data\ndataset_name 7 "
},
{
"path": "collector/fixtures/proc/spl/kstat/zfs/poolz1/objset-2",
"chars": 380,
"preview": "31 1 0x01 7 2160 218133979890 3024169078920\nname type data\ndataset_name 7 "
},
{
"path": "collector/fixtures/proc/spl/kstat/zfs/poolz1/state",
"chars": 9,
"preview": "DEGRADED\n"
},
{
"path": "collector/fixtures/proc/spl/kstat/zfs/vdev_cache_stats",
"chars": 202,
"preview": "8 1 0x01 3 144 8012540758 352116106118781\nname type data\ndelegations 4 "
},
{
"path": "collector/fixtures/proc/spl/kstat/zfs/vdev_mirror_stats",
"chars": 364,
"preview": "18 1 0x01 7 1904 73163813004224 309980651991187\nname type data\nrotating_linear "
},
{
"path": "collector/fixtures/proc/spl/kstat/zfs/xuio_stats",
"chars": 319,
"preview": "2 1 0x01 6 288 8009100742 353415816865654\nname type data\nonloan_read_buf 4 "
},
{
"path": "collector/fixtures/proc/spl/kstat/zfs/zfetchstats",
"chars": 529,
"preview": "4 1 0x01 11 528 8010434610 345692669858836\nname type data\nhits 4 "
},
{
"path": "collector/fixtures/proc/spl/kstat/zfs/zil",
"chars": 612,
"preview": "7 1 0x01 13 624 8012538347 351689526932992\nname type data\nzil_commit_count 4 "
},
{
"path": "collector/fixtures/proc/stat",
"chars": 2096,
"preview": "cpu 301854 612 111922 8979004 3552 2 3944 0 44 36\ncpu0 44490 19 21045 1087069 220 1 3410 0 2 1\ncpu1 47869 23 16474 1110"
},
{
"path": "collector/fixtures/proc/swaps",
"chars": 106,
"preview": "Filename\t\t\t\tType\t\tSize\t\tUsed\t\tPriority\n/dev/zram0 partition\t8388604\t\t76\t\t100\n"
},
{
"path": "collector/fixtures/proc/sys/fs/file-nr",
"chars": 15,
"preview": "1024\t0\t1631329\n"
},
{
"path": "collector/fixtures/proc/sys/kernel/pid_max",
"chars": 4,
"preview": "123\n"
},
{
"path": "collector/fixtures/proc/sys/kernel/random/entropy_avail",
"chars": 5,
"preview": "1337\n"
},
{
"path": "collector/fixtures/proc/sys/kernel/random/poolsize",
"chars": 5,
"preview": "4096\n"
},
{
"path": "collector/fixtures/proc/sys/kernel/seccomp/actions_avail",
"chars": 63,
"preview": "kill_process kill_thread trap errno user_notif trace log allow\n"
},
{
"path": "collector/fixtures/proc/sys/kernel/threads-max",
"chars": 4,
"preview": "7801"
},
{
"path": "collector/fixtures/proc/sys/net/netfilter/nf_conntrack_count",
"chars": 4,
"preview": "123\n"
},
{
"path": "collector/fixtures/proc/sys/net/netfilter/nf_conntrack_max",
"chars": 6,
"preview": "65536\n"
},
{
"path": "collector/fixtures/proc/sys/pid_max",
"chars": 4,
"preview": "123\n"
},
{
"path": "collector/fixtures/proc/sys/threads-max",
"chars": 4,
"preview": "7801"
},
{
"path": "collector/fixtures/proc/vmstat",
"chars": 2638,
"preview": "nr_free_pages 977769\nnr_alloc_batch 4158\nnr_inactive_anon 125031\nnr_active_anon 622512\nnr_inactive_file 92317\nnr_active_"
},
{
"path": "collector/fixtures/proc/zoneinfo",
"chars": 6234,
"preview": "Node 0, zone DMA\n per-node stats\n nr_inactive_anon 95612\n nr_active_anon 1175853\n nr_inactive_file "
},
{
"path": "collector/fixtures/qdisc/results.json",
"chars": 292,
"preview": "[\n {\n \"IfaceName\": \"wlan0\",\n \"Bytes\": 42,\n \"Packets\": 42,\n \"Requeues\": 1,\n \"Kind\":"
},
{
"path": "collector/fixtures/sys.ttar",
"chars": 439334,
"preview": "# Archive created by ttar -C collector/fixtures -c -f collector/fixtures/sys.ttar sys\nDirectory: sys\nMode: 755\n# ttar - "
},
{
"path": "collector/fixtures/textfile/client_side_timestamp/metrics.prom",
"chars": 61,
"preview": "metric_with_custom_timestamp 1 1441205977284\nnormal_metric 2\n"
},
{
"path": "collector/fixtures/textfile/client_side_timestamp.out",
"chars": 166,
"preview": "# HELP node_textfile_scrape_error 1 if there was an error opening or reading a file, 0 otherwise\n# TYPE node_textfile_sc"
},
{
"path": "collector/fixtures/textfile/different_metric_types/metrics.prom",
"chars": 1668,
"preview": "# HELP events_total this is a test metric\n# TYPE events_total counter\nevents_total{foo=\"bar\"} 10\nevents_total{foo=\"baz\"}"
},
{
"path": "collector/fixtures/textfile/different_metric_types.out",
"chars": 2047,
"preview": "# HELP event_duration_seconds_total Query timings\n# TYPE event_duration_seconds_total summary\nevent_duration_seconds_tot"
},
{
"path": "collector/fixtures/textfile/glob_extra_dimension.out",
"chars": 3923,
"preview": "# HELP node_textfile_mtime_seconds Unixtime mtime of textfiles successfully read.\n# TYPE node_textfile_mtime_seconds gau"
},
{
"path": "collector/fixtures/textfile/histogram/metrics.prom",
"chars": 999,
"preview": "# HELP prometheus_tsdb_compaction_chunk_range Final time range of chunks on their first compaction\n# TYPE prometheus_tsd"
},
{
"path": "collector/fixtures/textfile/histogram.out",
"chars": 1367,
"preview": "# HELP node_textfile_mtime_seconds Unixtime mtime of textfiles successfully read.\n# TYPE node_textfile_mtime_seconds gau"
},
{
"path": "collector/fixtures/textfile/histogram_extra_dimension/metrics.prom",
"chars": 2107,
"preview": "# HELP prometheus_tsdb_compaction_chunk_range Final time range of chunks on their first compaction\n# TYPE prometheus_tsd"
},
{
"path": "collector/fixtures/textfile/histogram_extra_dimension.out",
"chars": 2491,
"preview": "# HELP node_textfile_mtime_seconds Unixtime mtime of textfiles successfully read.\n# TYPE node_textfile_mtime_seconds gau"
},
{
"path": "collector/fixtures/textfile/inconsistent_metrics/metrics.prom",
"chars": 1334,
"preview": "# HELP http_requests_total Total number of HTTP requests made.\n# TYPE http_requests_total counter\nhttp_requests_total{co"
},
{
"path": "collector/fixtures/textfile/inconsistent_metrics.out",
"chars": 1975,
"preview": "# HELP go_goroutines Number of goroutines that currently exist.\n# TYPE go_goroutines gauge\ngo_goroutines{foo=\"\"} 20\ngo_g"
},
{
"path": "collector/fixtures/textfile/metrics_merge_different_help/a.prom",
"chars": 142,
"preview": "# HELP events_total A nice help message.\n# TYPE events_total counter\nevents_total{foo=\"bar\",file=\"a\"} 10\nevents_total{fo"
},
{
"path": "collector/fixtures/textfile/metrics_merge_different_help/b.prom",
"chars": 147,
"preview": "# HELP events_total A different help message.\n# TYPE events_total counter\nevents_total{foo=\"bar\",file=\"b\"} 30\nevents_tot"
},
{
"path": "collector/fixtures/textfile/metrics_merge_different_help.out",
"chars": 614,
"preview": "# HELP events_total A nice help message.\n# TYPE events_total counter\nevents_total{file=\"a\",foo=\"bar\"} 10\nevents_total{fi"
},
{
"path": "collector/fixtures/textfile/metrics_merge_empty_help/a.prom",
"chars": 122,
"preview": "# HELP events_total \n# TYPE events_total counter\nevents_total{foo=\"bar\",file=\"a\"} 10\nevents_total{foo=\"baz\",file=\"a\"} 20"
}
]
// ... and 194 more files (download for full content)
About this extraction
This page contains the full source code of the prometheus/node_exporter GitHub repository, extracted and formatted as plain text for AI agents and large language models (LLMs). The extraction includes 394 files (2.5 MB), approximately 685.7k tokens, and a symbol index with 1092 extracted functions, classes, methods, constants, and types. Use this with OpenClaw, Claude, ChatGPT, Cursor, Windsurf, or any other AI tool that accepts text input. You can copy the full output to your clipboard or download it as a .txt file.
Extracted by GitExtract — free GitHub repo to text converter for AI. Built by Nikandr Surkov.