// Generate XXX func (g *FilesystemGenerator) Generate() (metrics.Values, error) { filesystems, err := windows.CollectFilesystemValues() if err != nil { return nil, err } ret := make(map[string]float64) for name, values := range filesystems { if matches := regexp.MustCompile(`^(.*):`).FindStringSubmatch(name); matches != nil { device := regexp.MustCompile(`[^A-Za-z0-9_-]`).ReplaceAllString(matches[1], "_") ret["filesystem."+device+".size"] = values.KbSize * 1024 ret["filesystem."+device+".used"] = values.KbUsed * 1024 } } logger.Debugf("%q", ret) return metrics.Values(ret), nil }
// Generate XXX func (g *FilesystemGenerator) Generate() (interface{}, error) { ret := make(map[string]map[string]interface{}) fileSystems, err := windows.CollectFilesystemValues() for drive, f := range fileSystems { ret[drive] = map[string]interface{}{ "percent_used": f.PercentUsed, "kb_used": f.KbUsed, "kb_size": f.KbSize, "kb_available": f.KbAvailable, "mount": f.Mount, "label": f.Label, "volume_name": f.VolumeName, "fs_type": f.FsType, } } return ret, err }