mirror of
https://github.com/prometheus/node_exporter.git
synced 2024-12-27 06:29:50 -08:00
Move RO status before error return
Signed-off-by: Metbog <metbog@gmail.com>
This commit is contained in:
parent
f34aaa6109
commit
e387997e4c
|
@ -186,6 +186,11 @@ func (c *filesystemCollector) Update(ch chan<- prometheus.Metric) error {
|
|||
c.deviceErrorDesc, prometheus.GaugeValue,
|
||||
s.deviceError, s.labels.device, s.labels.mountPoint, s.labels.fsType,
|
||||
)
|
||||
ch <- prometheus.MustNewConstMetric(
|
||||
c.roDesc, prometheus.GaugeValue,
|
||||
s.ro, s.labels.device, s.labels.mountPoint, s.labels.fsType,
|
||||
)
|
||||
|
||||
if s.deviceError > 0 {
|
||||
continue
|
||||
}
|
||||
|
@ -210,10 +215,6 @@ func (c *filesystemCollector) Update(ch chan<- prometheus.Metric) error {
|
|||
c.filesFreeDesc, prometheus.GaugeValue,
|
||||
s.filesFree, s.labels.device, s.labels.mountPoint, s.labels.fsType,
|
||||
)
|
||||
ch <- prometheus.MustNewConstMetric(
|
||||
c.roDesc, prometheus.GaugeValue,
|
||||
s.ro, s.labels.device, s.labels.mountPoint, s.labels.fsType,
|
||||
)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
|
|
@ -109,6 +109,14 @@ func (c *filesystemCollector) GetStats() ([]filesystemStats, error) {
|
|||
}
|
||||
|
||||
func (c *filesystemCollector) processStat(labels filesystemLabels) filesystemStats {
|
||||
var ro float64
|
||||
for _, option := range strings.Split(labels.options, ",") {
|
||||
if option == "ro" {
|
||||
ro = 1
|
||||
break
|
||||
}
|
||||
}
|
||||
|
||||
success := make(chan struct{})
|
||||
go stuckMountWatcher(labels.mountPoint, success, c.logger)
|
||||
|
||||
|
@ -129,16 +137,10 @@ func (c *filesystemCollector) processStat(labels filesystemLabels) filesystemSta
|
|||
return filesystemStats{
|
||||
labels: labels,
|
||||
deviceError: 1,
|
||||
ro: ro,
|
||||
}
|
||||
}
|
||||
|
||||
var ro float64
|
||||
for _, option := range strings.Split(labels.options, ",") {
|
||||
if option == "ro" {
|
||||
ro = 1
|
||||
break
|
||||
}
|
||||
}
|
||||
return filesystemStats{
|
||||
labels: labels,
|
||||
size: float64(buf.Blocks) * float64(buf.Bsize),
|
||||
|
|
Loading…
Reference in a new issue