Merge pull request #505 from roclark/fix-no-infiniband-files
Skip metric files that don't existpull/507/head
commit
d92dc8cabe
|
@ -18,6 +18,7 @@ package collector
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"errors"
|
"errors"
|
||||||
|
"os"
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
|
|
||||||
"github.com/prometheus/client_golang/prometheus"
|
"github.com/prometheus/client_golang/prometheus"
|
||||||
|
@ -158,6 +159,9 @@ func (c *infinibandCollector) Update(ch chan<- prometheus.Metric) error {
|
||||||
|
|
||||||
// Add metrics for the InfiniBand counters.
|
// Add metrics for the InfiniBand counters.
|
||||||
for metricName, infinibandMetric := range c.counters {
|
for metricName, infinibandMetric := range c.counters {
|
||||||
|
if _, err := os.Stat(filepath.Join(portFiles, "counters", infinibandMetric.File)); os.IsNotExist(err) {
|
||||||
|
continue
|
||||||
|
}
|
||||||
metric, err := readMetric(filepath.Join(portFiles, "counters"), infinibandMetric.File)
|
metric, err := readMetric(filepath.Join(portFiles, "counters"), infinibandMetric.File)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
|
|
Loading…
Reference in New Issue