|
|
@ -1,4 +1,4 @@ |
|
|
|
// Copyright 2016 The Prometheus Authors
|
|
|
|
// Copyright 2017 The Prometheus Authors
|
|
|
|
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
|
|
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
|
|
// you may not use this file except in compliance with the License.
|
|
|
|
// you may not use this file except in compliance with the License.
|
|
|
|
// You may obtain a copy of the License at
|
|
|
|
// You may obtain a copy of the License at
|
|
|
@ -15,8 +15,10 @@ package collector |
|
|
|
|
|
|
|
|
|
|
|
import ( |
|
|
|
import ( |
|
|
|
"fmt" |
|
|
|
"fmt" |
|
|
|
|
|
|
|
"sort" |
|
|
|
|
|
|
|
|
|
|
|
"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" |
|
|
|
) |
|
|
|
) |
|
|
|
|
|
|
|
|
|
|
@ -493,6 +495,7 @@ func (c *mountStatsCollector) Update(ch chan<- prometheus.Metric) error { |
|
|
|
if err != nil { |
|
|
|
if err != nil { |
|
|
|
return fmt.Errorf("failed to parse mountstats: %v", err) |
|
|
|
return fmt.Errorf("failed to parse mountstats: %v", err) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
var deviceList []string |
|
|
|
|
|
|
|
|
|
|
|
for _, m := range mounts { |
|
|
|
for _, m := range mounts { |
|
|
|
// For the time being, only NFS statistics are available via this mechanism
|
|
|
|
// For the time being, only NFS statistics are available via this mechanism
|
|
|
@ -501,7 +504,14 @@ func (c *mountStatsCollector) Update(ch chan<- prometheus.Metric) error { |
|
|
|
continue |
|
|
|
continue |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
c.updateNFSStats(ch, m.Device, stats) |
|
|
|
sort.Strings(deviceList) |
|
|
|
|
|
|
|
i := sort.SearchStrings(deviceList, m.Device) |
|
|
|
|
|
|
|
if i < len(deviceList) && deviceList[i] == m.Device { |
|
|
|
|
|
|
|
log.Debugf("Skipping duplicate device entry %q", m.Device) |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
deviceList = append(deviceList, m.Device) |
|
|
|
|
|
|
|
c.updateNFSStats(ch, m.Device, stats) |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
return nil |
|
|
|
return nil |
|
|
|