]>
Commit | Line | Data |
---|---|---|
9f95a23c TL |
1 | export interface SmartAttribute { |
2 | flags: { | |
3 | auto_keep: boolean; | |
4 | error_rate: boolean; | |
5 | event_count: boolean; | |
6 | performance: boolean; | |
7 | prefailure: boolean; | |
8 | string: string; | |
9 | updated_online: boolean; | |
10 | value: number; | |
11 | }; | |
12 | id: number; | |
13 | name: string; | |
14 | raw: { string: string; value: number }; | |
15 | thresh: number; | |
16 | value: number; | |
17 | when_failed: string; | |
18 | worst: number; | |
19 | } | |
20 | ||
21 | /** | |
22 | * The error structure returned from the back-end if SMART data couldn't be | |
23 | * retrieved. | |
24 | */ | |
25 | export interface SmartError { | |
26 | dev: string; | |
27 | error: string; | |
28 | nvme_smart_health_information_add_log_error: string; | |
29 | nvme_smart_health_information_add_log_error_code: number; | |
30 | nvme_vendor: string; | |
31 | smartctl_error_code: number; | |
32 | smartctl_output: string; | |
33 | } | |
34 | ||
35 | /** | |
36 | * Common smartctl output structure. | |
37 | */ | |
38 | interface SmartCtlOutput { | |
39 | argv: string[]; | |
40 | build_info: string; | |
41 | exit_status: number; | |
42 | output: string[]; | |
43 | platform_info: string; | |
44 | svn_revision: string; | |
45 | version: number[]; | |
46 | } | |
47 | ||
48 | /** | |
49 | * Common smartctl device structure. | |
50 | */ | |
51 | interface SmartCtlDevice { | |
52 | info_name: string; | |
53 | name: string; | |
54 | protocol: string; | |
55 | type: string; | |
56 | } | |
57 | ||
58 | /** | |
59 | * smartctl data structure shared among HDD/NVMe. | |
60 | */ | |
61 | interface SmartCtlBaseDataV1 { | |
62 | device: SmartCtlDevice; | |
63 | firmware_version: string; | |
64 | json_format_version: number[]; | |
65 | local_time: { asctime: string; time_t: number }; | |
66 | logical_block_size: number; | |
67 | model_name: string; | |
68 | nvme_smart_health_information_add_log_error: string; | |
69 | nvme_smart_health_information_add_log_error_code: number; | |
70 | nvme_vendor: string; | |
71 | power_cycle_count: number; | |
72 | power_on_time: { hours: number }; | |
73 | serial_number: string; | |
74 | smart_status: { passed: boolean; nvme?: { value: number } }; | |
75 | smartctl: SmartCtlOutput; | |
76 | temperature: { current: number }; | |
77 | user_capacity: { blocks: number; bytes: number }; | |
78 | } | |
79 | ||
80 | /** | |
81 | * Result structure of `smartctl` applied on an HDD. Returned by the back-end. | |
82 | */ | |
83 | export interface HddSmartDataV1 extends SmartCtlBaseDataV1 { | |
84 | ata_sct_capabilities: { | |
85 | data_table_supported: boolean; | |
86 | error_recovery_control_supported: boolean; | |
87 | feature_control_supported: boolean; | |
88 | value: number; | |
89 | }; | |
90 | ata_smart_attributes: { | |
91 | revision: number; | |
92 | table: SmartAttribute[]; | |
93 | }; | |
94 | ata_smart_data: { | |
95 | capabilities: { | |
96 | attribute_autosave_enabled: boolean; | |
97 | conveyance_self_test_supported: boolean; | |
98 | error_logging_supported: boolean; | |
99 | exec_offline_immediate_supported: boolean; | |
100 | gp_logging_supported: boolean; | |
101 | offline_is_aborted_upon_new_cmd: boolean; | |
102 | offline_surface_scan_supported: boolean; | |
103 | selective_self_test_supported: boolean; | |
104 | self_tests_supported: boolean; | |
105 | values: number[]; | |
106 | }; | |
107 | offline_data_collection: { | |
108 | completion_seconds: number; | |
109 | status: { string: string; value: number }; | |
110 | }; | |
111 | self_test: { | |
112 | polling_minutes: { conveyance: number; extended: number; short: number }; | |
113 | status: { passed: boolean; string: string; value: number }; | |
114 | }; | |
115 | }; | |
116 | ata_smart_error_log: { summary: { count: number; revision: number } }; | |
117 | ata_smart_selective_self_test_log: { | |
118 | flags: { remainder_scan_enabled: boolean; value: number }; | |
119 | power_up_scan_resume_minutes: number; | |
120 | revision: number; | |
121 | table: { | |
122 | lba_max: number; | |
123 | lba_min: number; | |
124 | status: { string: string; value: number }; | |
125 | }[]; | |
126 | }; | |
127 | ata_smart_self_test_log: { standard: { count: number; revision: number } }; | |
128 | ata_version: { major_value: number; minor_value: number; string: string }; | |
129 | in_smartctl_database: boolean; | |
130 | interface_speed: { | |
131 | current: { | |
132 | bits_per_unit: number; | |
133 | sata_value: number; | |
134 | string: string; | |
135 | units_per_second: number; | |
136 | }; | |
137 | max: { | |
138 | bits_per_unit: number; | |
139 | sata_value: number; | |
140 | string: string; | |
141 | units_per_second: number; | |
142 | }; | |
143 | }; | |
144 | model_family: string; | |
145 | physical_block_size: number; | |
146 | rotation_rate: number; | |
147 | sata_version: { string: string; value: number }; | |
148 | smart_status: { passed: boolean }; | |
149 | smartctl: SmartCtlOutput; | |
150 | wwn: { id: number; naa: number; oui: number }; | |
151 | } | |
152 | ||
153 | /** | |
154 | * Result structure of `smartctl` returned by Ceph and then back-end applied on | |
155 | * an NVMe. | |
156 | */ | |
157 | export interface NvmeSmartDataV1 extends SmartCtlBaseDataV1 { | |
158 | nvme_controller_id: number; | |
159 | nvme_ieee_oui_identifier: number; | |
160 | nvme_namespaces: { | |
161 | capacity: { blocks: number; bytes: number }; | |
162 | eui64: { ext_id: number; oui: number }; | |
163 | formatted_lba_size: number; | |
164 | id: number; | |
165 | size: { blocks: number; bytes: number }; | |
166 | utilization: { blocks: number; bytes: number }; | |
167 | }[]; | |
168 | nvme_number_of_namespaces: number; | |
169 | nvme_pci_vendor: { id: number; subsystem_id: number }; | |
170 | nvme_smart_health_information_log: { | |
171 | available_spare: number; | |
172 | available_spare_threshold: number; | |
173 | controller_busy_time: number; | |
174 | critical_comp_time: number; | |
175 | critical_warning: number; | |
176 | data_units_read: number; | |
177 | data_units_written: number; | |
178 | host_reads: number; | |
179 | host_writes: number; | |
180 | media_errors: number; | |
181 | num_err_log_entries: number; | |
182 | percentage_used: number; | |
183 | power_cycles: number; | |
184 | power_on_hours: number; | |
185 | temperature: number; | |
186 | temperature_sensors: number[]; | |
187 | unsafe_shutdowns: number; | |
188 | warning_temp_time: number; | |
189 | }; | |
190 | nvme_total_capacity: number; | |
191 | nvme_unallocated_capacity: number; | |
192 | } | |
193 | ||
194 | /** | |
195 | * The shared fields each result has after it has been processed by the front-end. | |
196 | */ | |
197 | interface SmartBasicResult { | |
198 | device: string; | |
199 | identifier: string; | |
200 | } | |
201 | ||
202 | /** | |
203 | * The SMART data response structure of the back-end. Per device it will either | |
204 | * contain the structure for a HDD, NVMe or an error. | |
205 | */ | |
206 | export interface SmartDataResponseV1 { | |
207 | [deviceId: string]: HddSmartDataV1 | NvmeSmartDataV1 | SmartError; | |
208 | } | |
209 | ||
210 | /** | |
211 | * The SMART data result after it has been processed by the front-end. | |
212 | */ | |
213 | export interface SmartDataResult extends SmartBasicResult { | |
214 | info: { [key: string]: any }; | |
215 | smart: { | |
216 | attributes?: any; | |
217 | data?: any; | |
218 | nvmeData?: any; | |
219 | }; | |
220 | } | |
221 | ||
222 | /** | |
223 | * The SMART error result after is has been processed by the front-end. If SMART | |
224 | * data couldn't be retrieved, this is the structure which is returned. | |
225 | */ | |
226 | export interface SmartErrorResult extends SmartBasicResult { | |
227 | error: string; | |
228 | smartctl_error_code: number; | |
229 | smartctl_output: string; | |
230 | userMessage: string; | |
231 | } |