structure.go 7.3 KB

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