SMARTctl - command /sbin/smartctl -a {device}

class insights.parsers.smartctl.SMARTctl(context)[source]

Bases: CommandParser

Parser for output of smartctl -a for each drive in system.

This stores the information from the output of smartctl in the following properties:

  • device - the name of the device after /dev/ - e.g. sda

  • information - the -i info (vendor, product, etc)

  • health - overall health assessment (-H)

  • values - the SMART values (-c) - SMART config on drive firmware

  • attributes - the SMART attributes (-A) - run time data

For legacy access, these are also available as values in the info dictionary property, keyed to their name (i.e. info[‘device’])

Each object contains a different device; the shared information for this parser in Insights will be one or more devices, so see the example below for how to iterate through the available SMARTctl information for each device.

Sample (abbreviated) output:

smartctl 6.2 2013-07-26 r3841 [x86_64-linux-3.10.0-267.el7.x86_64] (local build)
Copyright (C) 2002-13, Bruce Allen, Christian Franke, www.smartmontools.org

=== START OF INFORMATION SECTION ===
Device Model:     ST500LM021-1KJ152
Serial Number:    W620AT02
LU WWN Device Id: 5 000c50 07817bb36
...

=== START OF READ SMART DATA SECTION ===
SMART overall-health self-assessment test result: PASSED

General SMART Values:
Offline data collection status:  (0x00) Offline data collection activity
                    was never started.
                    Auto Offline Data Collection: Disabled.
...

SMART Attributes Data Structure revision number: 10
Vendor Specific SMART Attributes with Thresholds:
ID# ATTRIBUTE_NAME          FLAG     VALUE WORST THRESH TYPE      UPDATED  WHEN_FAILED RAW_VALUE
  1 Raw_Read_Error_Rate     0x000f   118   099   034    Pre-fail  Always       -       179599704
  3 Spin_Up_Time            0x0003   098   098   000    Pre-fail  Always       -       0
  4 Start_Stop_Count        0x0032   100   100   020    Old_age   Always       -       546
  5 Reallocated_Sector_Ct   0x0033   100   100   036    Pre-fail  Always       -       0
...

Examples

>>> for drive in shared[SMARTctl]:
...     print "Device:", drive.device
...     print "Model:", drive.information['Device Model']
...     print "Health check:", drive.health
...     print "Last self-test status:", drive.values['Self-test execution status']
...     print "Raw read error rate:", drive.attributes['Raw_Read_Error_Rate']['RAW_VALUE']
...
Device: /dev/sda
Model: ST500LM021-1KJ152
Health check: PASSED
Last self-test status: 0
Raw read error rate: 179599704
parse_content(content)[source]

This method must be implemented by classes based on this class.