Add a flag for the sysfs location.
Analogous to `collector.procfs`, but for `/sys`. Add tests for both.
This commit is contained in:
parent
24c9db9600
commit
85eb47197f
3 changed files with 83 additions and 5 deletions
|
|
@ -25,10 +25,6 @@ import (
|
|||
"github.com/prometheus/client_golang/prometheus"
|
||||
)
|
||||
|
||||
const (
|
||||
sysfsNet = "/sys/class/net"
|
||||
)
|
||||
|
||||
type bondingCollector struct {
|
||||
slaves, active *prometheus.GaugeVec
|
||||
}
|
||||
|
|
@ -62,7 +58,7 @@ func NewBondingCollector() (Collector, error) {
|
|||
|
||||
// Update reads and exposes bonding states, implements Collector interface. Caution: This works only on linux.
|
||||
func (c *bondingCollector) Update(ch chan<- prometheus.Metric) (err error) {
|
||||
bondingStats, err := readBondingStats(sysfsNet)
|
||||
bondingStats, err := readBondingStats(sysFilePath("class/net"))
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue