diff options
author | Johannes 'fish' Ziemke <github@freigeist.org> | 2017-01-03 15:55:40 +0100 |
---|---|---|
committer | Johannes 'fish' Ziemke <github@freigeist.org> | 2017-01-04 16:45:25 +0100 |
commit | 4c9131b7d8131a10dbaebffea9af0c7bb6f0a8a7 (patch) | |
tree | c45c900971b926a7ad9135b4701452c4e6ccf228 /collector/filesystem_bsd.go | |
parent | 26c6182c8452b6a5990586e744695a1b5bc5fc54 (diff) | |
download | prometheus_node_collector-4c9131b7d8131a10dbaebffea9af0c7bb6f0a8a7.tar.bz2 prometheus_node_collector-4c9131b7d8131a10dbaebffea9af0c7bb6f0a8a7.tar.xz prometheus_node_collector-4c9131b7d8131a10dbaebffea9af0c7bb6f0a8a7.zip |
Make sure we only return one metric per mounted fs
Diffstat (limited to 'collector/filesystem_bsd.go')
-rw-r--r-- | collector/filesystem_bsd.go | 19 |
1 files changed, 11 insertions, 8 deletions
diff --git a/collector/filesystem_bsd.go b/collector/filesystem_bsd.go index 7a98161..e7eebac 100644 --- a/collector/filesystem_bsd.go +++ b/collector/filesystem_bsd.go | |||
@@ -66,15 +66,18 @@ func (c *filesystemCollector) GetStats() (stats []filesystemStats, err error) { | |||
66 | ro = 1 | 66 | ro = 1 |
67 | } | 67 | } |
68 | 68 | ||
69 | labelValues := []string{device, mountpoint, fstype} | ||
70 | stats = append(stats, filesystemStats{ | 69 | stats = append(stats, filesystemStats{ |
71 | labelValues: labelValues, | 70 | labels: filesystemLabels{ |
72 | size: float64(mnt[i].f_blocks) * float64(mnt[i].f_bsize), | 71 | device: device, |
73 | free: float64(mnt[i].f_bfree) * float64(mnt[i].f_bsize), | 72 | mountPoint: mountpoint, |
74 | avail: float64(mnt[i].f_bavail) * float64(mnt[i].f_bsize), | 73 | fsType: fstype, |
75 | files: float64(mnt[i].f_files), | 74 | }, |
76 | filesFree: float64(mnt[i].f_ffree), | 75 | size: float64(mnt[i].f_blocks) * float64(mnt[i].f_bsize), |
77 | ro: ro, | 76 | free: float64(mnt[i].f_bfree) * float64(mnt[i].f_bsize), |
77 | avail: float64(mnt[i].f_bavail) * float64(mnt[i].f_bsize), | ||
78 | files: float64(mnt[i].f_files), | ||
79 | filesFree: float64(mnt[i].f_ffree), | ||
80 | ro: ro, | ||
78 | }) | 81 | }) |
79 | } | 82 | } |
80 | return stats, nil | 83 | return stats, nil |