From 36291d456e0c125e06d17a467a37932cfba4cec5 Mon Sep 17 00:00:00 2001 From: Kevin Lyda Date: Sun, 18 Oct 2015 19:47:45 +0100 Subject: [PATCH] Make filesystem collector more robust. Current behaviour throws away all stats on any Statfs error. In practice this is not useful. This turns such errors into debug log messages - though silently ignoring them seems even more valid to me. --- collector/filesystem_linux.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/collector/filesystem_linux.go b/collector/filesystem_linux.go index bf13df3f..2ba9faf5 100644 --- a/collector/filesystem_linux.go +++ b/collector/filesystem_linux.go @@ -17,7 +17,6 @@ package collector import ( "bufio" - "fmt" "os" "strings" "syscall" @@ -54,8 +53,9 @@ func (c *filesystemCollector) GetStats() (stats []filesystemStats, err error) { buf := new(syscall.Statfs_t) err := syscall.Statfs(mpd.mountPoint, buf) if err != nil { - return nil, fmt.Errorf("Statfs on %s returned %s", + log.Debugf("Statfs on %s returned %s", mpd.mountPoint, err) + continue } labelValues := []string{mpd.device, mpd.mountPoint, mpd.fsType}