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
16
smartctl.go
16
smartctl.go
|
@ -468,12 +468,16 @@ func (smart *SMARTctl) mineSCSIBytesWritten() {
|
|||
}
|
||||
|
||||
func (smart *SMARTctl) mineSmartStatus() {
|
||||
smart.ch <- prometheus.MustNewConstMetric(
|
||||
metricDeviceSmartStatus,
|
||||
prometheus.GaugeValue,
|
||||
smart.json.Get("smart_status.passed").Float(),
|
||||
smart.device.device,
|
||||
)
|
||||
passed_raw := smart.json.Get("smart_status.passed")
|
||||
|
||||
if passed_raw.Exists() {
|
||||
smart.ch <- prometheus.MustNewConstMetric(
|
||||
metricDeviceSmartStatus,
|
||||
prometheus.GaugeValue,
|
||||
passed_raw.Float(),
|
||||
smart.device.device,
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
func (smart *SMARTctl) mineDeviceStatistics() {
|
||||
|
|
Loading…
Reference in a new issue