Add a flag for the sysfs location.

Analogous to `collector.procfs`, but for `/sys`. Add tests for both.
This commit is contained in:
Matthias Rampke 2015-09-26 19:38:31 +02:00 committed by Matthias Rampke
commit 85eb47197f
3 changed files with 83 additions and 5 deletions

View file

@ -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
}