Commit graph

861 commits

Author SHA1 Message Date
rushilenekar20 8fcc6320a2
Add diskstats include and exclude device flags
Use standard include/exclude pattern for device include/exclude in the
diskstats collector.

Signed-off-by: Ben Kochie <superq@gmail.com>
Co-authored-by: rushilenekar20 <rushilenekar20@gmail.com>
2022-06-28 07:48:21 +02:00
Jonathan Davies 88f1811eb1
Add selinux collector (#2205)
Add selinux collector

Signed-off-by: Jonathan Davies <jpds@protonmail.com>
2022-06-28 05:54:05 +02:00
Ben Kochie d2b8ee8f20
Add rapl zone label option (#2401)
Add an optional flag to set the RAPL zone as a label, instead of as part
of the metric name.

Fixes: https://github.com/prometheus/node_exporter/issues/2299

Signed-off-by: Ben Kochie <superq@gmail.com>
2022-06-27 23:09:32 +02:00
dependabot[bot] b99f933713
Bump github.com/prometheus/client_golang from 1.12.1 to 1.12.2 (#2411)
* Bump github.com/prometheus/client_golang from 1.12.1 to 1.12.2

Bumps [github.com/prometheus/client_golang](https://github.com/prometheus/client_golang) from 1.12.1 to 1.12.2.
- [Release notes](https://github.com/prometheus/client_golang/releases)
- [Changelog](https://github.com/prometheus/client_golang/blob/main/CHANGELOG.md)
- [Commits](https://github.com/prometheus/client_golang/compare/v1.12.1...v1.12.2)

---
updated-dependencies:
- dependency-name: github.com/prometheus/client_golang
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>

* Update fixtures for client_golang 1.12.2.

Signed-off-by: Ben Kochie <superq@gmail.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Ben Kochie <superq@gmail.com>
2022-06-26 11:33:15 +02:00
Ben Kochie 59c146e57d
Update end-to-end test for aarch64 (#2415)
Fix up handling of CPU info collector on non-x86_64 systems due to
fixtures containing `/proc/cpuinfo` from x86_64.
* Update e2e 64k page test fixture from an arm64 system.
* Enable ARM testing in CircleCI.

Fixes: https://github.com/prometheus/node_exporter/issues/1959

Signed-off-by: Ben Kochie <superq@gmail.com>
2022-06-26 09:41:21 +02:00
Ben Kochie a516d4de4a
Cleanup cgroups collector (#2414)
* Correctly name collector file.
* Fix cgroup summary type as gauge.
* Use a boolean metric rather than a label for enabled.

Signed-off-by: Ben Kochie <superq@gmail.com>
2022-06-24 17:15:31 +02:00
Kobe Biello 45c75f1dbc
Add cgroup summary collector (#2408)
* add cgroups summary collector

Signed-off-by: biello <bellusa@qq.com>
Co-authored-by: bielu <bielu@zuoyebang.com>
2022-06-24 12:05:13 +02:00
Ben Kochie 3999866a36
Merge pull request #2368 from mrueg/update-go-systemd
go.mod: Update coreos/go-systemd
2022-06-05 11:20:46 +02:00
Ben Kochie ea85bfcc23
Merge pull request #2378 from prometheus/superq/devfilter
Rename netDevFilter helper
2022-06-05 10:01:50 +02:00
Ben Kochie e22382c5ec
Merge pull request #2372 from aneagoe/master
rapl_collector: fix issue with invalid metric name (#2299)
2022-05-31 21:42:50 +02:00
Tobias Klauser a8ebe3519e
collector: use ByteSliceToString from golang.org/x/sys/unix
Use unix.ByteSliceToString to convert Utsname []byte fields to strings.

This also allows to drop the bytesToString helper which serves the same
purpose and matches ByteSliceToString's implementation.

Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
2022-05-23 15:44:16 +02:00
Ben Kochie 1b6aaeb2e8
Rename netDevFilter helper
Rename the network device filter to a more generic device filter.

Signed-off-by: Ben Kochie <superq@gmail.com>
2022-05-19 10:36:50 +02:00
Andrei Neagoe 0e320e725b rapl_collector: fix issue with invalid metric name (#2299)
Signed-off-by: Andrei Neagoe <3854672+aneagoe@users.noreply.github.com>
2022-05-09 15:42:46 +02:00
Manuel Rüger 21f9ce2c49 go.mod: Update coreos/go-systemd
Signed-off-by: Manuel Rüger <manuel@rueg.eu>
2022-05-04 22:19:30 +02:00
Fionera 9ece38fca9 refactor: Use netlink for tcpstat collector
Signed-off-by: Tim Windelschmidt <t.windelschmidt@babiel.com>
2022-04-25 10:13:06 +02:00
binjip978 e5f384dfe6 Fix staticcheck warnings on linux
Signed-off-by: binjip978 <pdp.eleven11@gmail.com>
2022-04-09 05:36:59 +00:00
Ben Kochie b52bf958f8
Merge pull request #2327 from pjjw/pjjw/powersupplyclass-darwin-old-sdk-fixes
powersupplyclass_darwin: extra includes to build against older macOS SDK
2022-03-30 12:08:52 +02:00
Ben Kochie 9155971e07
Update Go modues
Update to latest releases.
* Fix up perf collector syntax.

Signed-off-by: Ben Kochie <superq@gmail.com>
2022-03-30 11:47:09 +02:00
Peter Woodman 2370cccc1f
powersupplyclass_darwin: enable builds against older macOS SDK
This is necessary to build on darwin using nix, as nix-darwin uses an
older macOS SDK, built from Apple's open source releases.

Signed-off-by: Peter Woodman <peter@shortbus.org>
2022-03-23 22:41:31 -04:00
Ben Kochie 9aae303a46
Merge pull request #2289 from tanguyfalconnet/ethtool-lock
ethtool_linux: add mutex around entries access
2022-03-22 04:34:19 -07:00
Ben Kochie 086fdfed24
Merge pull request #2267 from bison/netdev-lock
netdev_common: Add mutex around metricDescs access
2022-03-22 04:27:37 -07:00
W. Andrew Denton 402a00932d Add a reference to the Linux kernel's documentation for block stat.
Signed-off-by: W. Andrew Denton <git@flying-snail.net>
2022-03-22 11:36:00 +01:00
W. Andrew Denton 84ce3a0103 diskstats_linux: always scale reads and writes by 512 bytes, not by device units.
Signed-off-by: W. Andrew Denton <git@flying-snail.net>
2022-03-22 11:36:00 +01:00
Brad Ison cb7b5a755b
netdev_common: Add mutex around metricDescs access
In certain instances on heavily loaded nodes with many network
devices, there may be concurrent access to the netdev collector's
`metricDescs` map, resulting in a panic.  This adds a mutex to prevent
concurrent reads and writes to the map.

Signed-off-by: Brad Ison <bison@xvdf.io>
2022-03-16 11:46:24 +01:00
Ben Kochie 5c0e4d61c8
Add systemd version as label string.
Signed-off-by: Ben Kochie <superq@gmail.com>
2022-02-17 15:39:00 +01:00
t-falconnet 5c8407b772 ethtool-linux: fix entry function
Signed-off-by: t-falconnet <tfalconnet.externe@bedrockstreaming.com>
2022-02-11 17:06:53 +01:00
t-falconnet db87173be0 ethtool-linux: split between create and show entry
Signed-off-by: t-falconnet <tfalconnet.externe@bedrockstreaming.com>
2022-02-11 17:04:33 +01:00
t-falconnet b0708e4c47 ethtool-linux: add remaining unlocked access to entries
Signed-off-by: t-falconnet <tfalconnet.externe@bedrockstreaming.com>
2022-02-11 16:55:26 +01:00
t-falconnet 642f64b701 ethtool_linux: fix entry function
Signed-off-by: t-falconnet <tfalconnet.externe@bedrockstreaming.com>
2022-02-11 16:44:43 +01:00
t-falconnet 4426962ec8 ethtool_linux: add mutex around entries access
Signed-off-by: t-falconnet <tfalconnet.externe@bedrockstreaming.com>
2022-02-11 16:44:43 +01:00
Ben Kochie 5981bbe638
Refactor systemd version
Move the systemd version function to an exporter method. This way we can
update the Verison information at every scrape, in case the underlying
version changes.

Signed-off-by: Ben Kochie <superq@gmail.com>
2022-02-06 15:37:58 +01:00
Joe Groocock 64c4c39132
systemd: Expose systemd minor version
systemd patch versions are as important as the major version number;
they indicate security or bug fixes or other behavioural changes between
versions.

Use float64 over float32 as the rounding error with float32 rendered
250.3 as 250.3000030517578 in my testing.

Signed-off-by: Joe Groocock <jgroocock@cloudflare.com>
Signed-off-by: Joe Groocock <me@frebib.net>
2022-02-06 14:01:45 +00:00
Robbie Lankford 4f27a4fd8e add additional vm_stat memory metrics for darwin
Signed-off-by: Robbie Lankford <robert.lankford@grafana.com>
2022-01-27 11:34:07 +01:00
Lauri Tirkkonen 996563f972 filesystem_linux: exclude mounts under /var/lib/containers/storage
analogous to the /var/lib/docker exclude added in
https://github.com/prometheus/node_exporter/pull/814

podman rootful containers mount eg. shm filesystems at
/var/lib/containers/storage/*-containers/*/userdata/shm. these should be
treated like things under /var/lib/docker by default.

Signed-off-by: Lauri Tirkkonen <lauri@hacktheplanet.fi>
2022-01-03 16:32:37 +01:00
Ben Kochie eecc2b1dea
Add device filter flags to arp collector
Allow filtering APR entries based on device. Useful for ignoring
entries for network namespaces (containers).

Signed-off-by: Ben Kochie <superq@gmail.com>
2021-12-16 15:41:10 +01:00
heyitao 7dbf358915 delete duplicate items
Signed-off-by: heyitao <linuxgcc@163.com>
2021-12-09 11:50:10 +01:00
Lapo Luchini 3136901a74
Ignore filesystems flagged as MNT_IGNORE. (#2227)
* Ignore filesystems flagges as MNT_IGNORE.
Closes #2152.

Signed-off-by: Lapo Luchini <lapo@lapo.it>
2021-12-01 11:21:31 +01:00
Ben Kochie 1d5afd05b5
Sanitize UTF-8 in dmi collector (#2229)
Replace invalid UTF-8 chars with "�" string.

Fixes: https://github.com/prometheus/node_exporter/issues/2228

Signed-off-by: Ben Kochie <superq@gmail.com>
2021-12-01 11:13:43 +01:00
Jacob Vosmaer 5c8d162ca6
Add node_softirqs_total metric (#2221)
This adds a new Linux metric, node_softirqs_total, which corresponds
to the 'softirq' line in /proc/stat. This metric is disabled by
default and it can be enabled with '--collector.stat.softirq'.

Signed-off-by: Jacob Vosmaer <jacob@gitlab.com>
2021-12-01 09:55:13 +01:00
Matt Oshry 60a2668788
Handle nil CPU thermal power status on M1 (#2225)
Signed-off-by: Matt Oshry <matto@spatialinc.com>
2021-11-29 10:55:36 +01:00
Martin Kennelly 4065902fe5
Add TCPTimeouts to netstat default filter (#2189)
TCP timeouts count is a useful signal to show
abnormal network performance and is another
signal to aid debugging. This metric can be
used to generate proactive alerts for host
network namespace workloads.

Signed-off-by: Martin Kennelly <mkennell@redhat.com>
2021-11-18 09:34:55 +01:00
Benjamin Drung f5ae31a84c
Disable lnstat collector by default (#2188)
The new `lnstat` collector produces a high number of metrics, per-cpu,
and results in approximately double the number of metrics previously
scraped. For example, a typical server with 64 cores produces 3832
lnstat metrics compared to 4147 metrics for the remaining collectors.

Therefore disable the `lnstat` collector by default.

Signed-off-by: Benjamin Drung <benjamin.drung@ionos.com>
2021-11-18 09:33:34 +01:00
Park Beomsu c861ba93aa
Remove redundant nil check (#2206)
Signed-off-by: computerphilosopher <bspark@jam2in.com>
2021-11-15 11:23:49 +01:00
Benjamin Drung d85cbaa17c
ethtool: Prevent duplicate metric names (#2187)
Sanitizing the metric names can lead to duplicate metric names:

```
caller=level.go:63 level=error caller="error gathering metrics: [from Gatherer #2] collected metric \"node_ethtool_giant_hdr\" { label:<name:\"device\" value:\"ens192\" > untyped:<value:0" msg=" > } was collected before with the same name and label values"
```

Generate a map from the sanitized metric names to the metric names from
ethtool. In case of duplicate sanitized metric names drop both metrics,
because it is unknown which one to take.

Fixes: https://github.com/prometheus/node_exporter/issues/2185
Signed-off-by: Benjamin Drung <benjamin.drung@ionos.com>
2021-11-15 11:22:36 +01:00
Tobias Klauser 58ab0144af Use SysctlTimeval for boottime collector on BSD
Use SysctlTimeval from the golang.org/x/sys/unix package to
simplify the implementation of the boottime collector for the BSDs and
allows to build it without cgo.

Tested on macOS 11.6, FreeBSD 13 and OpenBSD 7.

Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
2021-11-15 10:50:03 +01:00
Johannes 'fish' Ziemke 85e20238e7
Add clocksource metrics to time collector (#2197)
* Add clocksource metrics to time collector

This closes #1336

Signed-off-by: Johannes 'fish' Ziemke <github@freigeist.org>
2021-11-12 11:45:31 +01:00
Ben Kochie fda358a1ec
Workaround LLVM/Clang 11.0 for Darwin builds (#2200)
LLVM/Clang 11.0 adds a `-Wundef-prefix=TARGET_OS_` build flag which
breaks this build flag.

Signed-off-by: Ben Kochie <superq@gmail.com>
2021-11-09 17:52:49 +01:00
Benjamin Drung 2a28266852
ethtool: Add test case with leading spaces (#2186)
Add test case for ethtool metrics with leading spaces reported in #2185:

```
$ ethtool -S
NIC statistics:
     Tx Queue#: 0
       TSO pkts tx: 0
       TSO bytes tx: 0
       ucast pkts tx: 20487
       ucast bytes tx: 1908107
       mcast pkts tx: 83
       mcast bytes tx: 5906
       bcast pkts tx: 4
       bcast bytes tx: 168
       pkts tx err: 0
       pkts tx discard: 0
       drv dropped tx total: 0
          too many frags: 0
          giant hdr: 0
          hdr err: 0
          tso: 0
       ring full: 0
       pkts linearized: 0
       hdr cloned: 0
       giant hdr: 0
     Rx Queue#: 0
       LRO pkts rx: 0
       LRO byte rx: 0
       ucast pkts rx: 25086
       ucast bytes rx: 2404103
       mcast pkts rx: 0
       mcast bytes rx: 0
       bcast pkts rx: 0
       bcast bytes rx: 0
       pkts rx OOB: 0
       pkts rx err: 0
       drv dropped rx total: 0
          err: 0
          fcs: 0
       rx buf alloc fail: 0
     tx timeout count: 0
```

Bug: https://github.com/prometheus/node_exporter/issues/2185
Signed-off-by: Benjamin Drung <benjamin.drung@ionos.com>
2021-10-29 10:55:39 +02:00
Benjamin Drung 0dc82eac13
Correctly disable ZFS for test cases (#2182)
Disable `collector/zfs_linux_test.go` in case `!nozfs` is set to
completely disable ZFS.

Signed-off-by: Benjamin Drung <benjamin.drung@ionos.com>
2021-10-28 15:27:15 +02:00
Alessio Caiazza 6523fdfc4b
darwin powersupply collector (#1777)
* Extract powersupply linux code from collector common file.
* Add Darwin powersupply collector.

Signed-off-by: Alessio Caiazza <nolith@abisso.org>
2021-10-28 10:22:24 +02:00