Skip to content

Commit

Permalink
implement for other unix
Browse files Browse the repository at this point in the history
  • Loading branch information
stanaka committed Jan 29, 2016
1 parent d11264b commit 1a843bd
Show file tree
Hide file tree
Showing 6 changed files with 15 additions and 3 deletions.
2 changes: 1 addition & 1 deletion command/command_darwin.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ func metricsGenerators(conf *config.Config) []metrics.Generator {
&metricsDarwin.CPUUsageGenerator{},
&metricsDarwin.MemoryGenerator{},
&metricsDarwin.SwapGenerator{},
&metricsDarwin.FilesystemGenerator{},
&metricsDarwin.FilesystemGenerator{Ignore: conf.Filesystems.Ignore},
&metricsDarwin.InterfaceGenerator{Interval: metricsInterval},
}

Expand Down
2 changes: 1 addition & 1 deletion command/command_freebsd.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ func metricsGenerators(conf *config.Config) []metrics.Generator {
generators := []metrics.Generator{
&metricsFreebsd.Loadavg5Generator{},
&metricsFreebsd.CPUUsageGenerator{},
&metricsFreebsd.FilesystemGenerator{},
&metricsFreebsd.FilesystemGenerator{Ignore: conf.Filesystems.Ignore},
&metricsFreebsd.MemoryGenerator{},
}

Expand Down
2 changes: 1 addition & 1 deletion command/command_netbsd.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ func metricsGenerators(conf *config.Config) []metrics.Generator {
generators := []metrics.Generator{
&metricsNetbsd.Loadavg5Generator{},
&metricsNetbsd.CPUUsageGenerator{},
&metricsNetbsd.FilesystemGenerator{},
&metricsNetbsd.FilesystemGenerator{Ignore: conf.Filesystems.Ignore},
&metricsNetbsd.MemoryGenerator{},
}

Expand Down
4 changes: 4 additions & 0 deletions metrics/darwin/filesystem.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import (

// FilesystemGenerator XXX
type FilesystemGenerator struct {
Ignore string
}

var logger = logging.GetLogger("metrics.filesystem")
Expand All @@ -30,6 +31,9 @@ func (g *FilesystemGenerator) Generate() (metrics.Values, error) {

ret := make(map[string]float64)
for name, values := range filesystems {
if g.Ignore != "" && regexp.MustCompile(g.Ignore).FindStringSubmatch(name) != nil {
continue
}
if matches := regexp.MustCompile(`^/dev/(.*)$`).FindStringSubmatch(name); matches != nil {
device := regexp.MustCompile(`[^A-Za-z0-9_-]`).ReplaceAllString(matches[1], "_")
for key, value := range values {
Expand Down
4 changes: 4 additions & 0 deletions metrics/freebsd/filesystem.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import (

// FilesystemGenerator XXX
type FilesystemGenerator struct {
Ignore string
}

var logger = logging.GetLogger("metrics.filesystem")
Expand All @@ -30,6 +31,9 @@ func (g *FilesystemGenerator) Generate() (metrics.Values, error) {

ret := make(map[string]float64)
for name, values := range filesystems {
if g.Ignore != "" && regexp.MustCompile(g.Ignore).FindStringSubmatch(name) != nil {
continue
}
if matches := regexp.MustCompile(`^/dev/(.*)$`).FindStringSubmatch(name); matches != nil {
device := regexp.MustCompile(`[^A-Za-z0-9_-]`).ReplaceAllString(matches[1], "_")
for key, value := range values {
Expand Down
4 changes: 4 additions & 0 deletions metrics/netbsd/filesystem.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import (

// FilesystemGenerator XXX
type FilesystemGenerator struct {
Ignore string
}

var logger = logging.GetLogger("metrics.filesystem")
Expand All @@ -30,6 +31,9 @@ func (g *FilesystemGenerator) Generate() (metrics.Values, error) {

ret := make(map[string]float64)
for name, values := range filesystems {
if g.Ignore != "" && regexp.MustCompile(g.Ignore).FindStringSubmatch(name) != nil {
continue
}
if matches := regexp.MustCompile(`^/dev/(.*)$`).FindStringSubmatch(name); matches != nil {
device := regexp.MustCompile(`[^A-Za-z0-9_-]`).ReplaceAllString(matches[1], "_")
for key, value := range values {
Expand Down

0 comments on commit 1a843bd

Please sign in to comment.