mirror of
https://github.com/prometheus-community/smartctl_exporter.git
synced 2024-12-21 02:21:55 +01:00
Do not export smart_status if object is not present
Signed-off-by: Deezzir <deezzir@gmail.com>
This commit is contained in:
parent
7489f4f7aa
commit
2c2b4aa970
1 changed files with 10 additions and 6 deletions
|
@ -468,12 +468,16 @@ func (smart *SMARTctl) mineSCSIBytesWritten() {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (smart *SMARTctl) mineSmartStatus() {
|
func (smart *SMARTctl) mineSmartStatus() {
|
||||||
|
passed_raw := smart.json.Get("smart_status.passed")
|
||||||
|
|
||||||
|
if passed_raw.Exists() {
|
||||||
smart.ch <- prometheus.MustNewConstMetric(
|
smart.ch <- prometheus.MustNewConstMetric(
|
||||||
metricDeviceSmartStatus,
|
metricDeviceSmartStatus,
|
||||||
prometheus.GaugeValue,
|
prometheus.GaugeValue,
|
||||||
smart.json.Get("smart_status.passed").Float(),
|
passed_raw.Float(),
|
||||||
smart.device.device,
|
smart.device.device,
|
||||||
)
|
)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (smart *SMARTctl) mineDeviceStatistics() {
|
func (smart *SMARTctl) mineDeviceStatistics() {
|
||||||
|
|
Loading…
Reference in a new issue