From e7801619cdbd2f672b66871b42f9b1d26ddaf866 Mon Sep 17 00:00:00 2001 From: Jason Kulatunga Date: Thu, 12 May 2022 10:04:06 -0700 Subject: [PATCH] added additional tests from #187. Detected that the frontend was incorrectly classifying Scrutiny Failures as Warnings. Fixed. --- .../measurements/smart_ata_attribute.go | 2 + .../pkg/models/measurements/smart_test.go | 64 + .../testdata/smart-ata-failed-scrutiny.json | 1162 +++++++++++++++++ .../models/testdata/smart-nvme-failed.json | 107 ++ .../app/modules/detail/detail.component.ts | 4 +- 5 files changed, 1337 insertions(+), 2 deletions(-) create mode 100644 webapp/backend/pkg/models/testdata/smart-ata-failed-scrutiny.json create mode 100644 webapp/backend/pkg/models/testdata/smart-nvme-failed.json diff --git a/webapp/backend/pkg/models/measurements/smart_ata_attribute.go b/webapp/backend/pkg/models/measurements/smart_ata_attribute.go index 7b0606c..5b17cfd 100644 --- a/webapp/backend/pkg/models/measurements/smart_ata_attribute.go +++ b/webapp/backend/pkg/models/measurements/smart_ata_attribute.go @@ -93,6 +93,8 @@ func (sa *SmartAtaAttribute) PopulateAttributeStatus() *SmartAtaAttribute { //this attribute has previously failed sa.Status = pkg.SmartAttributeStatusFailed sa.StatusReason = "Attribute is failing manufacturer SMART threshold" + //if the Smart Status is failed, we should exit early, no need to look at thresholds. + return sa } else if strings.ToUpper(sa.WhenFailed) == pkg.SmartWhenFailedInThePast { sa.Status = pkg.SmartAttributeStatusWarning diff --git a/webapp/backend/pkg/models/measurements/smart_test.go b/webapp/backend/pkg/models/measurements/smart_test.go index 320528e..a65b01a 100644 --- a/webapp/backend/pkg/models/measurements/smart_test.go +++ b/webapp/backend/pkg/models/measurements/smart_test.go @@ -381,6 +381,70 @@ func TestFromCollectorSmartInfo_Fail_ScrutinySmart(t *testing.T) { require.Equal(t, 17, len(smartMdl.Attributes)) } +func TestFromCollectorSmartInfo_Fail_ScrutinyNonCriticalFailed(t *testing.T) { + //setup + smartDataFile, err := os.Open("../testdata/smart-ata-failed-scrutiny.json") + require.NoError(t, err) + defer smartDataFile.Close() + + var smartJson collector.SmartInfo + + smartDataBytes, err := ioutil.ReadAll(smartDataFile) + require.NoError(t, err) + err = json.Unmarshal(smartDataBytes, &smartJson) + require.NoError(t, err) + + //test + smartMdl := measurements.Smart{} + err = smartMdl.FromCollectorSmartInfo("WWN-test", smartJson) + + //assert + require.NoError(t, err) + require.Equal(t, "WWN-test", smartMdl.DeviceWWN) + require.Equal(t, pkg.DeviceStatusFailedScrutiny, smartMdl.Status) + require.Equal(t, int64(pkg.SmartAttributeStatusFailed), smartMdl.Attributes["199"].GetStatus(), + "scrutiny should detect that %d failed (status: %d, %s)", + smartMdl.Attributes["199"].(*measurements.SmartAtaAttribute).AttributeId, + smartMdl.Attributes["199"].GetStatus(), smartMdl.Attributes["199"].(*measurements.SmartAtaAttribute).StatusReason, + ) + + require.Equal(t, 14, len(smartMdl.Attributes)) +} + +//TODO: Scrutiny Warn +//TODO: Smart + Scrutiny Warn + +func TestFromCollectorSmartInfo_NVMe_Fail_Scrutiny(t *testing.T) { + //setup + smartDataFile, err := os.Open("../testdata/smart-nvme-failed.json") + require.NoError(t, err) + defer smartDataFile.Close() + + var smartJson collector.SmartInfo + + smartDataBytes, err := ioutil.ReadAll(smartDataFile) + require.NoError(t, err) + err = json.Unmarshal(smartDataBytes, &smartJson) + require.NoError(t, err) + + //test + smartMdl := measurements.Smart{} + err = smartMdl.FromCollectorSmartInfo("WWN-test", smartJson) + + //assert + require.NoError(t, err) + require.Equal(t, "WWN-test", smartMdl.DeviceWWN) + require.Equal(t, pkg.DeviceStatusFailedScrutiny, smartMdl.Status) + require.Equal(t, int64(pkg.SmartAttributeStatusFailed), smartMdl.Attributes["media_errors"].GetStatus(), + "scrutiny should detect that %s failed (status: %d, %s)", + smartMdl.Attributes["media_errors"].(*measurements.SmartNvmeAttribute).AttributeId, + smartMdl.Attributes["media_errors"].GetStatus(), + smartMdl.Attributes["media_errors"].(*measurements.SmartNvmeAttribute).StatusReason, + ) + + require.Equal(t, 16, len(smartMdl.Attributes)) +} + func TestFromCollectorSmartInfo_Nvme(t *testing.T) { //setup smartDataFile, err := os.Open("../testdata/smart-nvme.json") diff --git a/webapp/backend/pkg/models/testdata/smart-ata-failed-scrutiny.json b/webapp/backend/pkg/models/testdata/smart-ata-failed-scrutiny.json new file mode 100644 index 0000000..d0770e7 --- /dev/null +++ b/webapp/backend/pkg/models/testdata/smart-ata-failed-scrutiny.json @@ -0,0 +1,1162 @@ +{ + "json_format_version": [ + 1, + 0 + ], + "smartctl": { + "version": [ + 7, + 0 + ], + "svn_revision": "4883", + "platform_info": "x86_64-linux-5.13.0-40-generic", + "build_info": "(local build)", + "argv": [ + "smartctl", + "-x", + "-j", + "/dev/sda" + ], + "exit_status": 0 + }, + "device": { + "name": "/dev/sda", + "info_name": "/dev/sda [SAT]", + "type": "sat", + "protocol": "ATA" + }, + "model_family": "Samsung based SSDs", + "model_name": "Samsung SSD 840 Series", + "serial_number": "S14LNEACC02756X", + "wwn": { + "naa": 5, + "oui": 9528, + "id": 22817852457 + }, + "firmware_version": "DXT06B0Q", + "user_capacity": { + "blocks": 976773168, + "bytes": 500107862016 + }, + "logical_block_size": 512, + "physical_block_size": 512, + "rotation_rate": 0, + "in_smartctl_database": true, + "ata_version": { + "string": "ACS-2, ATA8-ACS T13/1699-D revision 4c", + "major_value": 1020, + "minor_value": 57 + }, + "sata_version": { + "string": "SATA 3.1", + "value": 127 + }, + "interface_speed": { + "max": { + "sata_value": 14, + "string": "6.0 Gb/s", + "units_per_second": 60, + "bits_per_unit": 100000000 + }, + "current": { + "sata_value": 3, + "string": "6.0 Gb/s", + "units_per_second": 60, + "bits_per_unit": 100000000 + } + }, + "local_time": { + "time_t": 1652219998, + "asctime": "Tue May 10 21:59:58 2022 UTC" + }, + "read_lookahead": { + "enabled": true + }, + "write_cache": { + "enabled": true + }, + "ata_security": { + "state": 41, + "string": "Disabled, frozen [SEC2]", + "enabled": false, + "frozen": true + }, + "smart_status": { + "passed": true + }, + "ata_smart_data": { + "offline_data_collection": { + "status": { + "value": 0, + "string": "was never started" + }, + "completion_seconds": 53956 + }, + "self_test": { + "status": { + "value": 0, + "string": "completed without error", + "passed": true + }, + "polling_minutes": { + "short": 2, + "extended": 70 + } + }, + "capabilities": { + "values": [ + 83, + 3 + ], + "exec_offline_immediate_supported": true, + "offline_is_aborted_upon_new_cmd": false, + "offline_surface_scan_supported": false, + "self_tests_supported": true, + "conveyance_self_test_supported": false, + "selective_self_test_supported": true, + "attribute_autosave_enabled": true, + "error_logging_supported": true, + "gp_logging_supported": true + } + }, + "ata_sct_capabilities": { + "value": 61, + "error_recovery_control_supported": true, + "feature_control_supported": true, + "data_table_supported": true + }, + "ata_smart_attributes": { + "revision": 1, + "table": [ + { + "id": 5, + "name": "Reallocated_Sector_Ct", + "value": 100, + "worst": 100, + "thresh": 10, + "when_failed": "", + "flags": { + "value": 51, + "string": "PO--CK ", + "prefailure": true, + "updated_online": true, + "performance": false, + "error_rate": false, + "event_count": true, + "auto_keep": true + }, + "raw": { + "value": 0, + "string": "0" + } + }, + { + "id": 9, + "name": "Power_On_Hours", + "value": 96, + "worst": 96, + "thresh": 0, + "when_failed": "", + "flags": { + "value": 50, + "string": "-O--CK ", + "prefailure": false, + "updated_online": true, + "performance": false, + "error_rate": false, + "event_count": true, + "auto_keep": true + }, + "raw": { + "value": 19497, + "string": "19497" + } + }, + { + "id": 12, + "name": "Power_Cycle_Count", + "value": 95, + "worst": 95, + "thresh": 0, + "when_failed": "", + "flags": { + "value": 50, + "string": "-O--CK ", + "prefailure": false, + "updated_online": true, + "performance": false, + "error_rate": false, + "event_count": true, + "auto_keep": true + }, + "raw": { + "value": 4169, + "string": "4169" + } + }, + { + "id": 177, + "name": "Wear_Leveling_Count", + "value": 98, + "worst": 98, + "thresh": 0, + "when_failed": "", + "flags": { + "value": 19, + "string": "PO--C- ", + "prefailure": true, + "updated_online": true, + "performance": false, + "error_rate": false, + "event_count": true, + "auto_keep": false + }, + "raw": { + "value": 14, + "string": "14" + } + }, + { + "id": 179, + "name": "Used_Rsvd_Blk_Cnt_Tot", + "value": 100, + "worst": 100, + "thresh": 10, + "when_failed": "", + "flags": { + "value": 19, + "string": "PO--C- ", + "prefailure": true, + "updated_online": true, + "performance": false, + "error_rate": false, + "event_count": true, + "auto_keep": false + }, + "raw": { + "value": 0, + "string": "0" + } + }, + { + "id": 181, + "name": "Program_Fail_Cnt_Total", + "value": 100, + "worst": 100, + "thresh": 10, + "when_failed": "", + "flags": { + "value": 50, + "string": "-O--CK ", + "prefailure": false, + "updated_online": true, + "performance": false, + "error_rate": false, + "event_count": true, + "auto_keep": true + }, + "raw": { + "value": 0, + "string": "0" + } + }, + { + "id": 182, + "name": "Erase_Fail_Count_Total", + "value": 100, + "worst": 100, + "thresh": 10, + "when_failed": "", + "flags": { + "value": 50, + "string": "-O--CK ", + "prefailure": false, + "updated_online": true, + "performance": false, + "error_rate": false, + "event_count": true, + "auto_keep": true + }, + "raw": { + "value": 0, + "string": "0" + } + }, + { + "id": 183, + "name": "Runtime_Bad_Block", + "value": 100, + "worst": 100, + "thresh": 10, + "when_failed": "", + "flags": { + "value": 19, + "string": "PO--C- ", + "prefailure": true, + "updated_online": true, + "performance": false, + "error_rate": false, + "event_count": true, + "auto_keep": false + }, + "raw": { + "value": 0, + "string": "0" + } + }, + { + "id": 187, + "name": "Uncorrectable_Error_Cnt", + "value": 100, + "worst": 100, + "thresh": 0, + "when_failed": "", + "flags": { + "value": 50, + "string": "-O--CK ", + "prefailure": false, + "updated_online": true, + "performance": false, + "error_rate": false, + "event_count": true, + "auto_keep": true + }, + "raw": { + "value": 0, + "string": "0" + } + }, + { + "id": 190, + "name": "Airflow_Temperature_Cel", + "value": 67, + "worst": 44, + "thresh": 0, + "when_failed": "", + "flags": { + "value": 50, + "string": "-O--CK ", + "prefailure": false, + "updated_online": true, + "performance": false, + "error_rate": false, + "event_count": true, + "auto_keep": true + }, + "raw": { + "value": 33, + "string": "33" + } + }, + { + "id": 195, + "name": "ECC_Error_Rate", + "value": 200, + "worst": 200, + "thresh": 0, + "when_failed": "", + "flags": { + "value": 26, + "string": "-O-RC- ", + "prefailure": false, + "updated_online": true, + "performance": false, + "error_rate": true, + "event_count": true, + "auto_keep": false + }, + "raw": { + "value": 0, + "string": "0" + } + }, + { + "id": 199, + "name": "CRC_Error_Count", + "value": 99, + "worst": 99, + "thresh": 0, + "when_failed": "", + "flags": { + "value": 62, + "string": "-OSRCK ", + "prefailure": false, + "updated_online": true, + "performance": true, + "error_rate": true, + "event_count": true, + "auto_keep": true + }, + "raw": { + "value": 108, + "string": "108" + } + }, + { + "id": 235, + "name": "POR_Recovery_Count", + "value": 99, + "worst": 99, + "thresh": 0, + "when_failed": "", + "flags": { + "value": 18, + "string": "-O--C- ", + "prefailure": false, + "updated_online": true, + "performance": false, + "error_rate": false, + "event_count": true, + "auto_keep": false + }, + "raw": { + "value": 3583, + "string": "3583" + } + }, + { + "id": 241, + "name": "Total_LBAs_Written", + "value": 99, + "worst": 99, + "thresh": 0, + "when_failed": "", + "flags": { + "value": 50, + "string": "-O--CK ", + "prefailure": false, + "updated_online": true, + "performance": false, + "error_rate": false, + "event_count": true, + "auto_keep": true + }, + "raw": { + "value": 10935822505, + "string": "10935822505" + } + } + ] + }, + "power_on_time": { + "hours": 19497 + }, + "power_cycle_count": 4169, + "temperature": { + "current": 33, + "power_cycle_min": 31, + "power_cycle_max": 44, + "lifetime_min": 0, + "lifetime_max": 70, + "op_limit_min": 0, + "op_limit_max": 70, + "limit_min": 0, + "limit_max": 70 + }, + "ata_log_directory": { + "gp_dir_version": 1, + "smart_dir_version": 1, + "smart_dir_multi_sector": true, + "table": [ + { + "address": 0, + "name": "Log Directory", + "read": true, + "write": false, + "gp_sectors": 1, + "smart_sectors": 1 + }, + { + "address": 1, + "name": "Summary SMART error log", + "read": true, + "write": false, + "gp_sectors": 1, + "smart_sectors": 1 + }, + { + "address": 2, + "name": "Comprehensive SMART error log", + "read": true, + "write": false, + "gp_sectors": 1, + "smart_sectors": 1 + }, + { + "address": 3, + "name": "Ext. Comprehensive SMART error log", + "read": true, + "write": false, + "gp_sectors": 1, + "smart_sectors": 1 + }, + { + "address": 6, + "name": "SMART self-test log", + "read": true, + "write": false, + "gp_sectors": 1, + "smart_sectors": 1 + }, + { + "address": 7, + "name": "Extended self-test log", + "read": true, + "write": false, + "gp_sectors": 1, + "smart_sectors": 1 + }, + { + "address": 9, + "name": "Selective self-test log", + "read": true, + "write": true, + "gp_sectors": 1, + "smart_sectors": 1 + }, + { + "address": 16, + "name": "NCQ Command Error log", + "read": true, + "write": false, + "gp_sectors": 1, + "smart_sectors": 1 + }, + { + "address": 17, + "name": "SATA Phy Event Counters log", + "read": true, + "write": false, + "gp_sectors": 1, + "smart_sectors": 1 + }, + { + "address": 48, + "name": "IDENTIFY DEVICE data log", + "read": true, + "write": false, + "gp_sectors": 1, + "smart_sectors": 1 + }, + { + "address": 128, + "name": "Host vendor specific log", + "read": true, + "write": true, + "gp_sectors": 16, + "smart_sectors": 16 + }, + { + "address": 129, + "name": "Host vendor specific log", + "read": true, + "write": true, + "gp_sectors": 16, + "smart_sectors": 16 + }, + { + "address": 130, + "name": "Host vendor specific log", + "read": true, + "write": true, + "gp_sectors": 16, + "smart_sectors": 16 + }, + { + "address": 131, + "name": "Host vendor specific log", + "read": true, + "write": true, + "gp_sectors": 16, + "smart_sectors": 16 + }, + { + "address": 132, + "name": "Host vendor specific log", + "read": true, + "write": true, + "gp_sectors": 16, + "smart_sectors": 16 + }, + { + "address": 133, + "name": "Host vendor specific log", + "read": true, + "write": true, + "gp_sectors": 16, + "smart_sectors": 16 + }, + { + "address": 134, + "name": "Host vendor specific log", + "read": true, + "write": true, + "gp_sectors": 16, + "smart_sectors": 16 + }, + { + "address": 135, + "name": "Host vendor specific log", + "read": true, + "write": true, + "gp_sectors": 16, + "smart_sectors": 16 + }, + { + "address": 136, + "name": "Host vendor specific log", + "read": true, + "write": true, + "gp_sectors": 16, + "smart_sectors": 16 + }, + { + "address": 137, + "name": "Host vendor specific log", + "read": true, + "write": true, + "gp_sectors": 16, + "smart_sectors": 16 + }, + { + "address": 138, + "name": "Host vendor specific log", + "read": true, + "write": true, + "gp_sectors": 16, + "smart_sectors": 16 + }, + { + "address": 139, + "name": "Host vendor specific log", + "read": true, + "write": true, + "gp_sectors": 16, + "smart_sectors": 16 + }, + { + "address": 140, + "name": "Host vendor specific log", + "read": true, + "write": true, + "gp_sectors": 16, + "smart_sectors": 16 + }, + { + "address": 141, + "name": "Host vendor specific log", + "read": true, + "write": true, + "gp_sectors": 16, + "smart_sectors": 16 + }, + { + "address": 142, + "name": "Host vendor specific log", + "read": true, + "write": true, + "gp_sectors": 16, + "smart_sectors": 16 + }, + { + "address": 143, + "name": "Host vendor specific log", + "read": true, + "write": true, + "gp_sectors": 16, + "smart_sectors": 16 + }, + { + "address": 144, + "name": "Host vendor specific log", + "read": true, + "write": true, + "gp_sectors": 16, + "smart_sectors": 16 + }, + { + "address": 145, + "name": "Host vendor specific log", + "read": true, + "write": true, + "gp_sectors": 16, + "smart_sectors": 16 + }, + { + "address": 146, + "name": "Host vendor specific log", + "read": true, + "write": true, + "gp_sectors": 16, + "smart_sectors": 16 + }, + { + "address": 147, + "name": "Host vendor specific log", + "read": true, + "write": true, + "gp_sectors": 16, + "smart_sectors": 16 + }, + { + "address": 148, + "name": "Host vendor specific log", + "read": true, + "write": true, + "gp_sectors": 16, + "smart_sectors": 16 + }, + { + "address": 149, + "name": "Host vendor specific log", + "read": true, + "write": true, + "gp_sectors": 16, + "smart_sectors": 16 + }, + { + "address": 150, + "name": "Host vendor specific log", + "read": true, + "write": true, + "gp_sectors": 16, + "smart_sectors": 16 + }, + { + "address": 151, + "name": "Host vendor specific log", + "read": true, + "write": true, + "gp_sectors": 16, + "smart_sectors": 16 + }, + { + "address": 152, + "name": "Host vendor specific log", + "read": true, + "write": true, + "gp_sectors": 16, + "smart_sectors": 16 + }, + { + "address": 153, + "name": "Host vendor specific log", + "read": true, + "write": true, + "gp_sectors": 16, + "smart_sectors": 16 + }, + { + "address": 154, + "name": "Host vendor specific log", + "read": true, + "write": true, + "gp_sectors": 16, + "smart_sectors": 16 + }, + { + "address": 155, + "name": "Host vendor specific log", + "read": true, + "write": true, + "gp_sectors": 16, + "smart_sectors": 16 + }, + { + "address": 156, + "name": "Host vendor specific log", + "read": true, + "write": true, + "gp_sectors": 16, + "smart_sectors": 16 + }, + { + "address": 157, + "name": "Host vendor specific log", + "read": true, + "write": true, + "gp_sectors": 16, + "smart_sectors": 16 + }, + { + "address": 158, + "name": "Host vendor specific log", + "read": true, + "write": true, + "gp_sectors": 16, + "smart_sectors": 16 + }, + { + "address": 159, + "name": "Host vendor specific log", + "read": true, + "write": true, + "gp_sectors": 16, + "smart_sectors": 16 + }, + { + "address": 160, + "name": "Device vendor specific log", + "gp_sectors": 16, + "smart_sectors": 16 + } + ] + }, + "ata_smart_error_log": { + "extended": { + "revision": 1, + "sectors": 1, + "count": 0 + } + }, + "ata_smart_self_test_log": { + "extended": { + "revision": 1, + "sectors": 1, + "count": 0 + } + }, + "ata_smart_selective_self_test_log": { + "revision": 1, + "table": [ + { + "lba_min": 0, + "lba_max": 0, + "status": { + "value": 0, + "string": "Not_testing" + } + }, + { + "lba_min": 0, + "lba_max": 0, + "status": { + "value": 0, + "string": "Not_testing" + } + }, + { + "lba_min": 0, + "lba_max": 0, + "status": { + "value": 0, + "string": "Not_testing" + } + }, + { + "lba_min": 0, + "lba_max": 0, + "status": { + "value": 0, + "string": "Not_testing" + } + }, + { + "lba_min": 0, + "lba_max": 0, + "status": { + "value": 0, + "string": "Not_testing" + } + } + ], + "current_read_scan": { + "lba_min": 0, + "lba_max": 65535, + "status": { + "value": 0, + "string": "was never started" + } + }, + "flags": { + "value": 0, + "remainder_scan_enabled": false + }, + "power_up_scan_resume_minutes": 0 + }, + "ata_sct_status": { + "format_version": 3, + "sct_version": 256, + "device_state": { + "value": 5, + "string": "SCT command executing in background" + }, + "temperature": { + "current": 33, + "power_cycle_min": 31, + "power_cycle_max": 44, + "lifetime_min": 0, + "lifetime_max": 70, + "under_limit_count": 0, + "over_limit_count": 0 + } + }, + "ata_sct_temperature_history": { + "version": 3, + "sampling_period_minutes": 1, + "logging_interval_minutes": 1, + "temperature": { + "op_limit_min": 0, + "op_limit_max": 70, + "limit_min": 0, + "limit_max": 70 + }, + "size": 128, + "index": 22, + "table": [ + 40, + 40, + 40, + 40, + 40, + 40, + 40, + 40, + 40, + 40, + 36, + 34, + 34, + 33, + 33, + 33, + 33, + 33, + 33, + 33, + 33, + 33, + 33, + 33, + 33, + 34, + 33, + 33, + 33, + 33, + 33, + 33, + 33, + 33, + 33, + 33, + 33, + 33, + 33, + 33, + 33, + 33, + 33, + 33, + 33, + 33, + 33, + 33, + 33, + 33, + 33, + 33, + 33, + 33, + 33, + 33, + 33, + 33, + 33, + 32, + 32, + 32, + 32, + 32, + 32, + 32, + 32, + 32, + 32, + 32, + 32, + 32, + 32, + 32, + 32, + 32, + 32, + 32, + 32, + 32, + 32, + 32, + 32, + 32, + 32, + 32, + 32, + 32, + 32, + 32, + 32, + 32, + 32, + 32, + 32, + 32, + 32, + 32, + 32, + 32, + 32, + 32, + 32, + 32, + 32, + 32, + 32, + 32, + 32, + 32, + 32, + 32, + 32, + 32, + 32, + 32, + 32, + 32, + 32, + 32, + 32, + 32, + 32, + 32, + 32, + 32, + 32, + 33 + ] + }, + "ata_sct_erc": { + "read": { + "enabled": false + }, + "write": { + "enabled": false + } + }, + "sata_phy_event_counters": { + "table": [ + { + "id": 1, + "name": "Command failed due to ICRC error", + "size": 2, + "value": 7, + "overflow": false + }, + { + "id": 2, + "name": "R_ERR response for data FIS", + "size": 2, + "value": 0, + "overflow": false + }, + { + "id": 3, + "name": "R_ERR response for device-to-host data FIS", + "size": 2, + "value": 0, + "overflow": false + }, + { + "id": 4, + "name": "R_ERR response for host-to-device data FIS", + "size": 2, + "value": 0, + "overflow": false + }, + { + "id": 5, + "name": "R_ERR response for non-data FIS", + "size": 2, + "value": 0, + "overflow": false + }, + { + "id": 6, + "name": "R_ERR response for device-to-host non-data FIS", + "size": 2, + "value": 0, + "overflow": false + }, + { + "id": 7, + "name": "R_ERR response for host-to-device non-data FIS", + "size": 2, + "value": 0, + "overflow": false + }, + { + "id": 8, + "name": "Device-to-host non-data FIS retries", + "size": 2, + "value": 0, + "overflow": false + }, + { + "id": 9, + "name": "Transition from drive PhyRdy to drive PhyNRdy", + "size": 2, + "value": 0, + "overflow": false + }, + { + "id": 10, + "name": "Device-to-host register FISes sent due to a COMRESET", + "size": 2, + "value": 14, + "overflow": false + }, + { + "id": 11, + "name": "CRC errors within host-to-device FIS", + "size": 2, + "value": 0, + "overflow": false + }, + { + "id": 13, + "name": "Non-CRC errors within host-to-device FIS", + "size": 2, + "value": 0, + "overflow": false + }, + { + "id": 15, + "name": "R_ERR response for host-to-device data FIS, CRC", + "size": 2, + "value": 0, + "overflow": false + }, + { + "id": 16, + "name": "R_ERR response for host-to-device data FIS, non-CRC", + "size": 2, + "value": 0, + "overflow": false + }, + { + "id": 18, + "name": "R_ERR response for host-to-device non-data FIS, CRC", + "size": 2, + "value": 0, + "overflow": false + }, + { + "id": 19, + "name": "R_ERR response for host-to-device non-data FIS, non-CRC", + "size": 2, + "value": 0, + "overflow": false + } + ], + "reset": false + } +} \ No newline at end of file diff --git a/webapp/backend/pkg/models/testdata/smart-nvme-failed.json b/webapp/backend/pkg/models/testdata/smart-nvme-failed.json new file mode 100644 index 0000000..0d036bd --- /dev/null +++ b/webapp/backend/pkg/models/testdata/smart-nvme-failed.json @@ -0,0 +1,107 @@ +{ + "json_format_version": [ + 1, + 0 + ], + "smartctl": { + "version": [ + 7, + 0 + ], + "svn_revision": "4883", + "platform_info": "x86_64-linux-5.13.0-40-generic", + "build_info": "(local build)", + "argv": [ + "smartctl", + "-x", + "-j", + "/dev/nvme0" + ], + "exit_status": 0 + }, + "device": { + "name": "/dev/nvme0", + "info_name": "/dev/nvme0", + "type": "nvme", + "protocol": "NVMe" + }, + "model_name": "Samsung SSD 970 EVO 500GB", + "serial_number": "S466NX0M776250H", + "firmware_version": "2B2QEXE7", + "nvme_pci_vendor": { + "id": 5197, + "subsystem_id": 5197 + }, + "nvme_ieee_oui_identifier": 9528, + "nvme_total_capacity": 500107862016, + "nvme_unallocated_capacity": 0, + "nvme_controller_id": 4, + "nvme_number_of_namespaces": 1, + "nvme_namespaces": [ + { + "id": 1, + "size": { + "blocks": 976773168, + "bytes": 500107862016 + }, + "capacity": { + "blocks": 976773168, + "bytes": 500107862016 + }, + "utilization": { + "blocks": 327275384, + "bytes": 167564996608 + }, + "formatted_lba_size": 512, + "eui64": { + "oui": 9528, + "ext_id": 376106710327 + } + } + ], + "user_capacity": { + "blocks": 976773168, + "bytes": 500107862016 + }, + "logical_block_size": 512, + "local_time": { + "time_t": 1652220188, + "asctime": "Tue May 10 22:03:08 2022 UTC" + }, + "smart_status": { + "passed": true, + "nvme": { + "value": 0 + } + }, + "nvme_smart_health_information_log": { + "critical_warning": 0, + "temperature": 35, + "available_spare": 99, + "available_spare_threshold": 10, + "percentage_used": 3, + "data_units_read": 17176794, + "data_units_written": 65602088, + "host_reads": 118020838, + "host_writes": 874050000, + "controller_busy_time": 7601, + "power_cycles": 25, + "power_on_hours": 12798, + "unsafe_shutdowns": 10, + "media_errors": 7, + "num_err_log_entries": 62, + "warning_temp_time": 0, + "critical_comp_time": 0, + "temperature_sensors": [ + 35, + 39 + ] + }, + "temperature": { + "current": 35 + }, + "power_cycle_count": 25, + "power_on_time": { + "hours": 12798 + } +} \ No newline at end of file diff --git a/webapp/frontend/src/app/modules/detail/detail.component.ts b/webapp/frontend/src/app/modules/detail/detail.component.ts index 6f03bb5..b50ad9b 100644 --- a/webapp/frontend/src/app/modules/detail/detail.component.ts +++ b/webapp/frontend/src/app/modules/detail/detail.component.ts @@ -111,9 +111,9 @@ export class DetailComponent implements OnInit, AfterViewInit, OnDestroy { if(attribute_status == 0){ return "passed" } else if (attribute_status == 1){ - return "warn" - } else if (attribute_status == 2){ return "failed" + } else if (attribute_status == 2){ + return "warn" } return }