From 05eabe60fb8995909782b221cac5d156edaf445f Mon Sep 17 00:00:00 2001 From: Ben Kochie Date: Wed, 14 Feb 2018 13:57:35 +0100 Subject: [PATCH] Fix error output in nfsd collector. (#821) --- collector/nfsd_linux.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/collector/nfsd_linux.go b/collector/nfsd_linux.go index f4974460..d1d28c26 100644 --- a/collector/nfsd_linux.go +++ b/collector/nfsd_linux.go @@ -15,8 +15,10 @@ package collector import ( "fmt" + "os" "github.com/prometheus/client_golang/prometheus" + "github.com/prometheus/common/log" "github.com/prometheus/procfs" "github.com/prometheus/procfs/nfs" ) @@ -57,6 +59,10 @@ func NewNFSdCollector() (Collector, error) { func (c *nfsdCollector) Update(ch chan<- prometheus.Metric) error { stats, err := c.fs.NFSdServerRPCStats() if err != nil { + if os.IsNotExist(err) { + log.Debugf("Not collecting NFSd metrics: %s", err) + return nil + } return fmt.Errorf("failed to retrieve nfsd stats: %v", err) }