add 4 more suggested smart values
This commit is contained in:
		| @@ -33,7 +33,7 @@ func getDiskInfo(diskpath string) *DiskInfo { | |||||||
| type Item struct { | type Item struct { | ||||||
| 	Name string `json:"name"` | 	Name string `json:"name"` | ||||||
| 	Raw  struct { | 	Raw  struct { | ||||||
| 		Value uint64 `json:"value"` | 		Value int64 `json:"value"` | ||||||
| 	} `json:"raw"` | 	} `json:"raw"` | ||||||
| } | } | ||||||
|  |  | ||||||
| @@ -88,6 +88,13 @@ func checkSmartAttributes(diskpath string, isSeagate bool, isHdd bool) { | |||||||
| 	fmt.Println("Raw_Read_Error_Rate: " + evalStrZero(rrerrrate)) | 	fmt.Println("Raw_Read_Error_Rate: " + evalStrZero(rrerrrate)) | ||||||
| 	fmt.Println("Reallocated_Sector_Ct: " + evalStrZero(getItemValue(rawattr.AtaSmartAttr.Table, "Reallocated_Sector_Ct"))) | 	fmt.Println("Reallocated_Sector_Ct: " + evalStrZero(getItemValue(rawattr.AtaSmartAttr.Table, "Reallocated_Sector_Ct"))) | ||||||
|  |  | ||||||
|  | 	// todo further investigate if this smart attributes can occur within hdds/ssds | ||||||
|  | 	// https://www.backblaze.com/blog/what-smart-stats-indicate-hard-drive-failures/ | ||||||
|  | 	fmt.Println("Reported_Uncorrect: " + evalStrZero(getItemValue(rawattr.AtaSmartAttr.Table, "Reported_Uncorrect"))) | ||||||
|  | 	fmt.Println("Command_Timeout: " + evalStrZero(getItemValue(rawattr.AtaSmartAttr.Table, "Command_Timeout"))) | ||||||
|  | 	fmt.Println("Current_Pending_Sector: " + evalStrZero(getItemValue(rawattr.AtaSmartAttr.Table, "Current_Pending_Sector"))) | ||||||
|  | 	fmt.Println("Offline_Uncorrectable: " + evalStrZero(getItemValue(rawattr.AtaSmartAttr.Table, "Offline_Uncorrectable"))) | ||||||
|  |  | ||||||
| 	// there are some additinoal hdd smart values | 	// there are some additinoal hdd smart values | ||||||
| 	if isHdd { | 	if isHdd { | ||||||
| 		rrerrrate = getItemValue(rawattr.AtaSmartAttr.Table, "Seek_Error_Rate") | 		rrerrrate = getItemValue(rawattr.AtaSmartAttr.Table, "Seek_Error_Rate") | ||||||
| @@ -102,19 +109,21 @@ func checkSmartAttributes(diskpath string, isSeagate bool, isHdd bool) { | |||||||
| 	} | 	} | ||||||
| } | } | ||||||
|  |  | ||||||
| func evalStrZero(nr uint64) string { | func evalStrZero(nr int64) string { | ||||||
| 	if nr == 0 { | 	if nr < 0 { | ||||||
|  | 		return "N/A" | ||||||
|  | 	} else if nr == 0 { | ||||||
| 		return "\tPASS" | 		return "\tPASS" | ||||||
| 	} else { | 	} else { | ||||||
| 		return fmt.Sprintf("\tFAIL :: raw value=%d", nr) | 		return fmt.Sprintf("\tFAIL :: raw value=%d", nr) | ||||||
| 	} | 	} | ||||||
| } | } | ||||||
|  |  | ||||||
| func getItemValue(arr []Item, name string) uint64 { | func getItemValue(arr []Item, name string) int64 { | ||||||
| 	for i := range arr { | 	for i := range arr { | ||||||
| 		if arr[i].Name == name { | 		if arr[i].Name == name { | ||||||
| 			return arr[i].Raw.Value | 			return arr[i].Raw.Value | ||||||
| 		} | 		} | ||||||
| 	} | 	} | ||||||
| 	return 0 | 	return -1 | ||||||
| } | } | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user