|
@@ -85,7 +85,7 @@ func parseRAIDInfo(output string) *RAIDInfo {
|
|
|
updateTime, _ := time.Parse(time.ANSIC, updateTimeStr)
|
|
|
raidInfo.UpdateTime = updateTime
|
|
|
case "State":
|
|
|
- raidInfo.State = fields[2]
|
|
|
+ raidInfo.State = strings.Join(fields[2:], " ")
|
|
|
case "Active":
|
|
|
raidInfo.ActiveDevices, _ = strconv.Atoi(fields[3])
|
|
|
case "Working":
|
|
@@ -103,10 +103,21 @@ func parseRAIDInfo(output string) *RAIDInfo {
|
|
|
case "Events":
|
|
|
raidInfo.Events, _ = strconv.Atoi(fields[2])
|
|
|
default:
|
|
|
- if len(fields) >= 6 && fields[0] != "Number" {
|
|
|
+ if len(fields) >= 5 && fields[0] != "Number" {
|
|
|
deviceInfo := DeviceInfo{}
|
|
|
- deviceInfo.State = fields[4 : len(fields)-1]
|
|
|
- deviceInfo.DevicePath = fields[len(fields)-1]
|
|
|
+
|
|
|
+ if len(fields) > 5 {
|
|
|
+ //Only active disks have fields > 5, e.g.
|
|
|
+ // 0 8 16 0 active sync /dev/sdb
|
|
|
+ deviceInfo.State = fields[4 : len(fields)-1]
|
|
|
+ deviceInfo.DevicePath = fields[len(fields)-1]
|
|
|
+ } else {
|
|
|
+ //Failed disk, e.g.
|
|
|
+ // - 0 0 1 removed
|
|
|
+ deviceInfo.State = fields[4:]
|
|
|
+ //TODO: Add custom tags
|
|
|
+ }
|
|
|
+
|
|
|
raidInfo.DeviceInfo = append(raidInfo.DeviceInfo, deviceInfo)
|
|
|
}
|
|
|
}
|