Opened 2 weeks ago

Closed 11 days ago

Last modified 11 days ago

#1164 closed defect (invalid)

Incorrect value in SMART attribute 190 when using JSON output

Reported by: Christian Turri Owned by:
Priority: minor Milestone:
Component: smartctl Version: 7.0
Keywords: Cc:

Description

Hi, I am using the new -j option to output the smartctl data as JSON and I noticed that the parameter 190 (Airflow_Temperature_Cel) raw value is incorrect when the output is JSON. If I ran this:

smartctl -a /dev/ada0

I get

ID# ATTRIBUTE_NAME          FLAG     VALUE WORST THRESH TYPE      UPDATED  WHEN_FAILED RAW_VALUE
190 Airflow_Temperature_Cel 0x0022   058   043   045    Old_age   Always   In_the_past 42 (Min/Max 23/42 #102)

but I run it with the -j option I get this:

      {
        "id": 190,
        "name": "Airflow_Temperature_Cel",
        "value": 58,
        "worst": 43,
        "thresh": 45,
        "when_failed": "past",
        "flags": {
          "value": 34,
          "string": "-O---K ",
          "prefailure": false,
          "updated_online": true,
          "performance": false,
          "error_rate": false,
          "event_count": false,
          "auto_keep": true
        },
        "raw": {
          "value": 438792814634,
          "string": "42 (Min/Max 23/42 #102)"
        }

The raw value being 438792814634 but the expected raw value is 42. I am running version 7.1 svn_revision 4891. Thanks

Change History (4)

comment:1 Changed 2 weeks ago by Christian Franke

This is as expected. The field ata_smart_attributes.table[i].raw.value is the 48-bit raw value as returned by the drive. It is vendor specific and may encode more than one value (438792814634 = 0x00662a17002a):

00 66 2a 17 00 2a
               ^^--- Current temperature
            ^^------ Unknown (high byte of temperature or always 0 or vendor specific)
         ^^--------- Min temperature
      ^^------------ Max temperature
^^.^^--------------- possible over limit count or other vendor specific value

If there is a real need to read the current temperature from this specific attribute, use value & 0xff.

Otherwise it is recommended to use JSON field temperature.current instead. This also evaluates standardized ATA/SATA temperature sources (SCT Status, Device Statistics) and also works for SCSI/SAS and NVMe devices.

Same applies to power_on_time.hours (instead of attribute 9) and power_cycle_count (instead of attribute 12).

PS: Hint for future tickets: please don't set a milestone.

comment:2 Changed 11 days ago by Christian Turri

Thanks for the quick reply. I guess the issue is that the non JSON output is a bit inconsistent with a the JSON output as the raw column in the regular output is not really a raw column but the string interpretation. Thanks for the info, will switch to the standardized values as I don't really the raw values.

comment:3 Changed 11 days ago by Christian Turri

Resolution: invalid
Status: newclosed

comment:4 Changed 11 days ago by Christian Franke

Milestone: undecided
Note: See TracTickets for help on using tickets.