structure.go 7.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217
  1. package smart
  2. // DevicesList was used for storing the disk scanning result
  3. type DevicesList struct {
  4. /*
  5. JSONFormatVersion []int `json:"json_format_version"`
  6. Smartctl struct {
  7. Version []int `json:"version"`
  8. SvnRevision string `json:"svn_revision"`
  9. PlatformInfo string `json:"platform_info"`
  10. BuildInfo string `json:"build_info"`
  11. Argv []string `json:"argv"`
  12. Messages []struct {
  13. String string `json:"string"`
  14. Severity string `json:"severity"`
  15. } `json:"messages"`
  16. ExitStatus int `json:"exit_status"`
  17. } `json:"smartctl"`
  18. */
  19. Devices []struct {
  20. Name string `json:"name"`
  21. InfoName string `json:"info_name"`
  22. Type string `json:"type"`
  23. Protocol string `json:"protocol"`
  24. Smart DeviceSMART `json:"smart"`
  25. } `json:"devices"`
  26. }
  27. // DeviceSMART was used for storing each disk smart information
  28. type DeviceSMART struct {
  29. /*
  30. JSONFormatVersion []int `json:"json_format_version"`
  31. Smartctl struct {
  32. Version []int `json:"version"`
  33. SvnRevision string `json:"svn_revision"`
  34. PlatformInfo string `json:"platform_info"`
  35. BuildInfo string `json:"build_info"`
  36. Argv []string `json:"argv"`
  37. Messages []struct {
  38. String string `json:"string"`
  39. Severity string `json:"severity"`
  40. } `json:"messages"`
  41. ExitStatus int `json:"exit_status"`
  42. } `json:"smartctl"`
  43. */
  44. /*
  45. Device struct {
  46. Name string `json:"name"`
  47. InfoName string `json:"info_name"`
  48. Type string `json:"type"`
  49. Protocol string `json:"protocol"`
  50. } `json:"device"`
  51. */
  52. ModelFamily string `json:"model_family"`
  53. ModelName string `json:"model_name"`
  54. SerialNumber string `json:"serial_number"`
  55. /*
  56. Wwn struct {
  57. Naa int `json:"naa"`
  58. Oui int `json:"oui"`
  59. ID int64 `json:"id"`
  60. } `json:"wwn"`
  61. */
  62. FirmwareVersion string `json:"firmware_version"`
  63. UserCapacity struct {
  64. Blocks int `json:"blocks"`
  65. Bytes int64 `json:"bytes"`
  66. } `json:"user_capacity"`
  67. LogicalBlockSize int `json:"logical_block_size"`
  68. PhysicalBlockSize int `json:"physical_block_size"`
  69. RotationRate int `json:"rotation_rate"`
  70. InSmartctlDatabase bool `json:"in_smartctl_database"`
  71. AtaVersion struct {
  72. String string `json:"string"`
  73. MajorValue int `json:"major_value"`
  74. MinorValue int `json:"minor_value"`
  75. } `json:"ata_version"`
  76. SataVersion struct {
  77. String string `json:"string"`
  78. Value int `json:"value"`
  79. } `json:"sata_version"`
  80. InterfaceSpeed struct {
  81. Max struct {
  82. SataValue int `json:"sata_value"`
  83. String string `json:"string"`
  84. UnitsPerSecond int `json:"units_per_second"`
  85. BitsPerUnit int `json:"bits_per_unit"`
  86. } `json:"max"`
  87. Current struct {
  88. SataValue int `json:"sata_value"`
  89. String string `json:"string"`
  90. UnitsPerSecond int `json:"units_per_second"`
  91. BitsPerUnit int `json:"bits_per_unit"`
  92. } `json:"current"`
  93. } `json:"interface_speed"`
  94. /*
  95. LocalTime struct {
  96. TimeT int `json:"time_t"`
  97. Asctime string `json:"asctime"`
  98. } `json:"local_time"`
  99. */
  100. SmartStatus struct {
  101. Passed bool `json:"passed"`
  102. } `json:"smart_status"`
  103. /*
  104. AtaSmartData struct {
  105. OfflineDataCollection struct {
  106. Status struct {
  107. Value int `json:"value"`
  108. String string `json:"string"`
  109. } `json:"status"`
  110. CompletionSeconds int `json:"completion_seconds"`
  111. } `json:"offline_data_collection"`
  112. SelfTest struct {
  113. Status struct {
  114. Value int `json:"value"`
  115. String string `json:"string"`
  116. Passed bool `json:"passed"`
  117. } `json:"status"`
  118. PollingMinutes struct {
  119. Short int `json:"short"`
  120. Extended int `json:"extended"`
  121. Conveyance int `json:"conveyance"`
  122. } `json:"polling_minutes"`
  123. } `json:"self_test"`
  124. Capabilities struct {
  125. Values []int `json:"values"`
  126. ExecOfflineImmediateSupported bool `json:"exec_offline_immediate_supported"`
  127. OfflineIsAbortedUponNewCmd bool `json:"offline_is_aborted_upon_new_cmd"`
  128. OfflineSurfaceScanSupported bool `json:"offline_surface_scan_supported"`
  129. SelfTestsSupported bool `json:"self_tests_supported"`
  130. ConveyanceSelfTestSupported bool `json:"conveyance_self_test_supported"`
  131. SelectiveSelfTestSupported bool `json:"selective_self_test_supported"`
  132. AttributeAutosaveEnabled bool `json:"attribute_autosave_enabled"`
  133. ErrorLoggingSupported bool `json:"error_logging_supported"`
  134. GpLoggingSupported bool `json:"gp_logging_supported"`
  135. } `json:"capabilities"`
  136. } `json:"ata_smart_data"`
  137. AtaSctCapabilities struct {
  138. Value int `json:"value"`
  139. ErrorRecoveryControlSupported bool `json:"error_recovery_control_supported"`
  140. FeatureControlSupported bool `json:"feature_control_supported"`
  141. DataTableSupported bool `json:"data_table_supported"`
  142. } `json:"ata_sct_capabilities"`
  143. */
  144. AtaSmartAttributes struct {
  145. Revision int `json:"revision"`
  146. Table []struct {
  147. ID int `json:"id"`
  148. Name string `json:"name"`
  149. Value int `json:"value"`
  150. Worst int `json:"worst"`
  151. Thresh int `json:"thresh"`
  152. WhenFailed string `json:"when_failed"`
  153. Flags struct {
  154. Value int `json:"value"`
  155. String string `json:"string"`
  156. Prefailure bool `json:"prefailure"`
  157. UpdatedOnline bool `json:"updated_online"`
  158. Performance bool `json:"performance"`
  159. ErrorRate bool `json:"error_rate"`
  160. EventCount bool `json:"event_count"`
  161. AutoKeep bool `json:"auto_keep"`
  162. } `json:"flags"`
  163. Raw struct {
  164. Value int `json:"value"`
  165. String string `json:"string"`
  166. } `json:"raw"`
  167. } `json:"table"`
  168. } `json:"ata_smart_attributes"`
  169. PowerOnTime struct {
  170. Hours int `json:"hours"`
  171. Minutes int `json:"minutes"`
  172. } `json:"power_on_time"`
  173. PowerCycleCount int `json:"power_cycle_count"`
  174. Temperature struct {
  175. Current int `json:"current"`
  176. } `json:"temperature"`
  177. /*
  178. AtaSmartSelfTestLog struct {
  179. Standard struct {
  180. Revision int `json:"revision"`
  181. Table []struct {
  182. Type struct {
  183. Value int `json:"value"`
  184. String string `json:"string"`
  185. } `json:"type"`
  186. Status struct {
  187. Value int `json:"value"`
  188. String string `json:"string"`
  189. Passed bool `json:"passed"`
  190. } `json:"status,omitempty"`
  191. LifetimeHours int `json:"lifetime_hours"`
  192. } `json:"table"`
  193. Count int `json:"count"`
  194. ErrorCountTotal int `json:"error_count_total"`
  195. ErrorCountOutdated int `json:"error_count_outdated"`
  196. } `json:"standard"`
  197. } `json:"ata_smart_self_test_log"`
  198. AtaSmartSelectiveSelfTestLog struct {
  199. Revision int `json:"revision"`
  200. Table []struct {
  201. LbaMin int `json:"lba_min"`
  202. LbaMax int `json:"lba_max"`
  203. Status struct {
  204. Value int `json:"value"`
  205. String string `json:"string"`
  206. } `json:"status"`
  207. } `json:"table"`
  208. Flags struct {
  209. Value int `json:"value"`
  210. RemainderScanEnabled bool `json:"remainder_scan_enabled"`
  211. } `json:"flags"`
  212. PowerUpScanResumeMinutes int `json:"power_up_scan_resume_minutes"`
  213. } `json:"ata_smart_selective_self_test_log"`
  214. */
  215. }