make sure the status is always exposed in the json data. make sure display_name for metadata is included. Update mocked test data for frontend.

pull/228/head
Jason Kulatunga 3 years ago
parent deba21fe19
commit 5789c836db

@ -19,7 +19,7 @@ type SmartAtaAttribute struct {
//Generated data
TransformedValue int64 `json:"transformed_value"`
Status int64 `json:"status,omitempty"`
Status int64 `json:"status"`
StatusReason string `json:"status_reason,omitempty"`
FailureRate float64 `json:"failure_rate,omitempty"`
}

@ -13,7 +13,7 @@ type SmartNvmeAttribute struct {
Threshold int64 `json:"thresh"`
TransformedValue int64 `json:"transformed_value"`
Status int64 `json:"status,omitempty"`
Status int64 `json:"status"`
StatusReason string `json:"status_reason,omitempty"`
FailureRate float64 `json:"failure_rate,omitempty"`
}

@ -13,7 +13,7 @@ type SmartScsiAttribute struct {
Threshold int64 `json:"thresh"`
TransformedValue int64 `json:"transformed_value"`
Status int64 `json:"status,omitempty"`
Status int64 `json:"status"`
StatusReason string `json:"status_reason,omitempty"`
FailureRate float64 `json:"failure_rate,omitempty"`
}

@ -69,7 +69,7 @@
}
},
"local_time": {
"time_t": 1635117644,
"time_t": 1635107644,
"asctime": "Sun Jun 30 00:03:30 2021 UTC"
},
"smart_status": {

@ -69,7 +69,7 @@
}
},
"local_time": {
"time_t": 1635117644,
"time_t": 1635127644,
"asctime": "Tue Feb 23 00:03:30 2021 UTC"
},
"smart_status": {

@ -6,7 +6,7 @@ package thresholds
// https://www.micromat.com/product_manuals/drive_scope_manual_01.pdf
type NvmeAttributeMetadata struct {
ID string `json:"-"`
DisplayName string `json:"-"`
DisplayName string `json:"display_name"`
Ideal string `json:"ideal"`
Critical bool `json:"critical"`
Description string `json:"description"`

@ -2,7 +2,7 @@ package thresholds
type ScsiAttributeMetadata struct {
ID string `json:"-"`
DisplayName string `json:"-"`
DisplayName string `json:"display_name"`
Ideal string `json:"ideal"`
Critical bool `json:"critical"`
Description string `json:"description"`

File diff suppressed because it is too large Load Diff

@ -2,7 +2,7 @@ export const sda = {
"data": {
"device": {
"CreatedAt": "2021-06-24T21:17:31.301226-07:00",
"UpdatedAt": "2021-06-26T14:26:20.856273-07:00",
"UpdatedAt": "2021-10-24T16:37:56.981833-07:00",
"DeletedAt": null,
"wwn": "0x5002538e40a22954",
"device_name": "sda",
@ -23,7 +23,7 @@ export const sda = {
"device_status": 0
},
"smart_results": [{
"date": "2020-06-10T12:01:02Z",
"date": "2021-10-24T23:20:44Z",
"device_wwn": "0x5002538e40a22954",
"device_protocol": "NVMe",
"temp": 36,
@ -32,211 +32,228 @@ export const sda = {
"attrs": {
"available_spare": {
"attribute_id": "available_spare",
"name": "Available Spare",
"value": 100,
"thresh": 10,
"transformed_value": 0
"transformed_value": 0,
"status": 0
},
"controller_busy_time": {
"attribute_id": "controller_busy_time",
"name": "Controller Busy Time",
"value": 3060,
"thresh": -1,
"transformed_value": 0
"transformed_value": 0,
"status": 0
},
"critical_comp_time": {
"attribute_id": "critical_comp_time",
"name": "Critical CompTime",
"value": 0,
"thresh": -1,
"transformed_value": 0
"transformed_value": 0,
"status": 0
},
"critical_warning": {
"attribute_id": "critical_warning",
"name": "Critical Warning",
"value": 0,
"thresh": 0,
"transformed_value": 0
"transformed_value": 0,
"status": 0
},
"data_units_read": {
"attribute_id": "data_units_read",
"name": "Data Units Read",
"value": 9511859,
"thresh": -1,
"transformed_value": 0
"transformed_value": 0,
"status": 0
},
"data_units_written": {
"attribute_id": "data_units_written",
"name": "Data Units Written",
"value": 7773431,
"thresh": -1,
"transformed_value": 0
"transformed_value": 0,
"status": 0
},
"host_reads": {
"attribute_id": "host_reads",
"name": "Host Reads",
"value": 111303174,
"thresh": -1,
"transformed_value": 0
"transformed_value": 0,
"status": 0
},
"host_writes": {
"attribute_id": "host_writes",
"name": "Host Writes",
"value": 83170961,
"thresh": -1,
"transformed_value": 0
"transformed_value": 0,
"status": 0
},
"media_errors": {
"attribute_id": "media_errors",
"name": "Media Errors",
"value": 0,
"thresh": 0,
"transformed_value": 0
"transformed_value": 0,
"status": 0
},
"num_err_log_entries": {
"attribute_id": "num_err_log_entries",
"name": "Numb Err Log Entries",
"value": 0,
"thresh": 0,
"transformed_value": 0
"transformed_value": 0,
"status": 0
},
"percentage_used": {
"attribute_id": "percentage_used",
"name": "Percentage Used",
"value": 0,
"thresh": 100,
"transformed_value": 0
"transformed_value": 0,
"status": 0
},
"power_cycles": {
"attribute_id": "power_cycles",
"name": "Power Cycles",
"value": 266,
"thresh": -1,
"transformed_value": 0
"transformed_value": 0,
"status": 0
},
"power_on_hours": {
"attribute_id": "power_on_hours",
"name": "Power on Hours",
"value": 2401,
"thresh": -1,
"transformed_value": 0
"transformed_value": 0,
"status": 0
},
"temperature": {
"attribute_id": "temperature",
"name": "Temperature",
"value": 36,
"thresh": -1,
"transformed_value": 0
"transformed_value": 0,
"status": 0
},
"unsafe_shutdowns": {
"attribute_id": "unsafe_shutdowns",
"name": "Unsafe Shutdowns",
"value": 43,
"thresh": -1,
"transformed_value": 0
"transformed_value": 0,
"status": 0
},
"warning_temp_time": {
"attribute_id": "warning_temp_time",
"name": "Warning Temp Time",
"value": 0,
"thresh": -1,
"transformed_value": 0
"transformed_value": 0,
"status": 0
}
}
},
"Status": 0
}]
},
"metadata": {
"available_spare": {
"display_name": "Available Spare",
"ideal": "high",
"critical": true,
"description": "Contains a normalized percentage (0 to 100%) of the remaining spare capacity available.",
"display_type": ""
},
"controller_busy_time": {
"display_name": "Controller Busy Time",
"ideal": "",
"critical": false,
"description": "Contains the amount of time the controller is busy with I/O commands. The controller is busy when there is a command outstanding to an I/O Queue (specifically, a command was issued via an I/O Submission Queue Tail doorbell write and the corresponding completion queue entry has not been posted yet to the associated I/O Completion Queue). This value is reported in minutes.",
"display_type": ""
},
"critical_comp_time": {
"display_name": "Critical CompTime",
"ideal": "",
"critical": false,
"description": "Contains the amount of time in minutes that the controller is operational and the Composite Temperature is greater the Critical Composite Temperature Threshold (CCTEMP) field in the Identify Controller data structure.",
"display_type": ""
},
"critical_warning": {
"display_name": "Critical Warning",
"ideal": "low",
"critical": true,
"description": "This field indicates critical warnings for the state of the controller. Each bit corresponds to a critical warning type; multiple bits may be set. If a bit is cleared to 0, then that critical warning does not apply. Critical warnings may result in an asynchronous event notification to the host. Bits in this field represent the current associated state and are not persistent.",
"display_type": ""
},
"data_units_read": {
"display_name": "Data Units Read",
"ideal": "",
"critical": false,
"description": "Contains the number of 512 byte data units the host has read from the controller; this value does not include metadata. This value is reported in thousands (i.e., a value of 1 corresponds to 1000 units of 512 bytes read) and is rounded up. When the LBA size is a value other than 512 bytes, the controller shall convert the amount of data read to 512 byte units.",
"display_type": ""
},
"data_units_written": {
"display_name": "Data Units Written",
"ideal": "",
"critical": false,
"description": "Contains the number of 512 byte data units the host has written to the controller; this value does not include metadata. This value is reported in thousands (i.e., a value of 1 corresponds to 1000 units of 512 bytes written) and is rounded up. When the LBA size is a value other than 512 bytes, the controller shall convert the amount of data written to 512 byte units.",
"display_type": ""
},
"host_reads": {
"display_name": "Host Reads",
"ideal": "",
"critical": false,
"description": "Contains the number of read commands completed by the controller",
"display_type": ""
},
"host_writes": {
"display_name": "Host Writes",
"ideal": "",
"critical": false,
"description": "Contains the number of write commands completed by the controller",
"display_type": ""
},
"media_errors": {
"display_name": "Media Errors",
"ideal": "low",
"critical": true,
"description": "Contains the number of occurrences where the controller detected an unrecovered data integrity error. Errors such as uncorrectable ECC, CRC checksum failure, or LBA tag mismatch are included in this field.",
"display_type": ""
},
"num_err_log_entries": {
"display_name": "Numb Err Log Entries",
"ideal": "low",
"critical": true,
"description": "Contains the number of Error Information log entries over the life of the controller.",
"display_type": ""
},
"percentage_used": {
"display_name": "Percentage Used",
"ideal": "low",
"critical": true,
"description": "Contains a vendor specific estimate of the percentage of NVM subsystem life used based on the actual usage and the manufacturers prediction of NVM life. A value of 100 indicates that the estimated endurance of the NVM in the NVM subsystem has been consumed, but may not indicate an NVM subsystem failure. The value is allowed to exceed 100. Percentages greater than 254 shall be represented as 255. This value shall be updated once per power-on hour (when the controller is not in a sleep state).",
"display_type": ""
},
"power_cycles": {
"display_name": "Power Cycles",
"ideal": "",
"critical": false,
"description": "Contains the number of power cycles.",
"display_type": ""
},
"power_on_hours": {
"display_name": "Power on Hours",
"ideal": "",
"critical": false,
"description": "Contains the number of power-on hours. Power on hours is always logging, even when in low power mode.",
"display_type": ""
},
"temperature": {
"display_name": "Temperature",
"ideal": "",
"critical": false,
"description": "",
"display_type": ""
},
"unsafe_shutdowns": {
"display_name": "Unsafe Shutdowns",
"ideal": "",
"critical": false,
"description": "Contains the number of unsafe shutdowns. This count is incremented when a shutdown notification (CC.SHN) is not received prior to loss of power.",
"display_type": ""
},
"warning_temp_time": {
"display_name": "Warning Temp Time",
"ideal": "",
"critical": false,
"description": "Contains the amount of time in minutes that the controller is operational and the Composite Temperature is greater than or equal to the Warning Composite Temperature Threshold (WCTEMP) field and less than the Critical Composite Temperature Threshold (CCTEMP) field in the Identify Controller data structure.",

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

@ -2,7 +2,7 @@ export const sdd = {
"data": {
"device": {
"CreatedAt": "2021-06-24T21:17:31.30374-07:00",
"UpdatedAt": "2021-06-26T14:26:20.902325-07:00",
"UpdatedAt": "2021-10-24T16:37:57.013758-07:00",
"DeletedAt": null,
"wwn": "0x5000cca252c859cc",
"device_name": "sdd",
@ -23,7 +23,7 @@ export const sdd = {
"device_status": 0
},
"smart_results": [{
"date": "2020-08-21T22:27:02Z",
"date": "2021-10-24T23:20:44Z",
"device_wwn": "0x5000cca252c859cc",
"device_protocol": "SCSI",
"temp": 34,
@ -32,272 +32,186 @@ export const sdd = {
"attrs": {
"read_correction_algorithm_invocations": {
"attribute_id": "read_correction_algorithm_invocations",
"name": "Read Correction Algorithm Invocations",
"value": 0,
"thresh": -1,
"transformed_value": 0
"transformed_value": 0,
"status": 0
},
"read_errors_corrected_by_eccdelayed": {
"attribute_id": "read_errors_corrected_by_eccdelayed",
"name": "Read Errors Corrected by ECC Delayed",
"value": 0,
"thresh": -1,
"transformed_value": 0
"transformed_value": 0,
"status": 0
},
"read_errors_corrected_by_eccfast": {
"attribute_id": "read_errors_corrected_by_eccfast",
"name": "Read Errors Corrected by ECC Fast",
"value": 300357663,
"thresh": -1,
"transformed_value": 0
"transformed_value": 0,
"status": 0
},
"read_errors_corrected_by_rereads_rewrites": {
"attribute_id": "read_errors_corrected_by_rereads_rewrites",
"name": "Read Errors Corrected by ReReads/ReWrites",
"value": 0,
"thresh": 0,
"transformed_value": 0
"transformed_value": 0,
"status": 0
},
"read_total_errors_corrected": {
"attribute_id": "read_total_errors_corrected",
"name": "Read Total Errors Corrected",
"value": 300357663,
"thresh": -1,
"transformed_value": 0
"transformed_value": 0,
"status": 0
},
"read_total_uncorrected_errors": {
"attribute_id": "read_total_uncorrected_errors",
"name": "Read Total Uncorrected Errors",
"value": 0,
"thresh": 0,
"transformed_value": 0
"transformed_value": 0,
"status": 0
},
"scsi_grown_defect_list": {
"attribute_id": "scsi_grown_defect_list",
"name": "Grown Defect List",
"value": 56,
"thresh": 0,
"transformed_value": 0
"transformed_value": 0,
"status": 0
},
"write_correction_algorithm_invocations": {
"attribute_id": "write_correction_algorithm_invocations",
"name": "Write Correction Algorithm Invocations",
"value": 0,
"thresh": -1,
"transformed_value": 0
"transformed_value": 0,
"status": 0
},
"write_errors_corrected_by_eccdelayed": {
"attribute_id": "write_errors_corrected_by_eccdelayed",
"name": "Write Errors Corrected by ECC Delayed",
"value": 0,
"thresh": -1,
"transformed_value": 0
"transformed_value": 0,
"status": 0
},
"write_errors_corrected_by_eccfast": {
"attribute_id": "write_errors_corrected_by_eccfast",
"name": "Write Errors Corrected by ECC Fast",
"value": 0,
"thresh": -1,
"transformed_value": 0
"transformed_value": 0,
"status": 0
},
"write_errors_corrected_by_rereads_rewrites": {
"attribute_id": "write_errors_corrected_by_rereads_rewrites",
"name": "Write Errors Corrected by ReReads/ReWrites",
"value": 0,
"thresh": 0,
"transformed_value": 0
"transformed_value": 0,
"status": 0
},
"write_total_errors_corrected": {
"attribute_id": "write_total_errors_corrected",
"name": "Write Total Errors Corrected",
"value": 0,
"thresh": -1,
"transformed_value": 0
"transformed_value": 0,
"status": 0
},
"write_total_uncorrected_errors": {
"attribute_id": "write_total_uncorrected_errors",
"name": "Write Total Uncorrected Errors",
"value": 0,
"thresh": 0,
"transformed_value": 0
"transformed_value": 0,
"status": 0
}
}
},{
"date": "2020-08-21T22:27:02Z",
"device_wwn": "0x5000cca252c859cc",
"device_protocol": "SCSI",
"temp": 34,
"power_on_hours": 43549,
"power_cycle_count": 0,
"attrs": {
"read_correction_algorithm_invocations": {
"attribute_id": "read_correction_algorithm_invocations",
"name": "Read Correction Algorithm Invocations",
"value": 0,
"thresh": -1,
"transformed_value": 0
},
"read_errors_corrected_by_eccdelayed": {
"attribute_id": "read_errors_corrected_by_eccdelayed",
"name": "Read Errors Corrected by ECC Delayed",
"value": 0,
"thresh": -1,
"transformed_value": 0
},
"read_errors_corrected_by_eccfast": {
"attribute_id": "read_errors_corrected_by_eccfast",
"name": "Read Errors Corrected by ECC Fast",
"value": 300357663,
"thresh": -1,
"transformed_value": 0
},
"read_errors_corrected_by_rereads_rewrites": {
"attribute_id": "read_errors_corrected_by_rereads_rewrites",
"name": "Read Errors Corrected by ReReads/ReWrites",
"value": 0,
"thresh": 0,
"transformed_value": 0
},
"read_total_errors_corrected": {
"attribute_id": "read_total_errors_corrected",
"name": "Read Total Errors Corrected",
"value": 300357663,
"thresh": -1,
"transformed_value": 0
},
"read_total_uncorrected_errors": {
"attribute_id": "read_total_uncorrected_errors",
"name": "Read Total Uncorrected Errors",
"value": 0,
"thresh": 0,
"transformed_value": 0
},
"scsi_grown_defect_list": {
"attribute_id": "scsi_grown_defect_list",
"name": "Grown Defect List",
"value": 56,
"thresh": 0,
"transformed_value": 0
},
"write_correction_algorithm_invocations": {
"attribute_id": "write_correction_algorithm_invocations",
"name": "Write Correction Algorithm Invocations",
"value": 0,
"thresh": -1,
"transformed_value": 0
},
"write_errors_corrected_by_eccdelayed": {
"attribute_id": "write_errors_corrected_by_eccdelayed",
"name": "Write Errors Corrected by ECC Delayed",
"value": 0,
"thresh": -1,
"transformed_value": 0
},
"write_errors_corrected_by_eccfast": {
"attribute_id": "write_errors_corrected_by_eccfast",
"name": "Write Errors Corrected by ECC Fast",
"value": 0,
"thresh": -1,
"transformed_value": 0
},
"write_errors_corrected_by_rereads_rewrites": {
"attribute_id": "write_errors_corrected_by_rereads_rewrites",
"name": "Write Errors Corrected by ReReads/ReWrites",
"value": 0,
"thresh": 0,
"transformed_value": 0
},
"write_total_errors_corrected": {
"attribute_id": "write_total_errors_corrected",
"name": "Write Total Errors Corrected",
"value": 0,
"thresh": -1,
"transformed_value": 0
},
"write_total_uncorrected_errors": {
"attribute_id": "write_total_uncorrected_errors",
"name": "Write Total Uncorrected Errors",
"value": 0,
"thresh": 0,
"transformed_value": 0
}
}
},
"Status": 0
}]
},
"metadata": {
"read_correction_algorithm_invocations": {
"display_name": "Read Correction Algorithm Invocations",
"ideal": "",
"critical": false,
"description": "",
"display_type": ""
},
"read_errors_corrected_by_eccdelayed": {
"display_name": "Read Errors Corrected by ECC Delayed",
"ideal": "",
"critical": false,
"description": "",
"display_type": ""
},
"read_errors_corrected_by_eccfast": {
"display_name": "Read Errors Corrected by ECC Fast",
"ideal": "",
"critical": false,
"description": "",
"display_type": ""
},
"read_errors_corrected_by_rereads_rewrites": {
"display_name": "Read Errors Corrected by ReReads/ReWrites",
"ideal": "low",
"critical": true,
"description": "",
"display_type": ""
},
"read_total_errors_corrected": {
"display_name": "Read Total Errors Corrected",
"ideal": "",
"critical": false,
"description": "",
"display_type": ""
},
"read_total_uncorrected_errors": {
"display_name": "Read Total Uncorrected Errors",
"ideal": "low",
"critical": true,
"description": "",
"display_type": ""
},
"scsi_grown_defect_list": {
"display_name": "Grown Defect List",
"ideal": "low",
"critical": true,
"description": "",
"display_type": ""
},
"write_correction_algorithm_invocations": {
"display_name": "Write Correction Algorithm Invocations",
"ideal": "",
"critical": false,
"description": "",
"display_type": ""
},
"write_errors_corrected_by_eccdelayed": {
"display_name": "Write Errors Corrected by ECC Delayed",
"ideal": "",
"critical": false,
"description": "",
"display_type": ""
},
"write_errors_corrected_by_eccfast": {
"display_name": "Write Errors Corrected by ECC Fast",
"ideal": "",
"critical": false,
"description": "",
"display_type": ""
},
"write_errors_corrected_by_rereads_rewrites": {
"display_name": "Write Errors Corrected by ReReads/ReWrites",
"ideal": "low",
"critical": true,
"description": "",
"display_type": ""
},
"write_total_errors_corrected": {
"display_name": "Write Total Errors Corrected",
"ideal": "",
"critical": false,
"description": "",
"display_type": ""
},
"write_total_uncorrected_errors": {
"display_name": "Write Total Uncorrected Errors",
"ideal": "low",
"critical": true,
"description": "",

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

@ -139,15 +139,15 @@
<td mat-cell
*matCellDef="let attribute">
<span class="inline-flex items-center font-bold text-xs px-2 py-2px rounded-full tracking-wide uppercase"
[ngClass]="{'red-200': attribute.status === 'failed',
'green-200': attribute.status === 'passed',
'yellow-200': attribute.status === 'warn'
[ngClass]="{'red-200': getAttributeStatusName(attribute.status) === 'failed',
'green-200': getAttributeStatusName(attribute.status) === 'passed',
'yellow-200': getAttributeStatusName(attribute.status) === 'warn'
}">
<span class="w-2 h-2 rounded-full mr-2"
[ngClass]="{'bg-red': attribute.status === 'failed',
'bg-green': attribute.status === 'passed',
'bg-yellow': attribute.status === 'warn'}"></span>
<span class="pr-2px leading-relaxed whitespace-no-wrap" matTooltip="{{attribute.status_reason}}">{{attribute.status}}</span>
[ngClass]="{'bg-red': getAttributeStatusName(attribute.status) === 'failed',
'bg-green': getAttributeStatusName(attribute.status) === 'passed',
'bg-yellow': getAttributeStatusName(attribute.status) === 'warn'}"></span>
<span class="pr-2px leading-relaxed whitespace-no-wrap" matTooltip="{{attribute.status_reason}}">{{getAttributeStatusName(attribute.status)}}</span>
</span>
</td>
</ng-container>
@ -183,7 +183,7 @@
<td mat-cell
*matCellDef="let attribute">
<span class="pr-6 whitespace-no-wrap" matTooltip="{{getAttributeDescription(attribute)}}">
{{attribute.name}} <mat-icon *ngIf="getAttributeDescription(attribute)" class="icon-size-10" [svgIcon]="'info'"></mat-icon>
{{getAttributeName(attribute)}} <mat-icon *ngIf="getAttributeDescription(attribute)" class="icon-size-10" [svgIcon]="'info'"></mat-icon>
</span>
</td>
</ng-container>

@ -107,6 +107,26 @@ export class DetailComponent implements OnInit, AfterViewInit, OnDestroy {
// -----------------------------------------------------------------------------------------------------
// @ Private methods
// -----------------------------------------------------------------------------------------------------
getAttributeStatusName(attribute_status){
if(attribute_status == 0){
return "passed"
} else if (attribute_status == 1){
return "warn"
} else if (attribute_status == 2){
return "failed"
}
return
}
getAttributeName(attribute_data){
let attribute_metadata = this.metadata[attribute_data.attribute_id]
if(!attribute_metadata){
return 'Unknown Attribute Name'
} else {
return attribute_metadata.display_name
}
return
}
getAttributeDescription(attribute_data){
let attribute_metadata = this.metadata[attribute_data.attribute_id]
if(!attribute_metadata){

Loading…
Cancel
Save