Add flag to change the location of the procfs.

Remove all hardcoded references to `/proc`. For all collectors that do
not use `github.com/prometheus/procfs` yet, provide a wrapper to
generate the full paths.

Reformulate help strings, errors and comments to remove absolute
references to `/proc`.

This is a breaking change: the `-collector.ipvs.procfs` flag is removed
in favor of the general flag. Since it only affected that collector it
was only useful for development, so this should not cause many issues.
This commit is contained in:
Matthias Rampke 2015-09-26 14:53:46 +02:00
commit 20b551ab2b
15 changed files with 57 additions and 67 deletions

View file

@ -12,8 +12,7 @@ import (
)
const (
procStat = "/proc/stat"
userHz = 100
userHz = 100
)
type statCollector struct {
@ -75,9 +74,9 @@ func NewStatCollector() (Collector, error) {
}, nil
}
// Expose a variety of stats from /proc/stats.
// Expose kernel and system statistics.
func (c *statCollector) Update(ch chan<- prometheus.Metric) (err error) {
file, err := os.Open(procStat)
file, err := os.Open(procFilePath("stat"))
if err != nil {
return err
}