structure.go 6.9 KB

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