ZFS Collector: Add fm functionality
Signed-Off-By: Joe Handzik <joseph.t.handzik@hpe.com>
This commit is contained in:
parent
05048c067d
commit
07c7ae733a
5 changed files with 72 additions and 0 deletions
|
|
@ -29,6 +29,7 @@ import (
|
|||
const (
|
||||
zfsProcpathBase = "spl/kstat/zfs/"
|
||||
zfsArcstatsExt = "arcstats"
|
||||
zfsFmExt = "fm"
|
||||
zfsFetchstatsExt = "zfetchstats"
|
||||
zfsVdevCacheStatsExt = "vdev_cache_stats"
|
||||
zfsXuioStatsExt = "xuio_stats"
|
||||
|
|
@ -104,6 +105,18 @@ func (c *zfsCollector) updateXuioStats(ch chan<- prometheus.Metric) (err error)
|
|||
})
|
||||
}
|
||||
|
||||
func (c *zfsCollector) updateFm(ch chan<- prometheus.Metric) (err error) {
|
||||
file, err := c.openProcFile(filepath.Join(zfsProcpathBase, zfsFmExt))
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
defer file.Close()
|
||||
|
||||
return c.parseProcfsFile(file, zfsFmExt, func(s zfsSysctl, v zfsMetricValue) {
|
||||
ch <- c.constSysctlMetric(fm, s, v)
|
||||
})
|
||||
}
|
||||
|
||||
func (c *zfsCollector) parseProcfsFile(reader io.Reader, fmt_ext string, handler func(zfsSysctl, zfsMetricValue)) (err error) {
|
||||
scanner := bufio.NewScanner(reader)
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue