From f29f3873eaf51c354230b97a1a597334b29698d2 Mon Sep 17 00:00:00 2001 From: Christian Schwarz Date: Thu, 25 Feb 2016 13:55:02 +0100 Subject: [PATCH 1/6] Add a collector for ZFS, currently focussed on ARC stats. It is tested on FreeBSD 10.2-RELEASE and Linux (ZFS on Linux 0.6.5.4). On FreeBSD, Solaris, etc. ZFS metrics are exposed through sysctls. ZFS on Linux exposes the same metrics through procfs `/proc/spl/...`. In addition to sysctl metrics, 'computed metrics' are exposed by the collector, which are based on several sysctl values. There is some conditional logic involved in computing these metrics which cannot be easily mapped to PromQL. Not all 92 ARC sysctls are exposed right now but this can be changed with one additional LOC each. --- .../fixtures/proc/spl/kstat/zfs/arcstats | 93 +++++++++++++++ .../freebsd/kstat.zfs.misc.arcstats.txt | 78 +++++++++++++ collector/fixtures/zfs/zpool_stats_stdout.txt | 12 ++ collector/zfs.go | 109 +++++++++++++++++ collector/zfs_freebsd.go | 110 ++++++++++++++++++ collector/zfs_freebsd_test.go | 44 +++++++ collector/zfs_linux.go | 88 ++++++++++++++ collector/zfs_linux_test.go | 44 +++++++ collector/zfs_zpool.go | 41 +++++++ collector/zfs_zpool_test.go | 59 ++++++++++ 10 files changed, 678 insertions(+) create mode 100644 collector/fixtures/proc/spl/kstat/zfs/arcstats create mode 100644 collector/fixtures/sysctl/freebsd/kstat.zfs.misc.arcstats.txt create mode 100644 collector/fixtures/zfs/zpool_stats_stdout.txt create mode 100644 collector/zfs.go create mode 100644 collector/zfs_freebsd.go create mode 100644 collector/zfs_freebsd_test.go create mode 100644 collector/zfs_linux.go create mode 100644 collector/zfs_linux_test.go create mode 100644 collector/zfs_zpool.go create mode 100644 collector/zfs_zpool_test.go diff --git a/collector/fixtures/proc/spl/kstat/zfs/arcstats b/collector/fixtures/proc/spl/kstat/zfs/arcstats new file mode 100644 index 00000000..48a73a2c --- /dev/null +++ b/collector/fixtures/proc/spl/kstat/zfs/arcstats @@ -0,0 +1,93 @@ +6 1 0x01 91 4368 5266997922 97951858082072 +name type data +hits 4 8772612 +misses 4 604635 +demand_data_hits 4 7221032 +demand_data_misses 4 73300 +demand_metadata_hits 4 1464353 +demand_metadata_misses 4 498170 +prefetch_data_hits 4 3615 +prefetch_data_misses 4 17094 +prefetch_metadata_hits 4 83612 +prefetch_metadata_misses 4 16071 +mru_hits 4 855535 +mru_ghost_hits 4 21100 +mfu_hits 4 7829854 +mfu_ghost_hits 4 821 +deleted 4 60403 +mutex_miss 4 2 +evict_skip 4 2265729 +evict_not_enough 4 680 +evict_l2_cached 4 0 +evict_l2_eligible 4 8992514560 +evict_l2_ineligible 4 992552448 +evict_l2_skip 4 0 +hash_elements 4 42359 +hash_elements_max 4 88245 +hash_collisions 4 50564 +hash_chains 4 412 +hash_chain_max 4 3 +p 4 516395305 +c 4 1643208777 +c_min 4 33554432 +c_max 4 8367976448 +size 4 1603939792 +hdr_size 4 16361080 +data_size 4 1295836160 +metadata_size 4 175298560 +other_size 4 116443992 +anon_size 4 1917440 +anon_evictable_data 4 0 +anon_evictable_metadata 4 0 +mru_size 4 402593792 +mru_evictable_data 4 278091264 +mru_evictable_metadata 4 18606592 +mru_ghost_size 4 999728128 +mru_ghost_evictable_data 4 883765248 +mru_ghost_evictable_metadata 4 115962880 +mfu_size 4 1066623488 +mfu_evictable_data 4 1017613824 +mfu_evictable_metadata 4 9163776 +mfu_ghost_size 4 104936448 +mfu_ghost_evictable_data 4 96731136 +mfu_ghost_evictable_metadata 4 8205312 +l2_hits 4 0 +l2_misses 4 0 +l2_feeds 4 0 +l2_rw_clash 4 0 +l2_read_bytes 4 0 +l2_write_bytes 4 0 +l2_writes_sent 4 0 +l2_writes_done 4 0 +l2_writes_error 4 0 +l2_writes_lock_retry 4 0 +l2_evict_lock_retry 4 0 +l2_evict_reading 4 0 +l2_evict_l1cached 4 0 +l2_free_on_write 4 0 +l2_cdata_free_on_write 4 0 +l2_abort_lowmem 4 0 +l2_cksum_bad 4 0 +l2_io_error 4 0 +l2_size 4 0 +l2_asize 4 0 +l2_hdr_size 4 0 +l2_compress_successes 4 0 +l2_compress_zeros 4 0 +l2_compress_failures 4 0 +memory_throttle_count 4 0 +duplicate_buffers 4 0 +duplicate_buffers_size 4 0 +duplicate_reads 4 0 +memory_direct_count 4 542 +memory_indirect_count 4 3006 +arc_no_grow 4 0 +arc_tempreserve 4 0 +arc_loaned_bytes 4 0 +arc_prune 4 0 +arc_meta_used 4 308103632 +arc_meta_limit 4 6275982336 +arc_meta_max 4 449286096 +arc_meta_min 4 16777216 +arc_need_free 4 0 +arc_sys_free 4 261496832 diff --git a/collector/fixtures/sysctl/freebsd/kstat.zfs.misc.arcstats.txt b/collector/fixtures/sysctl/freebsd/kstat.zfs.misc.arcstats.txt new file mode 100644 index 00000000..aaaf6503 --- /dev/null +++ b/collector/fixtures/sysctl/freebsd/kstat.zfs.misc.arcstats.txt @@ -0,0 +1,78 @@ +kstat.zfs.misc.arcstats.arc_meta_max: 1503210048 +kstat.zfs.misc.arcstats.arc_meta_limit: 393216000 +kstat.zfs.misc.arcstats.arc_meta_used: 392649848 +kstat.zfs.misc.arcstats.duplicate_reads: 0 +kstat.zfs.misc.arcstats.duplicate_buffers_size: 0 +kstat.zfs.misc.arcstats.duplicate_buffers: 0 +kstat.zfs.misc.arcstats.memory_throttle_count: 0 +kstat.zfs.misc.arcstats.l2_write_buffer_list_null_iter: 0 +kstat.zfs.misc.arcstats.l2_write_buffer_list_iter: 0 +kstat.zfs.misc.arcstats.l2_write_buffer_bytes_scanned: 0 +kstat.zfs.misc.arcstats.l2_write_pios: 0 +kstat.zfs.misc.arcstats.l2_write_buffer_iter: 0 +kstat.zfs.misc.arcstats.l2_write_full: 0 +kstat.zfs.misc.arcstats.l2_write_not_cacheable: 29425 +kstat.zfs.misc.arcstats.l2_write_io_in_progress: 0 +kstat.zfs.misc.arcstats.l2_write_in_l2: 0 +kstat.zfs.misc.arcstats.l2_write_spa_mismatch: 0 +kstat.zfs.misc.arcstats.l2_write_passed_headroom: 0 +kstat.zfs.misc.arcstats.l2_write_trylock_fail: 0 +kstat.zfs.misc.arcstats.l2_compress_failures: 0 +kstat.zfs.misc.arcstats.l2_compress_zeros: 0 +kstat.zfs.misc.arcstats.l2_compress_successes: 0 +kstat.zfs.misc.arcstats.l2_hdr_size: 0 +kstat.zfs.misc.arcstats.l2_asize: 0 +kstat.zfs.misc.arcstats.l2_size: 0 +kstat.zfs.misc.arcstats.l2_io_error: 0 +kstat.zfs.misc.arcstats.l2_cksum_bad: 0 +kstat.zfs.misc.arcstats.l2_abort_lowmem: 0 +kstat.zfs.misc.arcstats.l2_cdata_free_on_write: 0 +kstat.zfs.misc.arcstats.l2_free_on_write: 0 +kstat.zfs.misc.arcstats.l2_evict_reading: 0 +kstat.zfs.misc.arcstats.l2_evict_lock_retry: 0 +kstat.zfs.misc.arcstats.l2_writes_hdr_miss: 0 +kstat.zfs.misc.arcstats.l2_writes_error: 0 +kstat.zfs.misc.arcstats.l2_writes_done: 0 +kstat.zfs.misc.arcstats.l2_writes_sent: 0 +kstat.zfs.misc.arcstats.l2_write_bytes: 0 +kstat.zfs.misc.arcstats.l2_read_bytes: 0 +kstat.zfs.misc.arcstats.l2_rw_clash: 0 +kstat.zfs.misc.arcstats.l2_feeds: 0 +kstat.zfs.misc.arcstats.l2_misses: 0 +kstat.zfs.misc.arcstats.l2_hits: 0 +kstat.zfs.misc.arcstats.other_size: 166832272 +kstat.zfs.misc.arcstats.data_size: 1200779776 +kstat.zfs.misc.arcstats.hdr_size: 27244008 +kstat.zfs.misc.arcstats.size: 1394856056 +kstat.zfs.misc.arcstats.c_max: 1572864000 +kstat.zfs.misc.arcstats.c_min: 196608000 +kstat.zfs.misc.arcstats.c: 1470553736 +kstat.zfs.misc.arcstats.p: 665524427 +kstat.zfs.misc.arcstats.hash_chain_max: 7 +kstat.zfs.misc.arcstats.hash_chains: 14180 +kstat.zfs.misc.arcstats.hash_collisions: 2180398 +kstat.zfs.misc.arcstats.hash_elements_max: 238188 +kstat.zfs.misc.arcstats.hash_elements: 111458 +kstat.zfs.misc.arcstats.evict_l2_ineligible: 60262400 +kstat.zfs.misc.arcstats.evict_l2_eligible: 35702978560 +kstat.zfs.misc.arcstats.evict_l2_cached: 0 +kstat.zfs.misc.arcstats.evict_skip: 21716568 +kstat.zfs.misc.arcstats.mutex_miss: 873 +kstat.zfs.misc.arcstats.recycle_miss: 5018771 +kstat.zfs.misc.arcstats.stolen: 1327563 +kstat.zfs.misc.arcstats.deleted: 1187256 +kstat.zfs.misc.arcstats.allocated: 10150518 +kstat.zfs.misc.arcstats.mfu_ghost_hits: 1408986 +kstat.zfs.misc.arcstats.mfu_hits: 51952454 +kstat.zfs.misc.arcstats.mru_ghost_hits: 696819 +kstat.zfs.misc.arcstats.mru_hits: 11115835 +kstat.zfs.misc.arcstats.prefetch_metadata_misses: 32 +kstat.zfs.misc.arcstats.prefetch_metadata_hits: 2 +kstat.zfs.misc.arcstats.prefetch_data_misses: 0 +kstat.zfs.misc.arcstats.prefetch_data_hits: 0 +kstat.zfs.misc.arcstats.demand_metadata_misses: 9231542 +kstat.zfs.misc.arcstats.demand_metadata_hits: 40650947 +kstat.zfs.misc.arcstats.demand_data_misses: 75230 +kstat.zfs.misc.arcstats.demand_data_hits: 22417340 +kstat.zfs.misc.arcstats.misses: 9306804 +kstat.zfs.misc.arcstats.hits: 63068289 diff --git a/collector/fixtures/zfs/zpool_stats_stdout.txt b/collector/fixtures/zfs/zpool_stats_stdout.txt new file mode 100644 index 00000000..104e2d18 --- /dev/null +++ b/collector/fixtures/zfs/zpool_stats_stdout.txt @@ -0,0 +1,12 @@ +trout size 4294967296 - +trout free 1040117248 - +trout allocated 70144 - +trout capacity 0% - +trout dedupratio 1.00x - +trout fragmentation 0% - +zroot size 118111600640 - +zroot free 3990917120 - +zroot allocated 114120683520 - +zroot capacity 50% - +zroot dedupratio 1.00x - +zroot fragmentation 67% - diff --git a/collector/zfs.go b/collector/zfs.go new file mode 100644 index 00000000..9749a0b3 --- /dev/null +++ b/collector/zfs.go @@ -0,0 +1,109 @@ +package collector + +// +build linux freebsd +// +build !nozfs + +import ( + "errors" + "strings" + + "github.com/prometheus/client_golang/prometheus" + "github.com/prometheus/common/log" +) + +type zfsMetricValue int + +const zfsErrorValue = zfsMetricValue(-1) + +var zfsNotAvailableError = errors.New("ZFS / ZFS statistics are not available") + +type zfsSysctl string +type zfsSubsystemName string + +const ( + arc = zfsSubsystemName("zfsArc") + zpoolSubsystem = zfsSubsystemName("zfsPool") +) + +// Metrics + +type zfsMetric struct { + subsystem zfsSubsystemName // The Prometheus subsystem name. + name string // The Prometheus name of the metric. + sysctl zfsSysctl // The sysctl of the ZFS metric. +} + +type datasetMetric struct { + subsystem zfsSubsystemName + name string +} + +// Collector + +func init() { + Factories["zfs"] = NewZFSCollector +} + +type zfsCollector struct { + zfsMetrics []zfsMetric +} + +func NewZFSCollector() (Collector, error) { + return &zfsCollector{}, nil +} + +func (c *zfsCollector) Update(ch chan<- prometheus.Metric) (err error) { + + err = c.zfsAvailable() + switch { + case err == zfsNotAvailableError: + log.Debug(err) + return nil + case err != nil: + return err + } + + // Arcstats + err = c.updateArcstats(ch) + if err != nil { + return err + } + + // Pool stats + return c.updatePoolStats(ch) +} + +func (s zfsSysctl) metricName() string { + parts := strings.Split(string(s), ".") + return parts[len(parts)-1] +} + +func (c *zfsCollector) ConstSysctlMetric(subsystem zfsSubsystemName, sysctl zfsSysctl, value zfsMetricValue) prometheus.Metric { + + metricName := sysctl.metricName() + + return prometheus.MustNewConstMetric( + prometheus.NewDesc( + prometheus.BuildFQName(Namespace, string(subsystem), metricName), + string(sysctl), + nil, + nil, + ), + prometheus.UntypedValue, + float64(value), + ) +} + +func (c *zfsCollector) ConstZpoolMetric(pool, name string, value float64) prometheus.Metric { + return prometheus.MustNewConstMetric( + prometheus.NewDesc( + prometheus.BuildFQName(Namespace, string(zpoolSubsystem), name), + name, + []string{"pool"}, + nil, + ), + prometheus.UntypedValue, + float64(value), + pool, + ) +} diff --git a/collector/zfs_freebsd.go b/collector/zfs_freebsd.go new file mode 100644 index 00000000..9d344dc8 --- /dev/null +++ b/collector/zfs_freebsd.go @@ -0,0 +1,110 @@ +package collector + +import ( + "bufio" + "io" + "os/exec" + "strconv" + "strings" + + "github.com/prometheus/client_golang/prometheus" + "github.com/prometheus/common/log" +) + +/* +#cgo LDFLAGS: +#include +#include + +int zfsModuleLoaded() { + int modid = modfind("zfs"); + return modid < 0 ? 0 : -1; +} + +*/ +import "C" + +func (c *zfsCollector) zfsAvailable() error { + if C.zfsModuleLoaded() == 0 { + return zfsNotAvailableError + } + return nil +} + +const zfsArcstatsSysctl = "kstat.zfs.misc.arcstats" + +func (c *zfsCollector) RunOnStdout(cmd *exec.Cmd, handler func(io.Reader) error) (err error) { + + stdout, err := cmd.StdoutPipe() + if err != nil { + return + } + + if err = cmd.Start(); err != nil { + return + } + + err = handler(stdout) + if err != nil { + return + } + + return cmd.Wait() +} + +func (c *zfsCollector) updateArcstats(ch chan<- prometheus.Metric) (err error) { + + cmd := exec.Command("sysctl", zfsArcstatsSysctl) + + err = c.RunOnStdout(cmd, func(stdout io.Reader) error { + return c.parseArcstatsSysctlOutput(stdout, func(sysctl zfsSysctl, value zfsMetricValue) { + ch <- c.ConstSysctlMetric(arc, sysctl, zfsMetricValue(value)) + }) + }) + return err + +} + +func (c *zfsCollector) parseArcstatsSysctlOutput(reader io.Reader, handler func(zfsSysctl, zfsMetricValue)) (err error) { + + // Decode values + scanner := bufio.NewScanner(reader) + for scanner.Scan() { + + fields := strings.Fields(scanner.Text()) + + if len(fields) != 2 || + !strings.HasPrefix(fields[0], zfsArcstatsSysctl) || + !strings.HasSuffix(fields[0], ":") { + + log.Debugf("Skipping line of unknown format: %q", scanner.Text()) + continue + + } + + sysctl := zfsSysctl(strings.TrimSuffix(fields[0], ":")) + value, err := strconv.Atoi(fields[1]) + if err != nil { + return err + } + + handler(sysctl, zfsMetricValue(value)) + } + return scanner.Err() + +} + +func (c *zfsCollector) updatePoolStats(ch chan<- prometheus.Metric) (err error) { + + poolProperties := []string{"size", "free", "allocated", "capacity", "dedupratio", "fragmentation"} + + cmd := exec.Command("zpool", "get", "-pH", strings.Join(poolProperties, ",")) + + err = c.RunOnStdout(cmd, func(stdout io.Reader) error { + return c.parseZpoolOutput(stdout, func(pool, name string, value float64) { + ch <- c.ConstZpoolMetric(pool, name, value) + }) + }) + + return err +} diff --git a/collector/zfs_freebsd_test.go b/collector/zfs_freebsd_test.go new file mode 100644 index 00000000..cad90eab --- /dev/null +++ b/collector/zfs_freebsd_test.go @@ -0,0 +1,44 @@ +package collector + +import ( + "os" + "testing" +) + +func TestArcstatsParsing(t *testing.T) { + + arcstatsOutput, err := os.Open("fixtures/sysctl/freebsd/kstat.zfs.misc.arcstats.txt") + if err != nil { + t.Fatal(err) + } + defer arcstatsOutput.Close() + + c := zfsCollector{} + if err != nil { + t.Fatal(err) + } + + handlerCalled := false + err = c.parseArcstatsSysctlOutput(arcstatsOutput, func(s zfsSysctl, v zfsMetricValue) { + + if s != zfsSysctl("kstat.zfs.misc.arcstats.hits") { + return + } + + handlerCalled = true + + if v != zfsMetricValue(63068289) { + t.Fatalf("Incorrect value parsed from sysctl output") + } + + }) + + if err != nil { + t.Fatal(err) + } + + if !handlerCalled { + t.Fatal("Arcstats parsing handler was not called for some expected sysctls") + } + +} diff --git a/collector/zfs_linux.go b/collector/zfs_linux.go new file mode 100644 index 00000000..0a1c10e1 --- /dev/null +++ b/collector/zfs_linux.go @@ -0,0 +1,88 @@ +package collector + +import ( + "bufio" + "errors" + "fmt" + "io" + "os" + "strconv" + "strings" + + "github.com/prometheus/client_golang/prometheus" + "github.com/prometheus/common/log" +) + +const ( + zfsArcstatsProcpath = "spl/kstat/zfs/arcstats" +) + +func (c *zfsCollector) zfsAvailable() (err error) { + file, err := c.openArcstatsFile() + if err != nil { + file.Close() + } + return err +} + +func (c *zfsCollector) openArcstatsFile() (file *os.File, err error) { + file, err = os.Open(procFilePath(zfsArcstatsProcpath)) + if err != nil { + log.Debugf("Cannot open %q for reading. Is the kernel module loaded?", procFilePath(zfsArcstatsProcpath)) + err = zfsNotAvailableError + } + return +} + +func (c *zfsCollector) updateArcstats(ch chan<- prometheus.Metric) (err error) { + + file, err := c.openArcstatsFile() + if err != nil { + return err + } + defer file.Close() + + return c.parseArcstatsProcfsFile(file, func(s zfsSysctl, v zfsMetricValue) { + ch <- c.ConstSysctlMetric(arc, s, v) + }) + +} + +func (c *zfsCollector) parseArcstatsProcfsFile(reader io.Reader, handler func(zfsSysctl, zfsMetricValue)) (err error) { + + scanner := bufio.NewScanner(reader) + + parseLine := false + for scanner.Scan() { + + parts := strings.Fields(scanner.Text()) + + if !parseLine && len(parts) == 3 && parts[0] == "name" && parts[1] == "type" && parts[2] == "data" { + // Start parsing from here. + parseLine = true + continue + } + + if !parseLine || len(parts) < 3 { + continue + } + + key := fmt.Sprintf("kstat.zfs.misc.arcstats.%s", parts[0]) + + value, err := strconv.Atoi(parts[2]) + if err != nil { + return fmt.Errorf("could not parse expected integer value for %q", key) + } + handler(zfsSysctl(key), zfsMetricValue(value)) + + } + if !parseLine { + return errors.New("did not parse a single arcstat metric") + } + + return scanner.Err() +} + +func (c *zfsCollector) updatePoolStats(ch chan<- prometheus.Metric) (err error) { + return nil +} diff --git a/collector/zfs_linux_test.go b/collector/zfs_linux_test.go new file mode 100644 index 00000000..2640ebac --- /dev/null +++ b/collector/zfs_linux_test.go @@ -0,0 +1,44 @@ +package collector + +import ( + "os" + "testing" +) + +func TestArcstatsParsing(t *testing.T) { + + arcstatsFile, err := os.Open("fixtures/proc/spl/kstat/zfs/arcstats") + if err != nil { + t.Fatal(err) + } + defer arcstatsFile.Close() + + c := zfsCollector{} + if err != nil { + t.Fatal(err) + } + + handlerCalled := false + err = c.parseArcstatsProcfsFile(arcstatsFile, func(s zfsSysctl, v zfsMetricValue) { + + if s != zfsSysctl("kstat.zfs.misc.arcstats.hits") { + return + } + + handlerCalled = true + + if v != zfsMetricValue(8772612) { + t.Fatalf("Incorrect value parsed from procfs data") + } + + }) + + if err != nil { + t.Fatal(err) + } + + if !handlerCalled { + t.Fatal("Arcstats parsing handler was not called for some expected sysctls") + } + +} diff --git a/collector/zfs_zpool.go b/collector/zfs_zpool.go new file mode 100644 index 00000000..8ebdba9a --- /dev/null +++ b/collector/zfs_zpool.go @@ -0,0 +1,41 @@ +package collector + +import ( + "bufio" + "fmt" + "io" + "strconv" + "strings" +) + +// zpool metrics + +func (c *zfsCollector) parseZpoolOutput(reader io.Reader, handler func(string, string, float64)) (err error) { + + scanner := bufio.NewScanner(reader) + for scanner.Scan() { + + fields := strings.Fields(scanner.Text()) + if len(fields) != 4 { + return fmt.Errorf("Unexpected output of zpool command") + } + + valueString := fields[2] + switch { + case strings.HasSuffix(fields[2], "%"): + percentage := strings.TrimSuffix(fields[2], "%") + valueString = "0." + percentage + case strings.HasSuffix(fields[2], "x"): + valueString = strings.TrimSuffix(fields[2], "x") + } + + value, err := strconv.ParseFloat(valueString, 64) + if err != nil { + return err + } + handler(fields[0], fields[1], value) + + } + return scanner.Err() + +} diff --git a/collector/zfs_zpool_test.go b/collector/zfs_zpool_test.go new file mode 100644 index 00000000..fd09babe --- /dev/null +++ b/collector/zfs_zpool_test.go @@ -0,0 +1,59 @@ +package collector + +import ( + "os" + "testing" +) + +func TestZpoolParsing(t *testing.T) { + + zpoolOutput, err := os.Open("fixtures/zfs/zpool_stats_stdout.txt") + if err != nil { + t.Fatal(err) + } + defer zpoolOutput.Close() + + c := zfsCollector{} + if err != nil { + t.Fatal(err) + } + + pools := make([]string, 2) + troutSize := float64(-1) + troutDedupratio := float64(-1) + zrootCapacity := float64(-1) + + err = c.parseZpoolOutput(zpoolOutput, func(pool, name string, value float64) { + pools = append(pools, pool) + if pool == "trout" && name == "size" { + troutSize = value + } + if pool == "trout" && name == "dedupratio" { + troutDedupratio = value + } + if pool == "zroot" && name == "capacity" { + zrootCapacity = value + } + }) + + if err != nil { + t.Fatal(err) + } + + if pools[0] == "trout" && pools[1] == "zroot" { + t.Fatal("Did not parse all pools in fixture") + } + + if troutSize != float64(4294967296) { + t.Fatal("Unexpected value for pool 'trout's size value") + } + + if troutDedupratio != float64(1.0) { + t.Fatal("Unexpected value for pool 'trout's dedupratio value") + } + + if zrootCapacity != float64(0.5) { + t.Fatal("Unexpected value for pool 'zroot's capacity value") + } + +} From c95bfa705edf1ed9e0b49e71a5c94e2c877bed10 Mon Sep 17 00:00:00 2001 From: Christian Schwarz Date: Sun, 13 Mar 2016 01:08:30 +0100 Subject: [PATCH 2/6] Enable ZFS exporter by default and update README. --- README.md | 2 +- node_exporter.go | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 7092a17c..ae9e4a54 100644 --- a/README.md +++ b/README.md @@ -34,7 +34,7 @@ stat | Exposes various statistics from `/proc/stat`. This includes CPU usage, bo textfile | Exposes statistics read from local disk. The `--collector.textfile.directory` flag must be set. | _any_ time | Exposes the current system time. | _any_ vmstat | Exposes statistics from `/proc/vmstat`. | Linux - +zfs | Exposes [ZFS](http://open-zfs.org/) performance statistics.
FreeBSD (ARC, zpool), Linux (ARC) | [FreeBSD](https://www.freebsd.org/doc/handbook/zfs.html), [Linux](http://zfsonlinux.org/) ### Disabled by default diff --git a/node_exporter.go b/node_exporter.go index 011199d7..e737232c 100644 --- a/node_exporter.go +++ b/node_exporter.go @@ -32,7 +32,7 @@ import ( ) const ( - defaultCollectors = "conntrack,cpu,diskstats,entropy,filefd,filesystem,hwmon,loadavg,mdadm,meminfo,netdev,netstat,sockstat,stat,textfile,time,uname,vmstat" + defaultCollectors = "conntrack,cpu,diskstats,entropy,filefd,filesystem,hwmon,loadavg,mdadm,meminfo,netdev,netstat,sockstat,stat,textfile,time,uname,vmstat,zfs" ) var ( From a8c94d48e66ade7e18de532c27f7adfc3f38e4ee Mon Sep 17 00:00:00 2001 From: Corey Stewart Date: Tue, 6 Dec 2016 14:22:26 -0500 Subject: [PATCH 3/6] Style changes and cleanup This patch makes stylistic changes to error strings, unexports method names by lower casing them, removes unused dataSetMetric, and adds copyright/licence information. Signed-Off-By: Corey Stewart --- README.md | 2 +- collector/zfs.go | 47 +++++++++++++++---------------------- collector/zfs_freebsd.go | 4 ++-- collector/zfs_linux.go | 26 ++++++++++---------- collector/zfs_linux_test.go | 15 ++++++++++-- collector/zfs_zpool.go | 17 +++++++++++--- collector/zfs_zpool_test.go | 15 ++++++++++-- 7 files changed, 76 insertions(+), 50 deletions(-) diff --git a/README.md b/README.md index ae9e4a54..ba0b74bb 100644 --- a/README.md +++ b/README.md @@ -34,7 +34,7 @@ stat | Exposes various statistics from `/proc/stat`. This includes CPU usage, bo textfile | Exposes statistics read from local disk. The `--collector.textfile.directory` flag must be set. | _any_ time | Exposes the current system time. | _any_ vmstat | Exposes statistics from `/proc/vmstat`. | Linux -zfs | Exposes [ZFS](http://open-zfs.org/) performance statistics.
FreeBSD (ARC, zpool), Linux (ARC) | [FreeBSD](https://www.freebsd.org/doc/handbook/zfs.html), [Linux](http://zfsonlinux.org/) +zfs | Exposes [ZFS](http://open-zfs.org/) performance statistics.
Linux (ARC) | [Linux](http://zfsonlinux.org/) ### Disabled by default diff --git a/collector/zfs.go b/collector/zfs.go index 9749a0b3..71e59eba 100644 --- a/collector/zfs.go +++ b/collector/zfs.go @@ -1,3 +1,16 @@ +// Copyright 2016 The Prometheus Authors +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package collector // +build linux freebsd @@ -33,11 +46,6 @@ type zfsMetric struct { sysctl zfsSysctl // The sysctl of the ZFS metric. } -type datasetMetric struct { - subsystem zfsSubsystemName - name string -} - // Collector func init() { @@ -53,8 +61,12 @@ func NewZFSCollector() (Collector, error) { } func (c *zfsCollector) Update(ch chan<- prometheus.Metric) (err error) { + // Arcstats + err = c.updateArcstats(ch) + if err != nil { + return err + } - err = c.zfsAvailable() switch { case err == zfsNotAvailableError: log.Debug(err) @@ -63,12 +75,6 @@ func (c *zfsCollector) Update(ch chan<- prometheus.Metric) (err error) { return err } - // Arcstats - err = c.updateArcstats(ch) - if err != nil { - return err - } - // Pool stats return c.updatePoolStats(ch) } @@ -78,8 +84,7 @@ func (s zfsSysctl) metricName() string { return parts[len(parts)-1] } -func (c *zfsCollector) ConstSysctlMetric(subsystem zfsSubsystemName, sysctl zfsSysctl, value zfsMetricValue) prometheus.Metric { - +func (c *zfsCollector) constSysctlMetric(subsystem zfsSubsystemName, sysctl zfsSysctl, value zfsMetricValue) prometheus.Metric { metricName := sysctl.metricName() return prometheus.MustNewConstMetric( @@ -93,17 +98,3 @@ func (c *zfsCollector) ConstSysctlMetric(subsystem zfsSubsystemName, sysctl zfsS float64(value), ) } - -func (c *zfsCollector) ConstZpoolMetric(pool, name string, value float64) prometheus.Metric { - return prometheus.MustNewConstMetric( - prometheus.NewDesc( - prometheus.BuildFQName(Namespace, string(zpoolSubsystem), name), - name, - []string{"pool"}, - nil, - ), - prometheus.UntypedValue, - float64(value), - pool, - ) -} diff --git a/collector/zfs_freebsd.go b/collector/zfs_freebsd.go index 9d344dc8..ed90a7e2 100644 --- a/collector/zfs_freebsd.go +++ b/collector/zfs_freebsd.go @@ -58,7 +58,7 @@ func (c *zfsCollector) updateArcstats(ch chan<- prometheus.Metric) (err error) { err = c.RunOnStdout(cmd, func(stdout io.Reader) error { return c.parseArcstatsSysctlOutput(stdout, func(sysctl zfsSysctl, value zfsMetricValue) { - ch <- c.ConstSysctlMetric(arc, sysctl, zfsMetricValue(value)) + ch <- c.constSysctlMetric(arc, sysctl, zfsMetricValue(value)) }) }) return err @@ -102,7 +102,7 @@ func (c *zfsCollector) updatePoolStats(ch chan<- prometheus.Metric) (err error) err = c.RunOnStdout(cmd, func(stdout io.Reader) error { return c.parseZpoolOutput(stdout, func(pool, name string, value float64) { - ch <- c.ConstZpoolMetric(pool, name, value) + ch <- c.constZpoolMetric(pool, name, value) }) }) diff --git a/collector/zfs_linux.go b/collector/zfs_linux.go index 0a1c10e1..17cfcaed 100644 --- a/collector/zfs_linux.go +++ b/collector/zfs_linux.go @@ -1,3 +1,16 @@ +// Copyright 2016 The Prometheus Authors +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package collector import ( @@ -17,14 +30,6 @@ const ( zfsArcstatsProcpath = "spl/kstat/zfs/arcstats" ) -func (c *zfsCollector) zfsAvailable() (err error) { - file, err := c.openArcstatsFile() - if err != nil { - file.Close() - } - return err -} - func (c *zfsCollector) openArcstatsFile() (file *os.File, err error) { file, err = os.Open(procFilePath(zfsArcstatsProcpath)) if err != nil { @@ -35,7 +40,6 @@ func (c *zfsCollector) openArcstatsFile() (file *os.File, err error) { } func (c *zfsCollector) updateArcstats(ch chan<- prometheus.Metric) (err error) { - file, err := c.openArcstatsFile() if err != nil { return err @@ -43,13 +47,11 @@ func (c *zfsCollector) updateArcstats(ch chan<- prometheus.Metric) (err error) { defer file.Close() return c.parseArcstatsProcfsFile(file, func(s zfsSysctl, v zfsMetricValue) { - ch <- c.ConstSysctlMetric(arc, s, v) + ch <- c.constSysctlMetric(arc, s, v) }) - } func (c *zfsCollector) parseArcstatsProcfsFile(reader io.Reader, handler func(zfsSysctl, zfsMetricValue)) (err error) { - scanner := bufio.NewScanner(reader) parseLine := false diff --git a/collector/zfs_linux_test.go b/collector/zfs_linux_test.go index 2640ebac..7583281d 100644 --- a/collector/zfs_linux_test.go +++ b/collector/zfs_linux_test.go @@ -1,3 +1,16 @@ +// Copyright 2016 The Prometheus Authors +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package collector import ( @@ -6,7 +19,6 @@ import ( ) func TestArcstatsParsing(t *testing.T) { - arcstatsFile, err := os.Open("fixtures/proc/spl/kstat/zfs/arcstats") if err != nil { t.Fatal(err) @@ -40,5 +52,4 @@ func TestArcstatsParsing(t *testing.T) { if !handlerCalled { t.Fatal("Arcstats parsing handler was not called for some expected sysctls") } - } diff --git a/collector/zfs_zpool.go b/collector/zfs_zpool.go index 8ebdba9a..a8dc36dd 100644 --- a/collector/zfs_zpool.go +++ b/collector/zfs_zpool.go @@ -1,3 +1,16 @@ +// Copyright 2016 The Prometheus Authors +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package collector import ( @@ -11,13 +24,12 @@ import ( // zpool metrics func (c *zfsCollector) parseZpoolOutput(reader io.Reader, handler func(string, string, float64)) (err error) { - scanner := bufio.NewScanner(reader) for scanner.Scan() { fields := strings.Fields(scanner.Text()) if len(fields) != 4 { - return fmt.Errorf("Unexpected output of zpool command") + return fmt.Errorf("unexpected output of zpool command") } valueString := fields[2] @@ -37,5 +49,4 @@ func (c *zfsCollector) parseZpoolOutput(reader io.Reader, handler func(string, s } return scanner.Err() - } diff --git a/collector/zfs_zpool_test.go b/collector/zfs_zpool_test.go index fd09babe..c5822f42 100644 --- a/collector/zfs_zpool_test.go +++ b/collector/zfs_zpool_test.go @@ -1,3 +1,16 @@ +// Copyright 2016 The Prometheus Authors +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package collector import ( @@ -6,7 +19,6 @@ import ( ) func TestZpoolParsing(t *testing.T) { - zpoolOutput, err := os.Open("fixtures/zfs/zpool_stats_stdout.txt") if err != nil { t.Fatal(err) @@ -55,5 +67,4 @@ func TestZpoolParsing(t *testing.T) { if zrootCapacity != float64(0.5) { t.Fatal("Unexpected value for pool 'zroot's capacity value") } - } From 10ba27bf2c6314ea42c140167cc6e069ac99bc8c Mon Sep 17 00:00:00 2001 From: Corey Stewart Date: Thu, 8 Dec 2016 10:06:53 -0500 Subject: [PATCH 4/6] Remove FreeBSD support for zfs plugin. This also involves removing zfs_zpool code for now. Signed-Off-By: Corey Stewart Signed-Off-By: Joe Handzik --- .../freebsd/kstat.zfs.misc.arcstats.txt | 78 ------------- collector/fixtures/zfs/zpool_stats_stdout.txt | 12 -- collector/zfs.go | 6 +- collector/zfs_freebsd.go | 110 ------------------ collector/zfs_freebsd_test.go | 44 ------- collector/zfs_zpool.go | 52 --------- collector/zfs_zpool_test.go | 70 ----------- 7 files changed, 3 insertions(+), 369 deletions(-) delete mode 100644 collector/fixtures/sysctl/freebsd/kstat.zfs.misc.arcstats.txt delete mode 100644 collector/fixtures/zfs/zpool_stats_stdout.txt delete mode 100644 collector/zfs_freebsd.go delete mode 100644 collector/zfs_freebsd_test.go delete mode 100644 collector/zfs_zpool.go delete mode 100644 collector/zfs_zpool_test.go diff --git a/collector/fixtures/sysctl/freebsd/kstat.zfs.misc.arcstats.txt b/collector/fixtures/sysctl/freebsd/kstat.zfs.misc.arcstats.txt deleted file mode 100644 index aaaf6503..00000000 --- a/collector/fixtures/sysctl/freebsd/kstat.zfs.misc.arcstats.txt +++ /dev/null @@ -1,78 +0,0 @@ -kstat.zfs.misc.arcstats.arc_meta_max: 1503210048 -kstat.zfs.misc.arcstats.arc_meta_limit: 393216000 -kstat.zfs.misc.arcstats.arc_meta_used: 392649848 -kstat.zfs.misc.arcstats.duplicate_reads: 0 -kstat.zfs.misc.arcstats.duplicate_buffers_size: 0 -kstat.zfs.misc.arcstats.duplicate_buffers: 0 -kstat.zfs.misc.arcstats.memory_throttle_count: 0 -kstat.zfs.misc.arcstats.l2_write_buffer_list_null_iter: 0 -kstat.zfs.misc.arcstats.l2_write_buffer_list_iter: 0 -kstat.zfs.misc.arcstats.l2_write_buffer_bytes_scanned: 0 -kstat.zfs.misc.arcstats.l2_write_pios: 0 -kstat.zfs.misc.arcstats.l2_write_buffer_iter: 0 -kstat.zfs.misc.arcstats.l2_write_full: 0 -kstat.zfs.misc.arcstats.l2_write_not_cacheable: 29425 -kstat.zfs.misc.arcstats.l2_write_io_in_progress: 0 -kstat.zfs.misc.arcstats.l2_write_in_l2: 0 -kstat.zfs.misc.arcstats.l2_write_spa_mismatch: 0 -kstat.zfs.misc.arcstats.l2_write_passed_headroom: 0 -kstat.zfs.misc.arcstats.l2_write_trylock_fail: 0 -kstat.zfs.misc.arcstats.l2_compress_failures: 0 -kstat.zfs.misc.arcstats.l2_compress_zeros: 0 -kstat.zfs.misc.arcstats.l2_compress_successes: 0 -kstat.zfs.misc.arcstats.l2_hdr_size: 0 -kstat.zfs.misc.arcstats.l2_asize: 0 -kstat.zfs.misc.arcstats.l2_size: 0 -kstat.zfs.misc.arcstats.l2_io_error: 0 -kstat.zfs.misc.arcstats.l2_cksum_bad: 0 -kstat.zfs.misc.arcstats.l2_abort_lowmem: 0 -kstat.zfs.misc.arcstats.l2_cdata_free_on_write: 0 -kstat.zfs.misc.arcstats.l2_free_on_write: 0 -kstat.zfs.misc.arcstats.l2_evict_reading: 0 -kstat.zfs.misc.arcstats.l2_evict_lock_retry: 0 -kstat.zfs.misc.arcstats.l2_writes_hdr_miss: 0 -kstat.zfs.misc.arcstats.l2_writes_error: 0 -kstat.zfs.misc.arcstats.l2_writes_done: 0 -kstat.zfs.misc.arcstats.l2_writes_sent: 0 -kstat.zfs.misc.arcstats.l2_write_bytes: 0 -kstat.zfs.misc.arcstats.l2_read_bytes: 0 -kstat.zfs.misc.arcstats.l2_rw_clash: 0 -kstat.zfs.misc.arcstats.l2_feeds: 0 -kstat.zfs.misc.arcstats.l2_misses: 0 -kstat.zfs.misc.arcstats.l2_hits: 0 -kstat.zfs.misc.arcstats.other_size: 166832272 -kstat.zfs.misc.arcstats.data_size: 1200779776 -kstat.zfs.misc.arcstats.hdr_size: 27244008 -kstat.zfs.misc.arcstats.size: 1394856056 -kstat.zfs.misc.arcstats.c_max: 1572864000 -kstat.zfs.misc.arcstats.c_min: 196608000 -kstat.zfs.misc.arcstats.c: 1470553736 -kstat.zfs.misc.arcstats.p: 665524427 -kstat.zfs.misc.arcstats.hash_chain_max: 7 -kstat.zfs.misc.arcstats.hash_chains: 14180 -kstat.zfs.misc.arcstats.hash_collisions: 2180398 -kstat.zfs.misc.arcstats.hash_elements_max: 238188 -kstat.zfs.misc.arcstats.hash_elements: 111458 -kstat.zfs.misc.arcstats.evict_l2_ineligible: 60262400 -kstat.zfs.misc.arcstats.evict_l2_eligible: 35702978560 -kstat.zfs.misc.arcstats.evict_l2_cached: 0 -kstat.zfs.misc.arcstats.evict_skip: 21716568 -kstat.zfs.misc.arcstats.mutex_miss: 873 -kstat.zfs.misc.arcstats.recycle_miss: 5018771 -kstat.zfs.misc.arcstats.stolen: 1327563 -kstat.zfs.misc.arcstats.deleted: 1187256 -kstat.zfs.misc.arcstats.allocated: 10150518 -kstat.zfs.misc.arcstats.mfu_ghost_hits: 1408986 -kstat.zfs.misc.arcstats.mfu_hits: 51952454 -kstat.zfs.misc.arcstats.mru_ghost_hits: 696819 -kstat.zfs.misc.arcstats.mru_hits: 11115835 -kstat.zfs.misc.arcstats.prefetch_metadata_misses: 32 -kstat.zfs.misc.arcstats.prefetch_metadata_hits: 2 -kstat.zfs.misc.arcstats.prefetch_data_misses: 0 -kstat.zfs.misc.arcstats.prefetch_data_hits: 0 -kstat.zfs.misc.arcstats.demand_metadata_misses: 9231542 -kstat.zfs.misc.arcstats.demand_metadata_hits: 40650947 -kstat.zfs.misc.arcstats.demand_data_misses: 75230 -kstat.zfs.misc.arcstats.demand_data_hits: 22417340 -kstat.zfs.misc.arcstats.misses: 9306804 -kstat.zfs.misc.arcstats.hits: 63068289 diff --git a/collector/fixtures/zfs/zpool_stats_stdout.txt b/collector/fixtures/zfs/zpool_stats_stdout.txt deleted file mode 100644 index 104e2d18..00000000 --- a/collector/fixtures/zfs/zpool_stats_stdout.txt +++ /dev/null @@ -1,12 +0,0 @@ -trout size 4294967296 - -trout free 1040117248 - -trout allocated 70144 - -trout capacity 0% - -trout dedupratio 1.00x - -trout fragmentation 0% - -zroot size 118111600640 - -zroot free 3990917120 - -zroot allocated 114120683520 - -zroot capacity 50% - -zroot dedupratio 1.00x - -zroot fragmentation 67% - diff --git a/collector/zfs.go b/collector/zfs.go index 71e59eba..b9c19536 100644 --- a/collector/zfs.go +++ b/collector/zfs.go @@ -11,11 +11,11 @@ // See the License for the specific language governing permissions and // limitations under the License. -package collector - -// +build linux freebsd +// +build linux // +build !nozfs +package collector + import ( "errors" "strings" diff --git a/collector/zfs_freebsd.go b/collector/zfs_freebsd.go deleted file mode 100644 index ed90a7e2..00000000 --- a/collector/zfs_freebsd.go +++ /dev/null @@ -1,110 +0,0 @@ -package collector - -import ( - "bufio" - "io" - "os/exec" - "strconv" - "strings" - - "github.com/prometheus/client_golang/prometheus" - "github.com/prometheus/common/log" -) - -/* -#cgo LDFLAGS: -#include -#include - -int zfsModuleLoaded() { - int modid = modfind("zfs"); - return modid < 0 ? 0 : -1; -} - -*/ -import "C" - -func (c *zfsCollector) zfsAvailable() error { - if C.zfsModuleLoaded() == 0 { - return zfsNotAvailableError - } - return nil -} - -const zfsArcstatsSysctl = "kstat.zfs.misc.arcstats" - -func (c *zfsCollector) RunOnStdout(cmd *exec.Cmd, handler func(io.Reader) error) (err error) { - - stdout, err := cmd.StdoutPipe() - if err != nil { - return - } - - if err = cmd.Start(); err != nil { - return - } - - err = handler(stdout) - if err != nil { - return - } - - return cmd.Wait() -} - -func (c *zfsCollector) updateArcstats(ch chan<- prometheus.Metric) (err error) { - - cmd := exec.Command("sysctl", zfsArcstatsSysctl) - - err = c.RunOnStdout(cmd, func(stdout io.Reader) error { - return c.parseArcstatsSysctlOutput(stdout, func(sysctl zfsSysctl, value zfsMetricValue) { - ch <- c.constSysctlMetric(arc, sysctl, zfsMetricValue(value)) - }) - }) - return err - -} - -func (c *zfsCollector) parseArcstatsSysctlOutput(reader io.Reader, handler func(zfsSysctl, zfsMetricValue)) (err error) { - - // Decode values - scanner := bufio.NewScanner(reader) - for scanner.Scan() { - - fields := strings.Fields(scanner.Text()) - - if len(fields) != 2 || - !strings.HasPrefix(fields[0], zfsArcstatsSysctl) || - !strings.HasSuffix(fields[0], ":") { - - log.Debugf("Skipping line of unknown format: %q", scanner.Text()) - continue - - } - - sysctl := zfsSysctl(strings.TrimSuffix(fields[0], ":")) - value, err := strconv.Atoi(fields[1]) - if err != nil { - return err - } - - handler(sysctl, zfsMetricValue(value)) - } - return scanner.Err() - -} - -func (c *zfsCollector) updatePoolStats(ch chan<- prometheus.Metric) (err error) { - - poolProperties := []string{"size", "free", "allocated", "capacity", "dedupratio", "fragmentation"} - - cmd := exec.Command("zpool", "get", "-pH", strings.Join(poolProperties, ",")) - - err = c.RunOnStdout(cmd, func(stdout io.Reader) error { - return c.parseZpoolOutput(stdout, func(pool, name string, value float64) { - ch <- c.constZpoolMetric(pool, name, value) - }) - }) - - return err -} diff --git a/collector/zfs_freebsd_test.go b/collector/zfs_freebsd_test.go deleted file mode 100644 index cad90eab..00000000 --- a/collector/zfs_freebsd_test.go +++ /dev/null @@ -1,44 +0,0 @@ -package collector - -import ( - "os" - "testing" -) - -func TestArcstatsParsing(t *testing.T) { - - arcstatsOutput, err := os.Open("fixtures/sysctl/freebsd/kstat.zfs.misc.arcstats.txt") - if err != nil { - t.Fatal(err) - } - defer arcstatsOutput.Close() - - c := zfsCollector{} - if err != nil { - t.Fatal(err) - } - - handlerCalled := false - err = c.parseArcstatsSysctlOutput(arcstatsOutput, func(s zfsSysctl, v zfsMetricValue) { - - if s != zfsSysctl("kstat.zfs.misc.arcstats.hits") { - return - } - - handlerCalled = true - - if v != zfsMetricValue(63068289) { - t.Fatalf("Incorrect value parsed from sysctl output") - } - - }) - - if err != nil { - t.Fatal(err) - } - - if !handlerCalled { - t.Fatal("Arcstats parsing handler was not called for some expected sysctls") - } - -} diff --git a/collector/zfs_zpool.go b/collector/zfs_zpool.go deleted file mode 100644 index a8dc36dd..00000000 --- a/collector/zfs_zpool.go +++ /dev/null @@ -1,52 +0,0 @@ -// Copyright 2016 The Prometheus Authors -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package collector - -import ( - "bufio" - "fmt" - "io" - "strconv" - "strings" -) - -// zpool metrics - -func (c *zfsCollector) parseZpoolOutput(reader io.Reader, handler func(string, string, float64)) (err error) { - scanner := bufio.NewScanner(reader) - for scanner.Scan() { - - fields := strings.Fields(scanner.Text()) - if len(fields) != 4 { - return fmt.Errorf("unexpected output of zpool command") - } - - valueString := fields[2] - switch { - case strings.HasSuffix(fields[2], "%"): - percentage := strings.TrimSuffix(fields[2], "%") - valueString = "0." + percentage - case strings.HasSuffix(fields[2], "x"): - valueString = strings.TrimSuffix(fields[2], "x") - } - - value, err := strconv.ParseFloat(valueString, 64) - if err != nil { - return err - } - handler(fields[0], fields[1], value) - - } - return scanner.Err() -} diff --git a/collector/zfs_zpool_test.go b/collector/zfs_zpool_test.go deleted file mode 100644 index c5822f42..00000000 --- a/collector/zfs_zpool_test.go +++ /dev/null @@ -1,70 +0,0 @@ -// Copyright 2016 The Prometheus Authors -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package collector - -import ( - "os" - "testing" -) - -func TestZpoolParsing(t *testing.T) { - zpoolOutput, err := os.Open("fixtures/zfs/zpool_stats_stdout.txt") - if err != nil { - t.Fatal(err) - } - defer zpoolOutput.Close() - - c := zfsCollector{} - if err != nil { - t.Fatal(err) - } - - pools := make([]string, 2) - troutSize := float64(-1) - troutDedupratio := float64(-1) - zrootCapacity := float64(-1) - - err = c.parseZpoolOutput(zpoolOutput, func(pool, name string, value float64) { - pools = append(pools, pool) - if pool == "trout" && name == "size" { - troutSize = value - } - if pool == "trout" && name == "dedupratio" { - troutDedupratio = value - } - if pool == "zroot" && name == "capacity" { - zrootCapacity = value - } - }) - - if err != nil { - t.Fatal(err) - } - - if pools[0] == "trout" && pools[1] == "zroot" { - t.Fatal("Did not parse all pools in fixture") - } - - if troutSize != float64(4294967296) { - t.Fatal("Unexpected value for pool 'trout's size value") - } - - if troutDedupratio != float64(1.0) { - t.Fatal("Unexpected value for pool 'trout's dedupratio value") - } - - if zrootCapacity != float64(0.5) { - t.Fatal("Unexpected value for pool 'zroot's capacity value") - } -} From e7442d651725d0cfdea850319b9c76bdbf790693 Mon Sep 17 00:00:00 2001 From: Joe Handzik Date: Sun, 8 Jan 2017 10:17:06 -0600 Subject: [PATCH 5/6] end-to-end-test.sh: Add zfs plugin Enables fixture test and updates e2e-output.txt. Signed-Off-By: Joe Handzik --- collector/fixtures/e2e-output.txt | 273 ++++++++++++++++++++++++++++++ end-to-end-test.sh | 1 + 2 files changed, 274 insertions(+) diff --git a/collector/fixtures/e2e-output.txt b/collector/fixtures/e2e-output.txt index b1e65d5d..08a7e744 100644 --- a/collector/fixtures/e2e-output.txt +++ b/collector/fixtures/e2e-output.txt @@ -1934,6 +1934,279 @@ node_sockstat_sockets_used 229 # HELP node_textfile_scrape_error 1 if there was an error opening or reading a file, 0 otherwise # TYPE node_textfile_scrape_error gauge node_textfile_scrape_error 0 +# HELP node_zfsArc_anon_evictable_data kstat.zfs.misc.arcstats.anon_evictable_data +# TYPE node_zfsArc_anon_evictable_data untyped +node_zfsArc_anon_evictable_data 0 +# HELP node_zfsArc_anon_evictable_metadata kstat.zfs.misc.arcstats.anon_evictable_metadata +# TYPE node_zfsArc_anon_evictable_metadata untyped +node_zfsArc_anon_evictable_metadata 0 +# HELP node_zfsArc_anon_size kstat.zfs.misc.arcstats.anon_size +# TYPE node_zfsArc_anon_size untyped +node_zfsArc_anon_size 1.91744e+06 +# HELP node_zfsArc_arc_loaned_bytes kstat.zfs.misc.arcstats.arc_loaned_bytes +# TYPE node_zfsArc_arc_loaned_bytes untyped +node_zfsArc_arc_loaned_bytes 0 +# HELP node_zfsArc_arc_meta_limit kstat.zfs.misc.arcstats.arc_meta_limit +# TYPE node_zfsArc_arc_meta_limit untyped +node_zfsArc_arc_meta_limit 6.275982336e+09 +# HELP node_zfsArc_arc_meta_max kstat.zfs.misc.arcstats.arc_meta_max +# TYPE node_zfsArc_arc_meta_max untyped +node_zfsArc_arc_meta_max 4.49286096e+08 +# HELP node_zfsArc_arc_meta_min kstat.zfs.misc.arcstats.arc_meta_min +# TYPE node_zfsArc_arc_meta_min untyped +node_zfsArc_arc_meta_min 1.6777216e+07 +# HELP node_zfsArc_arc_meta_used kstat.zfs.misc.arcstats.arc_meta_used +# TYPE node_zfsArc_arc_meta_used untyped +node_zfsArc_arc_meta_used 3.08103632e+08 +# HELP node_zfsArc_arc_need_free kstat.zfs.misc.arcstats.arc_need_free +# TYPE node_zfsArc_arc_need_free untyped +node_zfsArc_arc_need_free 0 +# HELP node_zfsArc_arc_no_grow kstat.zfs.misc.arcstats.arc_no_grow +# TYPE node_zfsArc_arc_no_grow untyped +node_zfsArc_arc_no_grow 0 +# HELP node_zfsArc_arc_prune kstat.zfs.misc.arcstats.arc_prune +# TYPE node_zfsArc_arc_prune untyped +node_zfsArc_arc_prune 0 +# HELP node_zfsArc_arc_sys_free kstat.zfs.misc.arcstats.arc_sys_free +# TYPE node_zfsArc_arc_sys_free untyped +node_zfsArc_arc_sys_free 2.61496832e+08 +# HELP node_zfsArc_arc_tempreserve kstat.zfs.misc.arcstats.arc_tempreserve +# TYPE node_zfsArc_arc_tempreserve untyped +node_zfsArc_arc_tempreserve 0 +# HELP node_zfsArc_c kstat.zfs.misc.arcstats.c +# TYPE node_zfsArc_c untyped +node_zfsArc_c 1.643208777e+09 +# HELP node_zfsArc_c_max kstat.zfs.misc.arcstats.c_max +# TYPE node_zfsArc_c_max untyped +node_zfsArc_c_max 8.367976448e+09 +# HELP node_zfsArc_c_min kstat.zfs.misc.arcstats.c_min +# TYPE node_zfsArc_c_min untyped +node_zfsArc_c_min 3.3554432e+07 +# HELP node_zfsArc_data_size kstat.zfs.misc.arcstats.data_size +# TYPE node_zfsArc_data_size untyped +node_zfsArc_data_size 1.29583616e+09 +# HELP node_zfsArc_deleted kstat.zfs.misc.arcstats.deleted +# TYPE node_zfsArc_deleted untyped +node_zfsArc_deleted 60403 +# HELP node_zfsArc_demand_data_hits kstat.zfs.misc.arcstats.demand_data_hits +# TYPE node_zfsArc_demand_data_hits untyped +node_zfsArc_demand_data_hits 7.221032e+06 +# HELP node_zfsArc_demand_data_misses kstat.zfs.misc.arcstats.demand_data_misses +# TYPE node_zfsArc_demand_data_misses untyped +node_zfsArc_demand_data_misses 73300 +# HELP node_zfsArc_demand_metadata_hits kstat.zfs.misc.arcstats.demand_metadata_hits +# TYPE node_zfsArc_demand_metadata_hits untyped +node_zfsArc_demand_metadata_hits 1.464353e+06 +# HELP node_zfsArc_demand_metadata_misses kstat.zfs.misc.arcstats.demand_metadata_misses +# TYPE node_zfsArc_demand_metadata_misses untyped +node_zfsArc_demand_metadata_misses 498170 +# HELP node_zfsArc_duplicate_buffers kstat.zfs.misc.arcstats.duplicate_buffers +# TYPE node_zfsArc_duplicate_buffers untyped +node_zfsArc_duplicate_buffers 0 +# HELP node_zfsArc_duplicate_buffers_size kstat.zfs.misc.arcstats.duplicate_buffers_size +# TYPE node_zfsArc_duplicate_buffers_size untyped +node_zfsArc_duplicate_buffers_size 0 +# HELP node_zfsArc_duplicate_reads kstat.zfs.misc.arcstats.duplicate_reads +# TYPE node_zfsArc_duplicate_reads untyped +node_zfsArc_duplicate_reads 0 +# HELP node_zfsArc_evict_l2_cached kstat.zfs.misc.arcstats.evict_l2_cached +# TYPE node_zfsArc_evict_l2_cached untyped +node_zfsArc_evict_l2_cached 0 +# HELP node_zfsArc_evict_l2_eligible kstat.zfs.misc.arcstats.evict_l2_eligible +# TYPE node_zfsArc_evict_l2_eligible untyped +node_zfsArc_evict_l2_eligible 8.99251456e+09 +# HELP node_zfsArc_evict_l2_ineligible kstat.zfs.misc.arcstats.evict_l2_ineligible +# TYPE node_zfsArc_evict_l2_ineligible untyped +node_zfsArc_evict_l2_ineligible 9.92552448e+08 +# HELP node_zfsArc_evict_l2_skip kstat.zfs.misc.arcstats.evict_l2_skip +# TYPE node_zfsArc_evict_l2_skip untyped +node_zfsArc_evict_l2_skip 0 +# HELP node_zfsArc_evict_not_enough kstat.zfs.misc.arcstats.evict_not_enough +# TYPE node_zfsArc_evict_not_enough untyped +node_zfsArc_evict_not_enough 680 +# HELP node_zfsArc_evict_skip kstat.zfs.misc.arcstats.evict_skip +# TYPE node_zfsArc_evict_skip untyped +node_zfsArc_evict_skip 2.265729e+06 +# HELP node_zfsArc_hash_chain_max kstat.zfs.misc.arcstats.hash_chain_max +# TYPE node_zfsArc_hash_chain_max untyped +node_zfsArc_hash_chain_max 3 +# HELP node_zfsArc_hash_chains kstat.zfs.misc.arcstats.hash_chains +# TYPE node_zfsArc_hash_chains untyped +node_zfsArc_hash_chains 412 +# HELP node_zfsArc_hash_collisions kstat.zfs.misc.arcstats.hash_collisions +# TYPE node_zfsArc_hash_collisions untyped +node_zfsArc_hash_collisions 50564 +# HELP node_zfsArc_hash_elements kstat.zfs.misc.arcstats.hash_elements +# TYPE node_zfsArc_hash_elements untyped +node_zfsArc_hash_elements 42359 +# HELP node_zfsArc_hash_elements_max kstat.zfs.misc.arcstats.hash_elements_max +# TYPE node_zfsArc_hash_elements_max untyped +node_zfsArc_hash_elements_max 88245 +# HELP node_zfsArc_hdr_size kstat.zfs.misc.arcstats.hdr_size +# TYPE node_zfsArc_hdr_size untyped +node_zfsArc_hdr_size 1.636108e+07 +# HELP node_zfsArc_hits kstat.zfs.misc.arcstats.hits +# TYPE node_zfsArc_hits untyped +node_zfsArc_hits 8.772612e+06 +# HELP node_zfsArc_l2_abort_lowmem kstat.zfs.misc.arcstats.l2_abort_lowmem +# TYPE node_zfsArc_l2_abort_lowmem untyped +node_zfsArc_l2_abort_lowmem 0 +# HELP node_zfsArc_l2_asize kstat.zfs.misc.arcstats.l2_asize +# TYPE node_zfsArc_l2_asize untyped +node_zfsArc_l2_asize 0 +# HELP node_zfsArc_l2_cdata_free_on_write kstat.zfs.misc.arcstats.l2_cdata_free_on_write +# TYPE node_zfsArc_l2_cdata_free_on_write untyped +node_zfsArc_l2_cdata_free_on_write 0 +# HELP node_zfsArc_l2_cksum_bad kstat.zfs.misc.arcstats.l2_cksum_bad +# TYPE node_zfsArc_l2_cksum_bad untyped +node_zfsArc_l2_cksum_bad 0 +# HELP node_zfsArc_l2_compress_failures kstat.zfs.misc.arcstats.l2_compress_failures +# TYPE node_zfsArc_l2_compress_failures untyped +node_zfsArc_l2_compress_failures 0 +# HELP node_zfsArc_l2_compress_successes kstat.zfs.misc.arcstats.l2_compress_successes +# TYPE node_zfsArc_l2_compress_successes untyped +node_zfsArc_l2_compress_successes 0 +# HELP node_zfsArc_l2_compress_zeros kstat.zfs.misc.arcstats.l2_compress_zeros +# TYPE node_zfsArc_l2_compress_zeros untyped +node_zfsArc_l2_compress_zeros 0 +# HELP node_zfsArc_l2_evict_l1cached kstat.zfs.misc.arcstats.l2_evict_l1cached +# TYPE node_zfsArc_l2_evict_l1cached untyped +node_zfsArc_l2_evict_l1cached 0 +# HELP node_zfsArc_l2_evict_lock_retry kstat.zfs.misc.arcstats.l2_evict_lock_retry +# TYPE node_zfsArc_l2_evict_lock_retry untyped +node_zfsArc_l2_evict_lock_retry 0 +# HELP node_zfsArc_l2_evict_reading kstat.zfs.misc.arcstats.l2_evict_reading +# TYPE node_zfsArc_l2_evict_reading untyped +node_zfsArc_l2_evict_reading 0 +# HELP node_zfsArc_l2_feeds kstat.zfs.misc.arcstats.l2_feeds +# TYPE node_zfsArc_l2_feeds untyped +node_zfsArc_l2_feeds 0 +# HELP node_zfsArc_l2_free_on_write kstat.zfs.misc.arcstats.l2_free_on_write +# TYPE node_zfsArc_l2_free_on_write untyped +node_zfsArc_l2_free_on_write 0 +# HELP node_zfsArc_l2_hdr_size kstat.zfs.misc.arcstats.l2_hdr_size +# TYPE node_zfsArc_l2_hdr_size untyped +node_zfsArc_l2_hdr_size 0 +# HELP node_zfsArc_l2_hits kstat.zfs.misc.arcstats.l2_hits +# TYPE node_zfsArc_l2_hits untyped +node_zfsArc_l2_hits 0 +# HELP node_zfsArc_l2_io_error kstat.zfs.misc.arcstats.l2_io_error +# TYPE node_zfsArc_l2_io_error untyped +node_zfsArc_l2_io_error 0 +# HELP node_zfsArc_l2_misses kstat.zfs.misc.arcstats.l2_misses +# TYPE node_zfsArc_l2_misses untyped +node_zfsArc_l2_misses 0 +# HELP node_zfsArc_l2_read_bytes kstat.zfs.misc.arcstats.l2_read_bytes +# TYPE node_zfsArc_l2_read_bytes untyped +node_zfsArc_l2_read_bytes 0 +# HELP node_zfsArc_l2_rw_clash kstat.zfs.misc.arcstats.l2_rw_clash +# TYPE node_zfsArc_l2_rw_clash untyped +node_zfsArc_l2_rw_clash 0 +# HELP node_zfsArc_l2_size kstat.zfs.misc.arcstats.l2_size +# TYPE node_zfsArc_l2_size untyped +node_zfsArc_l2_size 0 +# HELP node_zfsArc_l2_write_bytes kstat.zfs.misc.arcstats.l2_write_bytes +# TYPE node_zfsArc_l2_write_bytes untyped +node_zfsArc_l2_write_bytes 0 +# HELP node_zfsArc_l2_writes_done kstat.zfs.misc.arcstats.l2_writes_done +# TYPE node_zfsArc_l2_writes_done untyped +node_zfsArc_l2_writes_done 0 +# HELP node_zfsArc_l2_writes_error kstat.zfs.misc.arcstats.l2_writes_error +# TYPE node_zfsArc_l2_writes_error untyped +node_zfsArc_l2_writes_error 0 +# HELP node_zfsArc_l2_writes_lock_retry kstat.zfs.misc.arcstats.l2_writes_lock_retry +# TYPE node_zfsArc_l2_writes_lock_retry untyped +node_zfsArc_l2_writes_lock_retry 0 +# HELP node_zfsArc_l2_writes_sent kstat.zfs.misc.arcstats.l2_writes_sent +# TYPE node_zfsArc_l2_writes_sent untyped +node_zfsArc_l2_writes_sent 0 +# HELP node_zfsArc_memory_direct_count kstat.zfs.misc.arcstats.memory_direct_count +# TYPE node_zfsArc_memory_direct_count untyped +node_zfsArc_memory_direct_count 542 +# HELP node_zfsArc_memory_indirect_count kstat.zfs.misc.arcstats.memory_indirect_count +# TYPE node_zfsArc_memory_indirect_count untyped +node_zfsArc_memory_indirect_count 3006 +# HELP node_zfsArc_memory_throttle_count kstat.zfs.misc.arcstats.memory_throttle_count +# TYPE node_zfsArc_memory_throttle_count untyped +node_zfsArc_memory_throttle_count 0 +# HELP node_zfsArc_metadata_size kstat.zfs.misc.arcstats.metadata_size +# TYPE node_zfsArc_metadata_size untyped +node_zfsArc_metadata_size 1.7529856e+08 +# HELP node_zfsArc_mfu_evictable_data kstat.zfs.misc.arcstats.mfu_evictable_data +# TYPE node_zfsArc_mfu_evictable_data untyped +node_zfsArc_mfu_evictable_data 1.017613824e+09 +# HELP node_zfsArc_mfu_evictable_metadata kstat.zfs.misc.arcstats.mfu_evictable_metadata +# TYPE node_zfsArc_mfu_evictable_metadata untyped +node_zfsArc_mfu_evictable_metadata 9.163776e+06 +# HELP node_zfsArc_mfu_ghost_evictable_data kstat.zfs.misc.arcstats.mfu_ghost_evictable_data +# TYPE node_zfsArc_mfu_ghost_evictable_data untyped +node_zfsArc_mfu_ghost_evictable_data 9.6731136e+07 +# HELP node_zfsArc_mfu_ghost_evictable_metadata kstat.zfs.misc.arcstats.mfu_ghost_evictable_metadata +# TYPE node_zfsArc_mfu_ghost_evictable_metadata untyped +node_zfsArc_mfu_ghost_evictable_metadata 8.205312e+06 +# HELP node_zfsArc_mfu_ghost_hits kstat.zfs.misc.arcstats.mfu_ghost_hits +# TYPE node_zfsArc_mfu_ghost_hits untyped +node_zfsArc_mfu_ghost_hits 821 +# HELP node_zfsArc_mfu_ghost_size kstat.zfs.misc.arcstats.mfu_ghost_size +# TYPE node_zfsArc_mfu_ghost_size untyped +node_zfsArc_mfu_ghost_size 1.04936448e+08 +# HELP node_zfsArc_mfu_hits kstat.zfs.misc.arcstats.mfu_hits +# TYPE node_zfsArc_mfu_hits untyped +node_zfsArc_mfu_hits 7.829854e+06 +# HELP node_zfsArc_mfu_size kstat.zfs.misc.arcstats.mfu_size +# TYPE node_zfsArc_mfu_size untyped +node_zfsArc_mfu_size 1.066623488e+09 +# HELP node_zfsArc_misses kstat.zfs.misc.arcstats.misses +# TYPE node_zfsArc_misses untyped +node_zfsArc_misses 604635 +# HELP node_zfsArc_mru_evictable_data kstat.zfs.misc.arcstats.mru_evictable_data +# TYPE node_zfsArc_mru_evictable_data untyped +node_zfsArc_mru_evictable_data 2.78091264e+08 +# HELP node_zfsArc_mru_evictable_metadata kstat.zfs.misc.arcstats.mru_evictable_metadata +# TYPE node_zfsArc_mru_evictable_metadata untyped +node_zfsArc_mru_evictable_metadata 1.8606592e+07 +# HELP node_zfsArc_mru_ghost_evictable_data kstat.zfs.misc.arcstats.mru_ghost_evictable_data +# TYPE node_zfsArc_mru_ghost_evictable_data untyped +node_zfsArc_mru_ghost_evictable_data 8.83765248e+08 +# HELP node_zfsArc_mru_ghost_evictable_metadata kstat.zfs.misc.arcstats.mru_ghost_evictable_metadata +# TYPE node_zfsArc_mru_ghost_evictable_metadata untyped +node_zfsArc_mru_ghost_evictable_metadata 1.1596288e+08 +# HELP node_zfsArc_mru_ghost_hits kstat.zfs.misc.arcstats.mru_ghost_hits +# TYPE node_zfsArc_mru_ghost_hits untyped +node_zfsArc_mru_ghost_hits 21100 +# HELP node_zfsArc_mru_ghost_size kstat.zfs.misc.arcstats.mru_ghost_size +# TYPE node_zfsArc_mru_ghost_size untyped +node_zfsArc_mru_ghost_size 9.99728128e+08 +# HELP node_zfsArc_mru_hits kstat.zfs.misc.arcstats.mru_hits +# TYPE node_zfsArc_mru_hits untyped +node_zfsArc_mru_hits 855535 +# HELP node_zfsArc_mru_size kstat.zfs.misc.arcstats.mru_size +# TYPE node_zfsArc_mru_size untyped +node_zfsArc_mru_size 4.02593792e+08 +# HELP node_zfsArc_mutex_miss kstat.zfs.misc.arcstats.mutex_miss +# TYPE node_zfsArc_mutex_miss untyped +node_zfsArc_mutex_miss 2 +# HELP node_zfsArc_other_size kstat.zfs.misc.arcstats.other_size +# TYPE node_zfsArc_other_size untyped +node_zfsArc_other_size 1.16443992e+08 +# HELP node_zfsArc_p kstat.zfs.misc.arcstats.p +# TYPE node_zfsArc_p untyped +node_zfsArc_p 5.16395305e+08 +# HELP node_zfsArc_prefetch_data_hits kstat.zfs.misc.arcstats.prefetch_data_hits +# TYPE node_zfsArc_prefetch_data_hits untyped +node_zfsArc_prefetch_data_hits 3615 +# HELP node_zfsArc_prefetch_data_misses kstat.zfs.misc.arcstats.prefetch_data_misses +# TYPE node_zfsArc_prefetch_data_misses untyped +node_zfsArc_prefetch_data_misses 17094 +# HELP node_zfsArc_prefetch_metadata_hits kstat.zfs.misc.arcstats.prefetch_metadata_hits +# TYPE node_zfsArc_prefetch_metadata_hits untyped +node_zfsArc_prefetch_metadata_hits 83612 +# HELP node_zfsArc_prefetch_metadata_misses kstat.zfs.misc.arcstats.prefetch_metadata_misses +# TYPE node_zfsArc_prefetch_metadata_misses untyped +node_zfsArc_prefetch_metadata_misses 16071 +# HELP node_zfsArc_size kstat.zfs.misc.arcstats.size +# TYPE node_zfsArc_size untyped +node_zfsArc_size 1.603939792e+09 # HELP process_cpu_seconds_total Total user and system CPU time spent in seconds. # TYPE process_cpu_seconds_total counter # HELP process_max_fds Maximum number of open file descriptors. diff --git a/end-to-end-test.sh b/end-to-end-test.sh index 5c17e75b..fe2061af 100755 --- a/end-to-end-test.sh +++ b/end-to-end-test.sh @@ -23,6 +23,7 @@ collectors=$(cat << COLLECTORS textfile bonding megacli + zfs COLLECTORS ) cd "$(dirname $0)" From dd3e1d62835841da1d3a996fa633c4f4e796c70e Mon Sep 17 00:00:00 2001 From: Joe Handzik Date: Sun, 8 Jan 2017 10:48:31 -0600 Subject: [PATCH 6/6] AUTHORS.md: Update authors from ZFS plugin commit Signed-Off-By: Joe Handzik --- AUTHORS.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/AUTHORS.md b/AUTHORS.md index bc6c4c16..030d6171 100644 --- a/AUTHORS.md +++ b/AUTHORS.md @@ -15,6 +15,8 @@ The following individuals have contributed code to this repository * Benjamin Staffin * Björn Rabenstein * Brian Brazil +* Christian Schwarz +* Corey Stewart * Daniel Speichert * Ed Schouten * Eric Ripa @@ -23,6 +25,7 @@ The following individuals have contributed code to this repository * Ian Hansen * Ilia Choly * Jari Takkala +* Joe Handzik * Johannes 'fish' Ziemke * Jonas Große Sundrup * Julius Volz