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,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() {
|
||||
|
|
Loading…
Reference in a new issue