Skip to content

Commit

Permalink
Add log
Browse files Browse the repository at this point in the history
  • Loading branch information
Enzo Hamelin committed Nov 25, 2020
1 parent 1a1539a commit dc49e7a
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
5 changes: 5 additions & 0 deletions plugins/inputs/zfs/zfs.go
@@ -1,5 +1,9 @@
package zfs

import (
"github.com/influxdata/telegraf"
)

type Sysctl func(metric string) ([]string, error)
type Zpool func() ([]string, error)
type Zdataset func(properties []string) ([]string, error)
Expand All @@ -12,6 +16,7 @@ type Zfs struct {
sysctl Sysctl
zpool Zpool
zdataset Zdataset
Log telegraf.Logger `toml:"-"`
}

var sampleConfig = `
Expand Down
3 changes: 2 additions & 1 deletion plugins/inputs/zfs/zfs_freebsd.go
Expand Up @@ -106,6 +106,7 @@ func (z *Zfs) gatherDatasetStats(acc telegraf.Accumulator) (string, error) {
for _, line := range lines {
col := strings.Split(line, "\t")
if len(col) != len(properties) {
z.Log.Warnf("Invalid number of columns for line: %s", line)
continue
}

Expand Down Expand Up @@ -183,7 +184,7 @@ func zpool() ([]string, error) {
}

func zdataset(properties []string) ([]string, error) {
return run("zfs", []string{"list", "-Hp", "-o", strings.join(properties, ',')}...)
return run("zfs", []string{"list", "-Hp", "-o", strings.Join(properties, ',')}...)
}

func sysctl(metric string) ([]string, error) {
Expand Down

0 comments on commit dc49e7a

Please sign in to comment.