|
|
@ -177,7 +177,10 @@ func (c *drbdCollector) Update(ch chan<- prometheus.Metric) (err error) {
|
|
|
|
device = fmt.Sprintf("drbd%d", id)
|
|
|
|
device = fmt.Sprintf("drbd%d", id)
|
|
|
|
} else if metric, ok := drbdNumericalMetrics[kv[0]]; ok {
|
|
|
|
} else if metric, ok := drbdNumericalMetrics[kv[0]]; ok {
|
|
|
|
// Numerical value.
|
|
|
|
// Numerical value.
|
|
|
|
value, _ := strconv.ParseFloat(kv[1], 64)
|
|
|
|
value, err := strconv.ParseFloat(kv[1], 64)
|
|
|
|
|
|
|
|
if err != nil {
|
|
|
|
|
|
|
|
return err
|
|
|
|
|
|
|
|
}
|
|
|
|
ch <- prometheus.MustNewConstMetric(
|
|
|
|
ch <- prometheus.MustNewConstMetric(
|
|
|
|
metric.desc, metric.valueType,
|
|
|
|
metric.desc, metric.valueType,
|
|
|
|
value*metric.multiplier, device)
|
|
|
|
value*metric.multiplier, device)
|
|
|
@ -199,7 +202,6 @@ func (c *drbdCollector) Update(ch chan<- prometheus.Metric) (err error) {
|
|
|
|
ch <- prometheus.MustNewConstMetric(
|
|
|
|
ch <- prometheus.MustNewConstMetric(
|
|
|
|
drbdConnected, prometheus.GaugeValue,
|
|
|
|
drbdConnected, prometheus.GaugeValue,
|
|
|
|
connected, device)
|
|
|
|
connected, device)
|
|
|
|
|
|
|
|
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
log.Infof("Don't know how to process key-value pair [%s: %s]", kv[0], kv[1])
|
|
|
|
log.Infof("Don't know how to process key-value pair [%s: %s]", kv[0], kv[1])
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -207,5 +209,5 @@ func (c *drbdCollector) Update(ch chan<- prometheus.Metric) (err error) {
|
|
|
|
log.Infof("Don't know how to process string %s", field)
|
|
|
|
log.Infof("Don't know how to process string %s", field)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return nil
|
|
|
|
return scanner.Err()
|
|
|
|
}
|
|
|
|
}
|
|
|
|