Commit Graph

5 Commits

Author SHA1 Message Date
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
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
Ben Kochie f61be48d94
Use include/exclude flags for ethtool filtering (#2165)
Use the same flag pattern as netdev to make filtering methods the same.
* Move SanitizeMetricName to helper.go

Signed-off-by: Ben Kochie <superq@gmail.com>
2021-10-11 15:12:25 +02:00
David O'Rourke 217bbdd6b9 helper_test: Fix copyright year
Signed-off-by: David O'Rourke <david.orourke@gmail.com>
2020-06-03 11:33:10 +02:00
David O'Rourke d6fbce1529 helper: Add new bytesToString function and tests
Signed-off-by: David O'Rourke <david.orourke@gmail.com>
2020-06-03 11:33:10 +02:00