Commit graph

848 commits

Author SHA1 Message Date
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
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
Alessio Caiazza ee17ba0fc0
Fix imports when building on macos (#2180)
Signed-off-by: Alessio Caiazza <nolith@abisso.org>
2021-10-27 16:56:36 +02:00
STRRL df7ea981f7
feat: new collector about thermal conditions on macos (#2032)
* feat: new collector about thermal conditions on macos

Signed-off-by: STRRL <str_ruiling@outlook.com>
2021-10-27 14:05:57 +02:00
Benjamin Drung 9def2f9222
Add DMI collector (#2131)
Add a DMI collector to expose the Desktop Management Interface (DMI)
info from `/sys/class/dmi/id/`. This will expose information about the
BIOS, mainboard, chassis, and product.

Closes: https://github.com/prometheus/node_exporter/issues/303
Signed-off-by: Benjamin Drung <benjamin.drung@ionos.com>
2021-10-27 13:56:37 +02:00
ml 094ee24ad7
Ignore mountpoints under /run (#2157)
* Exclude mountpoints under /run/credentials

Signed-off-by: ml <ml@visu.li>
2021-10-27 13:53:26 +02:00
jordy1024 fbc23548b9
Fix timer GC delays in the Linux filesystem collector (#2169)
Use `time.NewTimer()` and explicit `Stop()` to avoid memory bloat / GC problems with `time.After()` in the Linux filesystem collector timeout handling.

Signed-off-by: bawenmao <bawenmao@sogou-inc.com>
2021-10-24 12:48:57 +02:00
Matt Layher 8b198ce168
collector: replace fmt.Sprintf with strconv.Itoa in perfCollector (#2174)
Signed-off-by: Matt Layher <mdlayher@gmail.com>
2021-10-22 21:03:10 +02:00
W. Andrew Denton d514d67d7f ethtool: convert updateSpeeds to a loop.
Signed-off-by: W. Andrew Denton <git@flying-snail.net>
2021-10-20 19:11:30 +02:00
W. Andrew Denton 56e6dcb1fa ethtool: add newline to settings fixture.
Signed-off-by: W. Andrew Denton <git@flying-snail.net>
2021-10-20 19:11:30 +02:00
W. Andrew Denton 0f6c84214c ethtool: minor changes to resolve review nits.
Signed-off-by: W. Andrew Denton <git@flying-snail.net>
2021-10-20 19:11:30 +02:00
W. Andrew Denton 77a3c9bc20 Gather additional link info from ethtool.
The ethtool_cmd	struct from the	linux kernel contains information about the speeds and features	supported by a
network device. This includes speeds and duplex	but also features like autonegotiate and 802.3x pause frames.

Closes #1444

Signed-off-by: W. Andrew Denton <git@flying-snail.net>
2021-10-20 19:11:30 +02:00
wenlxie 11bb2f8a95 support thread state
Signed-off-by: wenlxie <wenlxie@ebay.com>
2021-10-19 11:58:43 +02:00
Kiril Vladimirov 1721de0c38
collector: Unwrap glob textfile directories (#1985)
* collector: Unwrap glob textfile directories
* collector: Store full path in mtime's file label

The point is to avoid duplicated gauges from files with the same name in
different directories.

This introduces support for exporting from multiple directories matching
given pattern (e.g. `/home/*/metrics/`).

Signed-off-by: Kiril Vladimirov <kiril@vladimiroff.org>
2021-10-18 14:05:21 +02:00
Ben Kochie f67faf9d18
Fixup drm_linux.go build tag.
Signed-off-by: Ben Kochie <superq@gmail.com>
2021-10-11 15:36:44 +02:00