started working on notifications.
This commit is contained in:
@@ -10,6 +10,9 @@ import (
|
|||||||
const SmartWhenFailedFailingNow = "FAILING_NOW"
|
const SmartWhenFailedFailingNow = "FAILING_NOW"
|
||||||
const SmartWhenFailedInThePast = "IN_THE_PAST"
|
const SmartWhenFailedInThePast = "IN_THE_PAST"
|
||||||
|
|
||||||
|
const SmartStatusPassed = "passed"
|
||||||
|
const SmartStatusFailed = "failed"
|
||||||
|
|
||||||
type Smart struct {
|
type Smart struct {
|
||||||
gorm.Model
|
gorm.Model
|
||||||
|
|
||||||
@@ -17,7 +20,7 @@ type Smart struct {
|
|||||||
Device Device `json:"-" gorm:"foreignkey:DeviceWWN"` // use DeviceWWN as foreign key
|
Device Device `json:"-" gorm:"foreignkey:DeviceWWN"` // use DeviceWWN as foreign key
|
||||||
|
|
||||||
TestDate time.Time `json:"date"`
|
TestDate time.Time `json:"date"`
|
||||||
SmartStatus string `json:"smart_status"`
|
SmartStatus string `json:"smart_status"` // SmartStatusPassed or SmartStatusFailed
|
||||||
|
|
||||||
//Metrics
|
//Metrics
|
||||||
Temp int64 `json:"temp"`
|
Temp int64 `json:"temp"`
|
||||||
@@ -49,9 +52,9 @@ func (sm *Smart) FromCollectorSmartInfo(wwn string, info collector.SmartInfo) er
|
|||||||
}
|
}
|
||||||
|
|
||||||
if info.SmartStatus.Passed {
|
if info.SmartStatus.Passed {
|
||||||
sm.SmartStatus = "passed"
|
sm.SmartStatus = SmartStatusPassed
|
||||||
} else {
|
} else {
|
||||||
sm.SmartStatus = "failed"
|
sm.SmartStatus = SmartStatusFailed
|
||||||
}
|
}
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user