Opened 4 months ago

Last modified 4 months ago

#1165 new enhancement

Set JSON value 'power_on_time.hours' if raw value also contains milliseconds

Reported by: Christian Turri Owned by:
Priority: minor Milestone: Release 7.1
Component: smartctl Version: 7.0
Keywords: json ata Cc:

Description

Following ticket #1164 I am now using the standardised values for power_cycle_count, power_on_time.hours and temperature.current from the JSON output instead of the relevant SMART attribute raw values. This is working work fine for all but a particular Seagate disk model (ST10000VX0004) where I get no value in the JSON output for power_on_time.hours. Below is the full JSON output. Any ideas?

{
  "json_format_version": [
    1,
    0
  ],
  "smartctl": {
    "version": [
      7,
      1
    ],
    "svn_revision": "4891",
    "platform_info": "FreeBSD 11.2-STABLE amd64",
    "build_info": "(CircleCI)",
    "argv": [
      "smartctl",
      "-a",
      "-j",
      "/dev/ada5"
    ],
    "exit_status": 0
  },
  "device": {
    "name": "/dev/ada5",
    "info_name": "/dev/ada5",
    "type": "atacam",
    "protocol": "ATA"
  },
  "model_name": "ST10000VX0004-1ZE101",
  "serial_number": "ZA28DB5C",
  "wwn": {
    "naa": 5,
    "oui": 3152,
    "id": 2990796275
  },
  "firmware_version": "AV01",
  "user_capacity": {
    "blocks": 19532873728,
    "bytes": 10000831348736
  },
  "logical_block_size": 512,
  "physical_block_size": 4096,
  "rotation_rate": 7200,
  "form_factor": {
    "ata_value": 2,
    "name": "3.5 inches"
  },
  "in_smartctl_database": false,
  "ata_version": {
    "string": "ACS-3 T13/2161-D revision 5",
    "major_value": 2032,
    "minor_value": 109
  },
  "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": 1549917425,
    "asctime": "Mon Feb 11 20:37:05 2019 GMT"
  },
  "smart_status": {
    "passed": true
  },
  "ata_smart_data": {
    "offline_data_collection": {
      "status": {
        "value": 130,
        "string": "was completed without error",
        "passed": true
      },
      "completion_seconds": 584
    },
    "self_test": {
      "status": {
        "value": 0,
        "string": "completed without error",
        "passed": true
      },
      "polling_minutes": {
        "short": 1,
        "extended": 876,
        "conveyance": 2
      }
    },
    "capabilities": {
      "values": [
        123,
        3
      ],
      "exec_offline_immediate_supported": true,
      "offline_is_aborted_upon_new_cmd": false,
      "offline_surface_scan_supported": true,
      "self_tests_supported": true,
      "conveyance_self_test_supported": true,
      "selective_self_test_supported": true,
      "attribute_autosave_enabled": true,
      "error_logging_supported": true,
      "gp_logging_supported": true
    }
  },
  "ata_sct_capabilities": {
    "value": 20669,
    "error_recovery_control_supported": true,
    "feature_control_supported": true,
    "data_table_supported": true
  },
  "ata_smart_attributes": {
    "revision": 10,
    "table": [
      {
        "id": 1,
        "name": "Raw_Read_Error_Rate",
        "value": 83,
        "worst": 64,
        "thresh": 44,
        "when_failed": "",
        "flags": {
          "value": 15,
          "string": "POSR-- ",
          "prefailure": true,
          "updated_online": true,
          "performance": true,
          "error_rate": true,
          "event_count": false,
          "auto_keep": false
        },
        "raw": {
          "value": 197743893,
          "string": "197743893"
        }
      },
      {
        "id": 3,
        "name": "Spin_Up_Time",
        "value": 88,
        "worst": 87,
        "thresh": 0,
        "when_failed": "",
        "flags": {
          "value": 3,
          "string": "PO---- ",
          "prefailure": true,
          "updated_online": true,
          "performance": false,
          "error_rate": false,
          "event_count": false,
          "auto_keep": false
        },
        "raw": {
          "value": 0,
          "string": "0"
        }
      },
      {
        "id": 4,
        "name": "Start_Stop_Count",
        "value": 100,
        "worst": 100,
        "thresh": 20,
        "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": 21,
          "string": "21"
        }
      },
      {
        "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": 7,
        "name": "Seek_Error_Rate",
        "value": 79,
        "worst": 60,
        "thresh": 45,
        "when_failed": "",
        "flags": {
          "value": 15,
          "string": "POSR-- ",
          "prefailure": true,
          "updated_online": true,
          "performance": true,
          "error_rate": true,
          "event_count": false,
          "auto_keep": false
        },
        "raw": {
          "value": 78687558,
          "string": "78687558"
        }
      },
      {
        "id": 9,
        "name": "Power_On_Hours",
        "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": 238263310746167,
          "string": "567 (216 179 0)"
        }
      },
      {
        "id": 10,
        "name": "Spin_Retry_Count",
        "value": 100,
        "worst": 100,
        "thresh": 97,
        "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": 12,
        "name": "Power_Cycle_Count",
        "value": 100,
        "worst": 100,
        "thresh": 20,
        "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": 21,
          "string": "21"
        }
      },
      {
        "id": 184,
        "name": "End-to-End_Error",
        "value": 100,
        "worst": 100,
        "thresh": 99,
        "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": 187,
        "name": "Reported_Uncorrect",
        "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": 188,
        "name": "Command_Timeout",
        "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": 189,
        "name": "High_Fly_Writes",
        "value": 74,
        "worst": 74,
        "thresh": 0,
        "when_failed": "",
        "flags": {
          "value": 58,
          "string": "-O-RCK ",
          "prefailure": false,
          "updated_online": true,
          "performance": false,
          "error_rate": true,
          "event_count": true,
          "auto_keep": true
        },
        "raw": {
          "value": 26,
          "string": "26"
        }
      },
      {
        "id": 190,
        "name": "Airflow_Temperature_Cel",
        "value": 78,
        "worst": 57,
        "thresh": 40,
        "when_failed": "",
        "flags": {
          "value": 34,
          "string": "-O---K ",
          "prefailure": false,
          "updated_online": true,
          "performance": false,
          "error_rate": false,
          "event_count": false,
          "auto_keep": true
        },
        "raw": {
          "value": 387252246,
          "string": "22 (Min/Max 21/23)"
        }
      },
      {
        "id": 191,
        "name": "G-Sense_Error_Rate",
        "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": 802,
          "string": "802"
        }
      },
      {
        "id": 192,
        "name": "Power-Off_Retract_Count",
        "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": 12,
          "string": "12"
        }
      },
      {
        "id": 193,
        "name": "Load_Cycle_Count",
        "value": 97,
        "worst": 97,
        "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": 6103,
          "string": "6103"
        }
      },
      {
        "id": 194,
        "name": "Temperature_Celsius",
        "value": 22,
        "worst": 43,
        "thresh": 0,
        "when_failed": "",
        "flags": {
          "value": 34,
          "string": "-O---K ",
          "prefailure": false,
          "updated_online": true,
          "performance": false,
          "error_rate": false,
          "event_count": false,
          "auto_keep": true
        },
        "raw": {
          "value": 85899345942,
          "string": "22 (0 20 0 0 0)"
        }
      },
      {
        "id": 195,
        "name": "Hardware_ECC_Recovered",
        "value": 30,
        "worst": 1,
        "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": 197743893,
          "string": "197743893"
        }
      },
      {
        "id": 197,
        "name": "Current_Pending_Sector",
        "value": 100,
        "worst": 100,
        "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": 0,
          "string": "0"
        }
      },
      {
        "id": 198,
        "name": "Offline_Uncorrectable",
        "value": 100,
        "worst": 100,
        "thresh": 0,
        "when_failed": "",
        "flags": {
          "value": 16,
          "string": "----C- ",
          "prefailure": false,
          "updated_online": false,
          "performance": false,
          "error_rate": false,
          "event_count": true,
          "auto_keep": false
        },
        "raw": {
          "value": 0,
          "string": "0"
        }
      },
      {
        "id": 199,
        "name": "UDMA_CRC_Error_Count",
        "value": 200,
        "worst": 200,
        "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": 0,
          "string": "0"
        }
      },
      {
        "id": 200,
        "name": "Multi_Zone_Error_Rate",
        "value": 100,
        "worst": 100,
        "thresh": 1,
        "when_failed": "",
        "flags": {
          "value": 35,
          "string": "PO---K ",
          "prefailure": true,
          "updated_online": true,
          "performance": false,
          "error_rate": false,
          "event_count": false,
          "auto_keep": true
        },
        "raw": {
          "value": 0,
          "string": "0"
        }
      },
      {
        "id": 240,
        "name": "Head_Flying_Hours",
        "value": 100,
        "worst": 253,
        "thresh": 0,
        "when_failed": "",
        "flags": {
          "value": 0,
          "string": "------ ",
          "prefailure": false,
          "updated_online": false,
          "performance": false,
          "error_rate": false,
          "event_count": false,
          "auto_keep": false
        },
        "raw": {
          "value": 214112709640468,
          "string": "276 (194 188 0)"
        }
      },
      {
        "id": 241,
        "name": "Total_LBAs_Written",
        "value": 100,
        "worst": 253,
        "thresh": 0,
        "when_failed": "",
        "flags": {
          "value": 0,
          "string": "------ ",
          "prefailure": false,
          "updated_online": false,
          "performance": false,
          "error_rate": false,
          "event_count": false,
          "auto_keep": false
        },
        "raw": {
          "value": 35285723413,
          "string": "35285723413"
        }
      },
      {
        "id": 242,
        "name": "Total_LBAs_Read",
        "value": 100,
        "worst": 253,
        "thresh": 0,
        "when_failed": "",
        "flags": {
          "value": 0,
          "string": "------ ",
          "prefailure": false,
          "updated_online": false,
          "performance": false,
          "error_rate": false,
          "event_count": false,
          "auto_keep": false
        },
        "raw": {
          "value": 9860969783,
          "string": "9860969783"
        }
      }
    ]
  },
  "power_cycle_count": 21,
  "temperature": {
    "current": 22
  },
  "ata_smart_error_log": {
    "summary": {
      "revision": 1,
      "count": 0
    }
  },
  "ata_smart_self_test_log": {
    "standard": {
      "revision": 1,
      "table": [
        {
          "type": {
            "value": 1,
            "string": "Short offline"
          },
          "status": {
            "value": 0,
            "string": "Completed without error",
            "passed": true
          },
          "lifetime_hours": 567
        }
      ],
      "count": 1,
      "error_count_total": 0,
      "error_count_outdated": 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"
        }
      }
    ],
    "flags": {
      "value": 0,
      "remainder_scan_enabled": false
    },
    "power_up_scan_resume_minutes": 0
  }
}

Change History (4)

comment:1 Changed 4 months ago by Christian Turri

In case it helps I noticed that the raw value on the disk where power_on_time.hours is not present in the JSON output is different than on disks where the value is present:

power_on_time.hours is not present in the JSON output:

"raw": {

"value": 238263310746167,
"string": "567 (216 179 0)"

power_on_time.hours is present in the JSON output:

"raw": {

"value": 13395,
"string": "13395"

In other words it seems that when raw.value = raw.string then power_on_time.hours is in the output.

comment:2 Changed 4 months ago by Christian Franke

Milestone: undecided

Again this is as expected. The attribute 9 raw value uses a strange format, therefore it is not copied to power_on_time.hours.

Actually "standardized" power on hours info is only available from ATA Device Statistics (-l devstat, included in -x) which was not requested above. Option -a only reads legacy ATA SMART info.

Please try -v 9,msec24hour32 which selects an unusual 56-bit power on time format originally invented by SandForce and also used by very few Intel and Seagate drives. No attempt is made to detect this format heuristically.

If this option works, we could later add this option to a new drive database entry. Meantime, you could add a local database entry (/etc/smart_drivedb.h, see -B option on smartctl man page).

Leaving ticket as "undecided" for now because drive is not in database and it may be possible to set power_on_time.hours heuristically.

comment:3 Changed 4 months ago by Christian Turri

Hi, sorry for the delay in replying, I have been busy on other things.

I think the -v 9,msec24hour32 works. With -a -j -v 9,msec24hour32I get:

  "power_on_time": {
    "hours": 734,
    "minutes": 7
  },

So power_on_time.hours is now present and correct although I get an extra minutes attribute (which is fine as I don't really need it or care about it). With -a -v 9,msec24hour32 I also see the minutes on the raw attribute 9 in an H+M+S format:

ID# ATTRIBUTE_NAME          FLAG     VALUE WORST THRESH TYPE      UPDATED  WHEN_FAILED RAW_VALUE
  9 Power_On_Hours          0x0032   100   100   000    Old_age   Always       -       734h+07m+07.257s

Let me know if you want me to send the drive details to the ​smartmontools-database mailing list as per your wiki FAQ page. Thanks

comment:4 Changed 4 months ago by Christian Franke

Keywords: json ata added
Milestone: undecidedRelease 7.1
Summary: Standardised power_on_time.hours not returned in JSON output for particular Seagate diskSet JSON value 'power_on_time.hours' if raw value also contains milliseconds
Type: defectenhancement

Thanks for the feedback (BTW: --json=o adds old output to JSON).

For such drives, it makes sense to set power_on_time.hours even if no drive database entry exists. Changing summary accordingly.

Additional info for a drive database entry is not needed, the JSON output above is sufficient.

Note: See TracTickets for help on using tickets.