Opened 3 years ago

Last modified 3 years ago

#1606 new enhancement

SCSI Selftest Log does not print when JSON format requested

Reported by: Marc Owned by:
Priority: minor Milestone: unscheduled
Component: smartctl Version:
Keywords: json scsi Cc:

Description (last modified by Christian Franke)

Running the command 'smartctl -jl selftest /dev/sdX' works as expected when the device is ATA/SATA but does not output the selftest log data in the JSON when the device is SCSI/SAS.

* Demonstration of Problem *

root@freenas:~ # smartctl -jl selftest /dev/da12
{
  "json_format_version": [
    1,
    0
  ],
  "smartctl": {
    "version": [
      7,
      2
    ],
    "svn_revision": "5155",
    "platform_info": "FreeBSD 12.2-RELEASE-p14 amd64",
    "build_info": "(local build)",
    "argv": [
      "smartctl",
      "-jl",
      "selftest",
      "/dev/da12"
    ],
    "exit_status": 0
  },
  "device": {
    "name": "/dev/da12",
    "info_name": "/dev/da12",
    "type": "scsi",
    "protocol": "SCSI"
  }
}

root@freenas:~ # smartctl -l selftest /dev/da12
smartctl 7.2 2020-12-30 r5155 [FreeBSD 12.2-RELEASE-p14 amd64] (local build)
Copyright (C) 2002-20, Bruce Allen, Christian Franke, www.smartmontools.org

=== START OF READ SMART DATA SECTION ===
SMART Self-test log
Num  Test              Status                 segment  LifeTime  LBA_first_err [SK ASC ASQ]
     Description                              number   (hours)
# 1  Background short  Completed                   -    6811                 - [-   -    -]
# 2  Background short  Completed                   -    6644                 - [-   -    -]
# 3  Background short  Completed                   -    6476                 - [-   -    -]
# 4  Background short  Completed                   -    6308                 - [-   -    -]
# 5  Background short  Completed                   -    6068                 - [-   -    -]
# 6  Background short  Completed                   -    5900                 - [-   -    -]
# 7  Background short  Completed                   -    5733                 - [-   -    -]
# 8  Background short  Completed                   -    5565                 - [-   -    -]
# 9  Background short  Completed                   -    5397                 - [-   -    -]
#10  Background short  Completed                   -    5229                 - [-   -    -]
#11  Background short  Completed                   -    5061                 - [-   -    -]
#12  Background short  Completed                   -    4893                 - [-   -    -]
#13  Background short  Completed                   -    4669                 - [-   -    -]
#14  Background short  Completed                   -    4501                 - [-   -    -]
#15  Background short  Completed                   -    4333                 - [-   -    -]
#16  Background short  Completed                   -    4165                 - [-   -    -]
#17  Background short  Completed                   -    3925                 - [-   -    -]
#18  Background short  Completed                   -    3757                 - [-   -    -]
#19  Background short  Completed                   -    3589                 - [-   -    -]
#20  Background short  Completed                   -    3421                 - [-   -    -]

Long (extended) Self-test duration: 6 seconds [0.1 minutes]

* Expected Behavior (captured from a SATA drive in the same machine) *

root@freenas:~ # smartctl -jl selftest /dev/ada0
{
  "json_format_version": [
    1,
    0
  ],
  "smartctl": {
    "version": [
      7,
      2
    ],
    "svn_revision": "5155",
    "platform_info": "FreeBSD 12.2-RELEASE-p14 amd64",
    "build_info": "(local build)",
    "argv": [
      "smartctl",
      "-jl",
      "selftest",
      "/dev/ada0"
    ],
    "exit_status": 0
  },
  "device": {
    "name": "/dev/ada0",
    "info_name": "/dev/ada0",
    "type": "atacam",
    "protocol": "ATA"
  },
  "ata_smart_self_test_log": {
    "standard": {
      "revision": 1,
      "table": [
        {
          "type": {
            "value": 3,
            "string": "Conveyance offline"
          },
          "status": {
            "value": 0,
            "string": "Completed without error",
            "passed": true
          },
          "lifetime_hours": 50987
        },
        {
          "type": {
            "value": 1,
            "string": "Short offline"
          },
          "status": {
            "value": 0,
            "string": "Completed without error",
            "passed": true
          },
          "lifetime_hours": 50908
        },
        {
          "type": {
            "value": 2,
            "string": "Extended offline"
          },
          "status": {
            "value": 0,
            "string": "Completed without error",
            "passed": true
          },
          "lifetime_hours": 50813
        },
        {
          "type": {
            "value": 1,
            "string": "Short offline"
          },
          "status": {
            "value": 0,
            "string": "Completed without error",
            "passed": true
          },
          "lifetime_hours": 50742
        },
        {
          "type": {
            "value": 1,
            "string": "Short offline"
          },
          "status": {
            "value": 0,
            "string": "Completed without error",
            "passed": true
          },
          "lifetime_hours": 50574
        },
        {
          "type": {
            "value": 2,
            "string": "Extended offline"
          },
          "status": {
            "value": 0,
            "string": "Completed without error",
            "passed": true
          },
          "lifetime_hours": 50479
        },
        {
          "type": {
            "value": 1,
            "string": "Short offline"
          },
          "status": {
            "value": 0,
            "string": "Completed without error",
            "passed": true
          },
          "lifetime_hours": 50407
        },
        {
          "type": {
            "value": 1,
            "string": "Short offline"
          },
          "status": {
            "value": 0,
            "string": "Completed without error",
            "passed": true
          },
          "lifetime_hours": 50169
        },
        {
          "type": {
            "value": 2,
            "string": "Extended offline"
          },
          "status": {
            "value": 0,
            "string": "Completed without error",
            "passed": true
          },
          "lifetime_hours": 50073
        },
        {
          "type": {
            "value": 1,
            "string": "Short offline"
          },
          "status": {
            "value": 0,
            "string": "Completed without error",
            "passed": true
          },
          "lifetime_hours": 50001
        },
        {
          "type": {
            "value": 1,
            "string": "Short offline"
          },
          "status": {
            "value": 0,
            "string": "Completed without error",
            "passed": true
          },
          "lifetime_hours": 49835
        },
        {
          "type": {
            "value": 2,
            "string": "Extended offline"
          },
          "status": {
            "value": 0,
            "string": "Completed without error",
            "passed": true
          },
          "lifetime_hours": 49740
        },
        {
          "type": {
            "value": 1,
            "string": "Short offline"
          },
          "status": {
            "value": 0,
            "string": "Completed without error",
            "passed": true
          },
          "lifetime_hours": 49668
        },
        {
          "type": {
            "value": 1,
            "string": "Short offline"
          },
          "status": {
            "value": 0,
            "string": "Completed without error",
            "passed": true
          },
          "lifetime_hours": 49501
        },
        {
          "type": {
            "value": 2,
            "string": "Extended offline"
          },
          "status": {
            "value": 0,
            "string": "Completed without error",
            "passed": true
          },
          "lifetime_hours": 49405
        },
        {
          "type": {
            "value": 1,
            "string": "Short offline"
          },
          "status": {
            "value": 0,
            "string": "Completed without error",
            "passed": true
          },
          "lifetime_hours": 49334
        },
        {
          "type": {
            "value": 1,
            "string": "Short offline"
          },
          "status": {
            "value": 0,
            "string": "Completed without error",
            "passed": true
          },
          "lifetime_hours": 49167
        },
        {
          "type": {
            "value": 2,
            "string": "Extended offline"
          },
          "status": {
            "value": 0,
            "string": "Completed without error",
            "passed": true
          },
          "lifetime_hours": 49071
        },
        {
          "type": {
            "value": 1,
            "string": "Short offline"
          },
          "status": {
            "value": 0,
            "string": "Completed without error",
            "passed": true
          },
          "lifetime_hours": 48999
        },
        {
          "type": {
            "value": 1,
            "string": "Short offline"
          },
          "status": {
            "value": 0,
            "string": "Completed without error",
            "passed": true
          },
          "lifetime_hours": 48776
        },
        {
          "type": {
            "value": 2,
            "string": "Extended offline"
          },
          "status": {
            "value": 0,
            "string": "Completed without error",
            "passed": true
          },
          "lifetime_hours": 48681
        }
      ],
      "count": 21,
      "error_count_total": 0,
      "error_count_outdated": 0
    }
  }
}

Change History (3)

comment:1 by Christian Franke, 3 years ago

Description: modified (diff)

comment:2 by Christian Franke, 3 years ago

Keywords: selftest sas removed
Milestone: unscheduled
Summary: Selftest Log does not print when JSON format requestedSCSI Selftest Log does not print when JSON format requested
Type: defectenhancement

comment:3 by Marc, 3 years ago

I don't know if I should create a new ticket or just leave this comment, but I discovered that there is similar behavior (missing data in the SCSI json output) for the 'smartctl -jl error' and 'smartctl -jA' outputs.

When outputting the error log normally, it contains a line "Non-medium error count: 0". When outputting in json format the non-medium error count is not present, and I would request that it be added.

When outputting the -A SMART information normally it outputs 7 lines in addition to the temperature:

Accumulated power on time, hours:minutes 6947:07
Manufactured in week 03 of year 2014
Specified cycle count over device lifetime:  50000
Accumulated start-stop cycles:  45
Specified load-unload count over device lifetime:  600000
Accumulated load-unload cycles:  2802
Elements in grown defect list: 0

When outputting -A in json mode you only get the grown defect count and the power on hours:mins. The other 5 data points are not included. I would request that at least the two 'Accumulated' values be added to the json output, the other 3 are not as important IMHO.

Last edited 3 years ago by Marc (previous) (diff)
Note: See TracTickets for help on using tickets.