Commit Graph

9 Commits

Author SHA1 Message Date
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
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
Julien Pivotto 68a6c78c0d
Update go to 1.17 (#2159)
Signed-off-by: Julien Pivotto <roidelapluie@inuits.eu>
2021-10-03 13:35:24 +02:00
Ben Kochie 3bc9a93c20
Add ErrorLog plumbing to promhttp
Fix the error logging of the promhttp handler by connecting it to the
promlog setup.
* Switch to go-kit/log.
* Cleanup CHANGELOG.

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

Signed-off-by: Ben Kochie <superq@gmail.com>
2021-06-03 10:47:41 +02:00
Julian Kornberger 2d412c6ce6 Move ignore/accept to new netDevFilter struct
Signed-off-by: Julian Kornberger <jk+github@digineo.de>
2020-08-26 11:33:05 +02:00
Julian Kornberger 66fb6762bf
Netdev tweaks (#1558)
* Check interface name before loading interface data
* Reduce indentation
* Optimize nested netdev map

This change avoids conversion to strings and back.

Signed-off-by: Julian Kornberger <jk+github@digineo.de>
2020-08-24 17:43:27 +02:00
Ben Ye 2477c5c67d switch to go-kit/log (#1575)
Signed-off-by: yeya24 <yb532204897@gmail.com>
2019-12-31 17:19:37 +01:00
Noam Meltzer 501ccf9fb4 Add --collector.netdev.device-whitelist flag (#1279)
* Add --collector.netdev.device-whitelist flag

Sometimes it is desired to monitor only one netdev. The golang regexp
does not support a negated regex, so the ignored-devices flag is too
cumbersome for this task.
This change introduces a new flag: accept-devices, which is mutually
exclusive to ignored-devices. This flag allows specifying ONLY the
netdev you'd like.

Signed-off-by: Noam Meltzer <noam@cynerio.co>
2019-05-31 17:55:50 +02:00
stuart nelson ef1925db7d Compile netdev on dragonfly (#314)
* Compile netdev on dragonfly

* Only run netdev bsd test on bsd

* Update README.md
2016-09-27 21:44:13 +01:00