Browse Source

Fix error output in nfsd collector. (#821)

pull/822/merge
Ben Kochie 7 years ago committed by GitHub
parent
commit
05eabe60fb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 6
      collector/nfsd_linux.go

6
collector/nfsd_linux.go

@ -15,8 +15,10 @@ package collector
import ( import (
"fmt" "fmt"
"os"
"github.com/prometheus/client_golang/prometheus" "github.com/prometheus/client_golang/prometheus"
"github.com/prometheus/common/log"
"github.com/prometheus/procfs" "github.com/prometheus/procfs"
"github.com/prometheus/procfs/nfs" "github.com/prometheus/procfs/nfs"
) )
@ -57,6 +59,10 @@ func NewNFSdCollector() (Collector, error) {
func (c *nfsdCollector) Update(ch chan<- prometheus.Metric) error { func (c *nfsdCollector) Update(ch chan<- prometheus.Metric) error {
stats, err := c.fs.NFSdServerRPCStats() stats, err := c.fs.NFSdServerRPCStats()
if err != nil { 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) return fmt.Errorf("failed to retrieve nfsd stats: %v", err)
} }

Loading…
Cancel
Save