2015-11-03 15:53:09 +00:00
|
|
|
package zfs
|
|
|
|
|
2016-05-31 16:49:56 +00:00
|
|
|
type Sysctl func(metric string) ([]string, error)
|
|
|
|
type Zpool func() ([]string, error)
|
2015-11-03 15:53:09 +00:00
|
|
|
|
|
|
|
type Zfs struct {
|
|
|
|
KstatPath string
|
|
|
|
KstatMetrics []string
|
2015-12-08 09:50:42 +00:00
|
|
|
PoolMetrics bool
|
2016-05-31 16:49:56 +00:00
|
|
|
sysctl Sysctl
|
|
|
|
zpool Zpool
|
2015-12-10 18:38:47 +00:00
|
|
|
}
|
|
|
|
|
2015-11-03 15:53:09 +00:00
|
|
|
var sampleConfig = `
|
2016-05-31 16:49:56 +00:00
|
|
|
## ZFS kstat path. Ignored on FreeBSD
|
2016-02-18 21:26:51 +00:00
|
|
|
## If not specified, then default is:
|
2016-05-31 16:49:56 +00:00
|
|
|
# kstatPath = "/proc/spl/kstat/zfs"
|
2016-02-09 05:57:26 +00:00
|
|
|
|
2016-02-18 21:26:51 +00:00
|
|
|
## By default, telegraf gather all zfs stats
|
|
|
|
## If not specified, then default is:
|
2016-05-31 16:49:56 +00:00
|
|
|
# kstatMetrics = ["arcstats", "zfetchstats", "vdev_cache_stats"]
|
2018-01-04 01:45:48 +00:00
|
|
|
## For Linux, the default is:
|
|
|
|
# kstatMetrics = ["abdstats", "arcstats", "dnodestats", "dbufcachestats",
|
|
|
|
# "dmu_tx", "fm", "vdev_mirror_stats", "zfetchstats", "zil"]
|
2016-02-18 21:26:51 +00:00
|
|
|
## By default, don't gather zpool stats
|
2016-05-31 16:49:56 +00:00
|
|
|
# poolMetrics = false
|
2015-11-03 15:53:09 +00:00
|
|
|
`
|
|
|
|
|
|
|
|
func (z *Zfs) SampleConfig() string {
|
|
|
|
return sampleConfig
|
|
|
|
}
|
|
|
|
|
|
|
|
func (z *Zfs) Description() string {
|
2016-05-31 16:49:56 +00:00
|
|
|
return "Read metrics of ZFS from arcstats, zfetchstats, vdev_cache_stats, and pools"
|
2015-11-03 15:53:09 +00:00
|
|
|
}
|