Do not export smart_status if object is not present

Signed-off-by: Deezzir <deezzir@gmail.com>
This commit is contained in:
Deezzir 2024-12-19 21:13:06 -05:00
parent 7489f4f7aa
commit 2c2b4aa970
No known key found for this signature in database
GPG key ID: BC9F5289FAC4E96A

View file

@ -468,13 +468,17 @@ func (smart *SMARTctl) mineSCSIBytesWritten() {
}
func (smart *SMARTctl) mineSmartStatus() {
passed_raw := smart.json.Get("smart_status.passed")
if passed_raw.Exists() {
smart.ch <- prometheus.MustNewConstMetric(
metricDeviceSmartStatus,
prometheus.GaugeValue,
smart.json.Get("smart_status.passed").Float(),
passed_raw.Float(),
smart.device.device,
)
}
}
func (smart *SMARTctl) mineDeviceStatistics() {
for _, page := range smart.json.Get("ata_device_statistics.pages").Array() {