Browse Source

Improved parsing of information section for pass-through devices behind areca raid controllers

tags/0.1
Johann Schmitz 4 years ago
parent
commit
8e63585523

+ 2
- 2
src/smartcheck/check.py View File

@@ -9,8 +9,8 @@ TESTS_SECTION_START = 'SMART Self-test log structure revision number'

INFORMATION_RE = [
("model_family", re.compile('Model Family: (.*)', re.UNICODE)),
("device_model", re.compile("Device Model: (.*)", re.UNICODE)),
("serial", re.compile("Serial Number: (.*)", re.UNICODE)),
("device_model", re.compile("(?:Device Model|Product): (.*)", re.UNICODE)),
("serial", re.compile("Serial Number: (.*)", re.UNICODE | re.IGNORECASE)),
("firmware_version", re.compile("Firmware version: (.*)", re.UNICODE)),
("ata_version", re.compile("ATA Version is: (.*)", re.UNICODE)),
("sata_version", re.compile("SATA Version is: (.*)", re.UNICODE)),

+ 5
- 2
src/smartcheck/main.py View File

@@ -15,6 +15,9 @@ if __name__ == "__main__":
check = SMARTCheck(open(args.file, 'r'), args.data_file)

import pprint
#pprint.pprint(check.information)
pprint.pprint(check.information)
if not check.information:
import sys
sys.exit(1)
#pprint.pprint(check.smart_data)
pprint.pprint(check.self_tests)
#pprint.pprint(check.self_tests)

+ 7
- 0
tests/parsing.py View File

@@ -24,6 +24,10 @@ class InformationBlockParsingTest(unittest.TestCase):
'sata_version': 'SATA 3.0, 6.0 Gb/s (current: 6.0 Gb/s)',
'serial': 'Z1F23HW0'
}),
('areca-WD40EFRX.txt', {
'device_model': 'WD40EFRX-68WT0N0',
'serial': 'WD-WCC4E0664813'
}),
]:

check = SMARTCheck(open(os.path.join(samples_path, filename)))
@@ -33,6 +37,9 @@ class InformationBlockParsingTest(unittest.TestCase):
check = SMARTCheck(StringIO(""))
self.assertDictEqual(check.information, {})

def test_information_section_missing(self):
check = SMARTCheck(open(os.path.join(samples_path, 'no-information-section.txt')))
self.assertDictEqual(check.information, {})

class SMARTDataParsingTest(unittest.TestCase):
def test_parsing(self):

+ 41
- 0
tests/samples/areca-WD40EFRX.txt View File

@@ -0,0 +1,41 @@
smartctl 6.3 2014-07-26 r3976 [x86_64-linux-3.18.9-hardened-1] (local build)
Copyright (C) 2002-14, Bruce Allen, Christian Franke, www.smartmontools.org
=== START OF INFORMATION SECTION ===
Vendor: WDC
Product: WD40EFRX-68WT0N0
Revision: R001
User Capacity: 4,000,787,030,016 bytes [4.00 TB]
Logical block size: 512 bytes
Rotation Rate: 10000 rpm
Logical Unit id: 0x001b4d2101326800
Serial number: WD-WCC4E0664813
Device type: disk
Transport protocol: Fibre channel (FCP-2)
Local Time is: Wed Oct 21 13:17:12 2015 CEST
SMART support is: Available - device has SMART capability.
SMART support is: Enabled
Temperature Warning: Disabled or Not Supported
=== START OF READ SMART DATA SECTION ===
SMART Health Status: OK
Current Drive Temperature: 30 C
Drive Trip Temperature: 25 C
Manufactured in week 30 of year 2002
Specified cycle count over device lifetime: 4278190080
Accumulated start-stop cycles: 256
Elements in grown defect list: 0
Error counter log:
Errors Corrected by Total Correction Gigabytes Total
ECC rereads/ errors algorithm processed uncorrected
fast | delayed rewrites corrected invocations [10^9 bytes] errors
read: 0 0 0 0 0 0.000 0
write: 0 0 0 0 0 0.000 0
Non-medium error count: 0
Device does not support Self Test logging

+ 25
- 0
tests/samples/no-information-section.txt View File

@@ -0,0 +1,25 @@
smartctl 6.3 2014-07-26 r3976 [x86_64-linux-3.18.9-hardened-1] (local build)
Copyright (C) 2002-14, Bruce Allen, Christian Franke, www.smartmontools.org
=== START OF READ SMART DATA SECTION ===
SMART Health Status: OK
Current Drive Temperature: 30 C
Drive Trip Temperature: 25 C
Manufactured in week 30 of year 2002
Specified cycle count over device lifetime: 4278190080
Accumulated start-stop cycles: 256
Elements in grown defect list: 0
Error counter log:
Errors Corrected by Total Correction Gigabytes Total
ECC rereads/ errors algorithm processed uncorrected
fast | delayed rewrites corrected invocations [10^9 bytes] errors
read: 0 0 0 0 0 0.000 0
write: 0 0 0 0 0 0.000 0
Non-medium error count: 0
Device does not support Self Test logging

Loading…
Cancel
Save