Commit graph

2036 commits

Author SHA1 Message Date
sfreydin 31f9aefe2f
feat: add support macos version (#2471)
Signed-off-by: Serhii Freidin <sfreydin@macpaw.com>

Signed-off-by: Serhii Freidin <sfreydin@macpaw.com>
2022-09-16 13:13:06 +02:00
Robin Nabel 8755e852fa Wrap accesses of c.osFilename and c.osMtime in
mutex to prevent race condition.

Signed-off-by: Robin Nabel <rnabel@ucdavis.edu>
2022-09-06 11:37:05 +02:00
dependabot[bot] 4ad86b349b
build(deps): bump github.com/prometheus/client_golang (#2460)
Bumps [github.com/prometheus/client_golang](https://github.com/prometheus/client_golang) from 1.12.2 to 1.13.0.
- [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.2...v1.13.0)

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

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

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-09-02 12:20:48 +02:00
dependabot[bot] 4527f534b5
build(deps): bump github.com/jsimonetti/rtnetlink from 1.2.0 to 1.2.2 (#2459)
Bumps [github.com/jsimonetti/rtnetlink](https://github.com/jsimonetti/rtnetlink) from 1.2.0 to 1.2.2.
- [Release notes](https://github.com/jsimonetti/rtnetlink/releases)
- [Commits](https://github.com/jsimonetti/rtnetlink/compare/v1.2.0...v1.2.2)

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

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

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-09-02 11:46:20 +02:00
Ben Kochie 49db7c81e1
Fixup codespell (#2455)
* Fix some mistakes
* Switch to an ignore file.

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

Signed-off-by: Ben Kochie <superq@gmail.com>
2022-09-02 10:49:47 +02:00
Cosrider 46748fd229 add file descriptor close safely in test
Signed-off-by: Cosrider <cosrider7@gmail.com>
2022-08-22 16:01:02 +02:00
Daniel Hodges b43db0de6e
Add additional perf counters for stalled frontend/backend cycles (#2191)
* Add stalled frontend/backend cycles counters for perf collector

Signed-off-by: Daniel Hodges <hodges.daniel.scott@gmail.com>

* Update collector/perf_linux.go

Co-authored-by: Ben Kochie <superq@gmail.com>
Signed-off-by: Daniel Hodges <hodges.daniel.scott@gmail.com>

* Update collector/perf_linux.go

Co-authored-by: Ben Kochie <superq@gmail.com>
Signed-off-by: Daniel Hodges <hodges.daniel.scott@gmail.com>

Co-authored-by: Ben Kochie <superq@gmail.com>
2022-08-02 14:42:48 +02:00
inosato 9ed32666cc
Remove ioutil (#2438)
Signed-off-by: inosato <si17_21@yahoo.co.jp>
2022-07-27 20:59:39 +02:00
Johannes 'fish' Ziemke 73dabdfe9e
Release 1.4.0-rc.0 (#2436)
Signed-off-by: Johannes Ziemke <github@5pi.de>
2022-07-27 18:13:05 +02:00
Andrew Rowson aa1adc7b11
Allow user to select port on NTP server to query (#2270)
* Allow user to select port on NTP server to query

Some people (me!) run NTP servers on non-privileged ports. The `github.com/beevik/ntp` package allows overriding the port, so this change just adds a flag `collector.ntp.server-port` (defaults to 123) and then passes that value through to the query via the `QueryOptions`.

Signed-off-by: Andrew Rowson <github@growse.com>
2022-07-27 15:41:59 +02:00
Ben Kochie 8a688e8903
Merge pull request #2433 from prometheus/superq/fixup_openbsd_date
Fix up copyright date change
2022-07-27 14:30:02 +02:00
binjip978 c38e1e27ca qdisk-linux: Add exclude and include flags for interface name
Signed-off-by: binjip978 <pdp.eleven11@gmail.com>
Signed-off-by: Johannes 'fish' Ziemke <github@freigeist.org>
2022-07-27 14:15:08 +02:00
Ben Kochie dffe507aad
Fix up copyright date change
Return the copyright date in `collector/cpu_openbsd.go` to the original
value.

Minor change revert on https://github.com/prometheus/node_exporter/pull/1971

Signed-off-by: Ben Kochie <superq@gmail.com>
2022-07-27 14:11:01 +02:00
Ben Kochie 0b82f402d0
Merge pull request #1971 from cjeker/openbsd_spin_time
Also track the CPU Spin time for OpenBSD systems.
2022-07-27 14:10:31 +02:00
Ben Kochie 88a031567f
Merge pull request #2074 from BenoitKnecht/netdev-linux-netlink
collector/netdev_linux.go: Use netlink to get stats
2022-07-27 13:47:01 +02:00
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