44
55package memory
66
7+ import (
8+ "strings"
9+ )
10+
711import "github.com/MauveSoftware/ilo_exporter/pkg/common"
812
13+ type Oem struct {
14+ HPE HPEMemStatus `json:"Hpe"`
15+ }
16+
17+ type HPEMemStatus struct {
18+ Attributes []string `json:"Attributes"`
19+ BaseModuleType string `json:"BaseModuleType"`
20+ DIMMManufacturingDate string `json:"DIMMManufacturingDate"`
21+ DIMMStatus string `json:"DIMMStatus"` // "GoodInUse"
22+ MaxOperatingSpeedMTs uint `json:"MaxOperatingSpeedMTs"`
23+ MinimumVoltageVoltsX10 uint `json:"MinimumVoltageVoltsX10"`
24+ PartNumber string `json:"PartNumber"`
25+ VendorName string `json:"VendorName"`
26+ }
27+
28+ func (s * HPEMemStatus ) HealthValue () float64 {
29+ if s .DIMMStatus == "GoodInUse" {
30+ return 1
31+ }
32+
33+ return 0
34+ }
35+
36+ type MemoryStatus struct {}
37+
938type MemoryDIMM struct {
1039 Name string `json:"Name"`
40+ Oem Oem `json:"Oem"`
1141 StatusCurrent common.Status `json:"Status"`
1242 StatusLegacy string `json:"DIMMStatus"`
1343 SizeMBCurrent uint64 `json:"CapacityMiB"`
@@ -31,15 +61,20 @@ func (m *MemoryDIMM) IsValid() bool {
3161 return m .StatusLegacy != "Unknown"
3262 }
3363
34- return len (m .StatusCurrent .State ) > 0
64+ return len (m .StatusCurrent .State ) > 0 || len ( m . Oem . HPE . DIMMStatus ) > 0
3565}
3666
3767func (m * MemoryDIMM ) HealthValue () float64 {
3868 if m .isLegacy () {
3969 return m .legacyHealthValue ()
4070 }
4171
42- return m .StatusCurrent .HealthValue ()
72+ val := m .StatusCurrent .HealthValue ()
73+ if val > 0 {
74+ return val
75+ }
76+
77+ return m .Oem .HPE .HealthValue ()
4378}
4479
4580func (m * MemoryDIMM ) SizeMB () uint64 {
0 commit comments