Fix error output in nfsd collector. (#821)

This commit is contained in:
Ben Kochie 2018-02-14 13:57:35 +01:00 committed by GitHub
parent dcb31670d6
commit 05eabe60fb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 6 additions and 0 deletions

View File

@ -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)
}