Commit graph

2071 commits

Author SHA1 Message Date
Ben Kochie 90f6e9d2d2
Merge pull request #2251 from DavidVentura/add-isolated-label-cpu-collector
Implement #2250: Add "isolated" metric on cpu collector on linux
2022-07-27 13:37:09 +02:00
Siavash Sefid Rodi f40dd31780 Fix CPU renaming rule
Signed-off-by: Florian Best <best@univention.de>
2022-07-27 13:16:00 +02:00
Benoît Knecht b25273fac0 collector/netdev_*: Add detailed interface stats
On Linux, we get more detailed interface statistics from netlink than we did
from `/proc/net/dev`.

This commit adds a new flag (`--collector.netdev.enable-detailed-metrics`) to
expose those statistics under new (incompatible) metric names. When enabled,
the metric names are also changed on Darwin and BSD platforms to keep
everything consistent, but it doesn't provide more detailed statistics on those
platforms.

The old metrics can be derived from the new ones using the following rules
([dev_seq_printf_stats]):

- `receive_errs`      = `receive_errors`
- `receive_drop`      = `receive_dropped` + `receive_missed_errors`
- `receive_fifo`      = `receive_fifo_errors`
- `receive_frame`     = `receive_length_errors` + `receive_over_errors` + `receive_crc_errors` + `receive_frame_errors`
- `receive_multicast` = `multicast`
- `transmit_errs`     = `transmit_errors`
- `transmit_drop`     = `transmit_dropped`
- `transmit_fifo`     = `transmit_fifo_errors`
- `transmit_colls`    = `collisions`
- `transmit_carrier`  = `transmit_aborted_errors` + `transmit_carrier_errors` + `transmit_heartbeat_errors` + `transmit_window_errors`

[dev_seq_printf_stats]: https://github.com/torvalds/linux/blob/master/net/core/net-procfs.c#L75-L97

Signed-off-by: Benoît Knecht <bknecht@protonmail.ch>
2022-07-26 13:24:20 +02:00
Benoît Knecht 4851993a63 collector/netdev_linux_test.go: Add compatibility tests
To prepare for the introduction of new metric names, add tests for the legacy
metric names and values. This will make it easier to ensure that the code that
converts the new metrics to the old ones (for compatibility) behaves correctly.

Signed-off-by: Benoît Knecht <bknecht@protonmail.ch>
2022-07-26 13:24:20 +02:00
Benoît Knecht a71d0bddc8 end-to-end-test.sh: Fix netdev metrics
Since netdev metrics are now read from netlink instead of `/proc/net/dev`, we
can't easily spoof them for the end-to-end tests by reading a fixture file in
place of `/proc/net/dev`.

Therefore, we only get metrics for `lo` and ignore those that would return
unpredictable values (i.e. the byte and packet counters).

Signed-off-by: Benoît Knecht <bknecht@protonmail.ch>
2022-07-26 13:24:20 +02:00
Benoît Knecht f23a956c4f collector/netdev_linux.go: Use netlink to get stats
Instead of parsing `/proc/net/dev` to get network interface statistics, get
them from a netlink call.

Internally, both come from the [rtnl_link_stats64] struct, but with
`/proc/net/dev`, some of the values are aggregated together in
[dev_seq_printf_stats], so we get less information out of them.

This commit maintains compatibility by aggregating those stats back into the
same metrics.

[rtnl_link_stats64]:    https://github.com/torvalds/linux/blob/master/include/uapi/linux/if_link.h#L42-L246
[dev_seq_printf_stats]: https://github.com/torvalds/linux/blob/master/net/core/net-procfs.c#L75-L97

Signed-off-by: Benoît Knecht <bknecht@protonmail.ch>
2022-07-26 13:09:58 +02:00
DavidVentura 6477a197da adjust expected output for 64k file
Signed-off-by: DavidVentura <davidventura27@gmail.com>
2022-07-26 12:25:23 +02:00
david c2085cf8ca flip branches for early return
Signed-off-by: david <davidventura27@gmail.com>
2022-07-26 11:21:08 +02:00
david 75c05f3d97 remove error from signature; update doc for function
Signed-off-by: david <davidventura27@gmail.com>
2022-07-26 11:21:08 +02:00
david 840d32622f check for nil isolatedCpus before calling updateIsolated
Signed-off-by: david <davidventura27@gmail.com>
2022-07-26 11:21:08 +02:00
david 5340d1ec37 add debug log for not existent file
Signed-off-by: david <davidventura27@gmail.com>
2022-07-26 11:21:08 +02:00
david c05af934af warn if isolcpus cannot be read and default to an empty slice
Signed-off-by: david <davidventura27@gmail.com>
2022-07-26 11:21:08 +02:00
david 9ea9a5f029 only publish metrics for isolated cpus
Signed-off-by: david <davidventura27@gmail.com>
2022-07-26 11:21:08 +02:00
david 698670bb6e add fixture & e2e output
Signed-off-by: david <davidventura27@gmail.com>
2022-07-26 11:21:08 +02:00
david 5d68d5b9ad move logic to procfs; create a new metric for isolation
Signed-off-by: david <davidventura27@gmail.com>
2022-07-26 11:21:08 +02:00
david 512e086dec Implement #2250: Add "isolated" label on cpu collector on linux
Signed-off-by: david <davidventura27@gmail.com>
2022-07-26 11:21:08 +02:00
Ben Kochie 5d6738e6c5 Update procfs
Update to latet procfs release.

Signed-off-by: Ben Kochie <superq@gmail.com>
2022-07-26 11:10:40 +02:00
Vitaly Zhuravlev 7519830a8a Change io time units to %util
When appying rate() to seconds we have 'seconds per second' or fractions of the second, so actually it actually can be from 0 to 1.

Also update intervalFactor to 1 for better rates.

Signed-off-by: Vitaly Zhuravlev <zhuravlev.vitaly@gmail.com>
2022-07-26 11:09:43 +02:00
Vitaly Zhuravlev 469600f4bf Update units of network ad disk graphs
https://prometheus.io/docs/prometheus/latest/querying/functions/#rate

rate() calculates per-second average rate, therefore Bps units should be used for disks.

In networking bandwidth throughput is usually measured in bits/s so units are changed accordingly.

Signed-off-by: Vitaly Zhuravlev <zhuravlev.vitaly@gmail.com>
2022-07-26 11:09:43 +02:00
Albert Mikaelyan cee386678c fix compatibility rule to convert to old node_cpu metric
Signed-off-by: Albert Mikaelyan <tahvok@gmail.com>
2022-07-25 18:54:53 +02:00
François Charlier 5a2c83d0f9 memory_bsd: add user_wired_bytes & laundry_bytes
These two memory classes have been here for a while now in FreeBSD,
adding them allows having information for all memory classes.

Signed-off-by: François Charlier <fcharlier@ploup.net>
2022-07-25 18:49:56 +02:00
Mateusz Piotrowski d31cfb6ef9 Document availability of zfs collector on FreeBSD
The zfs collector for FreeBSD was committed in
3d504bc5cb.

Signed-off-by: Mateusz Piotrowski <0mp@FreeBSD.org>
2022-07-25 18:48:47 +02:00
Johannes Ziemke bc0bff22fd Add sysctl docs to README.md
Signed-off-by: Johannes Ziemke <github@5pi.de>
2022-07-25 18:27:48 +02:00
Johannes 'fish' Ziemke d962e48ca2 Add sysctl collector
Signed-off-by: Johannes Ziemke <github@5pi.de>
2022-07-25 18:27:48 +02:00
Johannes Ziemke 545d70ceb0 Sort collectors in end-to-end-test.sh
Signed-off-by: Johannes Ziemke <github@5pi.de>
2022-07-25 18:27:48 +02:00
Johannes Ziemke f4e85bef0e Fix openbsd syscalls
Apparently these are not int8 slices anymore

Signed-off-by: Johannes Ziemke <github@5pi.de>
2022-07-25 18:27:48 +02:00
Ben Kochie f06eb4152d
Merge pull request #2426 from paulfantom/alerts-selectors
docs/node-mixin: add missing selectors
2022-07-21 13:08:07 +02:00
Paweł Krupa (paulfantom) 8571536327 docs/node-mixin: add missing selectors
Signed-off-by: Paweł Krupa (paulfantom) <pawel@krupa.net.pl>
2022-07-19 16:44:16 +02:00
Benoît Knecht 690efa61e8 collector/diskstats: Ignore udev when directory unreadable
Log a single error message when the udev data directory (`/run/udev/data` by
default) is unreadable, and then don't try to get device properties out of it.

Also lower the log level from error to debug when we can't parse the udev files
properly, since these messages would be sent every time the node exporter gets
scraped.

Signed-off-by: Benoît Knecht <bknecht@protonmail.ch>
2022-07-06 12:30:50 +02:00
Benoît Knecht 9ec7d6ba3c collector/diskstats: Only get device properties from udev
When parsing udev data, skip lines that don't start with `E:`.

Lines prefixed with `E:` represent device properties, as documented in
udevadm(8).

Signed-off-by: Benoît Knecht <bknecht@protonmail.ch>
2022-07-06 12:30:50 +02:00
Benoît Knecht 296aa35dd2 end-to-end-test.sh: Use udev fixture and update output
Set the `--path.udev.data` flag to point to the udev fixture, and update the
output fixture with

```console
$ ./end-to-end-test.sh -u
```

Signed-off-by: Benoît Knecht <bknecht@protonmail.ch>
2022-07-06 12:30:50 +02:00
Benoît Knecht 9b5d55e511 collector/diskstats: Add fixtures for udev data
Now that we read some data from `/run/udev/data`, add the corresponding
fixtures and update the expected test results accordingly.

Signed-off-by: Benoît Knecht <bknecht@protonmail.ch>
2022-07-06 12:30:50 +02:00
Benoît Knecht 833216dc9e collector: Make udev data path optional
Instead of hard-coding the path to `/run/udev/data`, intoduce a
`--path.udev.data` flag that defaults to that value.

Signed-off-by: Benoît Knecht <bknecht@protonmail.ch>
2022-07-06 12:30:50 +02:00
Benoît Knecht 75ceda8bb2 collector/diskstats: Don't use functions from Go 1.18
Since we need to support Go 1.17, don't use `strings.Cut()` which was
introduced in Go 1.18.

Signed-off-by: Benoît Knecht <bknecht@protonmail.ch>
2022-07-06 12:30:50 +02:00
Benoît Knecht a997b6096d collector/diskstats: Add labels and metrics from udev
Add labels to the `node_disk_info` metric extracted from udev, such as `model`,
`path`, `revision`, `serial` and `wwn`.

Also add a few metrics related to filesystem and device mapper, which are also
extracted from udev information.

Signed-off-by: Benoît Knecht <bknecht@protonmail.ch>
2022-07-06 12:30:50 +02:00
Nobuhiro MIKI 3ed95908d6 collector: add slab info
Co-authored-by: Ben Kochie <superq@gmail.com>
Signed-off-by: Nobuhiro MIKI <nmiki@yahoo-corp.jp>
2022-07-06 12:18:27 +02:00
Ben Kochie 69a3f73a9b
Merge pull request #2417 from prometheus/superq/diskstats
Add diskstats include and exclude device flags
2022-06-28 10:12:14 +02:00
Ben Kochie 02f5005ac8
Add diskstat include/exclude flag to all platforms
Refactor diskstats collector include/exclude to work on all platforms.
* Fix up default ignored devices.

Signed-off-by: Ben Kochie <superq@gmail.com>
2022-06-28 08:30:01 +02:00
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
Sven Kieske d64766f43d
fix the following markdownlint issues (#2362)
fix the following markdownlint errors (and some more):

[..]mixins/node-exporter/README.md:13: MD031 Fenced code blocks should be surrounded by blank lines
[..]mixins/node-exporter/README.md:21: MD031 Fenced code blocks should be surrounded by blank lines
[..]mixins/node-exporter/README.md:27: MD031 Fenced code blocks should be surrounded by blank lines
[..]mixins/node-exporter/README.md:33: MD031 Fenced code blocks should be surrounded by blank lines
[..]mixins/node-exporter/README.md:41: MD034 Bare URL used
A detailed description of the rules is available at https://github.com/markdownlint/markdownlint/blob/master/docs/RULES.md

Signed-off-by: Sven Kieske <s.kieske@mittwald.de>
2022-06-28 05:50:06 +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
dependabot[bot] a94de92e7d
Bump github.com/jsimonetti/rtnetlink from 1.1.1 to 1.2.0 (#2413)
Bumps [github.com/jsimonetti/rtnetlink](https://github.com/jsimonetti/rtnetlink) from 1.1.1 to 1.2.0.
- [Release notes](https://github.com/jsimonetti/rtnetlink/releases)
- [Commits](https://github.com/jsimonetti/rtnetlink/compare/v1.1.1...v1.2.0)

---
updated-dependencies:
- dependency-name: github.com/jsimonetti/rtnetlink
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

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

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-06-26 11:13:39 +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
dependabot[bot] 26e377dfd5
Bump github.com/go-kit/log from 0.2.0 to 0.2.1 (#2412)
Bumps [github.com/go-kit/log](https://github.com/go-kit/log) from 0.2.0 to 0.2.1.
- [Release notes](https://github.com/go-kit/log/releases)
- [Commits](https://github.com/go-kit/log/compare/v0.2.0...v0.2.1)

---
updated-dependencies:
- dependency-name: github.com/go-kit/log
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

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

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-06-24 17:52:23 +02:00
dependabot[bot] 504c820881
Bump github.com/prometheus/common from 0.33.0 to 0.35.0 (#2410)
Bumps [github.com/prometheus/common](https://github.com/prometheus/common) from 0.33.0 to 0.35.0.
- [Release notes](https://github.com/prometheus/common/releases)
- [Commits](https://github.com/prometheus/common/compare/v0.33.0...v0.35.0)

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

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

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-06-24 17:51:48 +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 279ac3ada2
Merge pull request #2406 from prometheus/superq/1.18
Update build
2022-06-24 12:03:41 +02:00