From 70e2a16038d52d8f00a4af0ca7eb7c036feefaba Mon Sep 17 00:00:00 2001 From: Daniel Langbein Date: Wed, 9 Aug 2023 11:41:23 +0200 Subject: [PATCH] feat: read out less (unnecessary) SMART data --- src/de/p1st/monitor/loggers/drive.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/de/p1st/monitor/loggers/drive.py b/src/de/p1st/monitor/loggers/drive.py index 9ad24ea..3944dc8 100644 --- a/src/de/p1st/monitor/loggers/drive.py +++ b/src/de/p1st/monitor/loggers/drive.py @@ -96,7 +96,13 @@ class DriveLogger(Logger): :param device: For example `/dev/sda` or `/dev/disk/by-uuid/` :return: Temperature in celsius """ - returncode, stdout, stderr = execute_capture(['smartctl', '-j', '-a', f'{device}']) + + # -j: JSON output. + # -a: Print all SMART device information. + # For NVMe, this is equivalent to: '-H -i -c -A -l error -l selftest'. + # -H: Print health status. + # -A: Prints only the vendor specific SMART Attributes. + returncode, stdout, stderr = execute_capture(['smartctl', '-j', '-A', f'{device}']) if returncode != 0: raise LoggerReadEx(f'smartctl failed with returncode {returncode}\nstdout: {stdout}\nstderr: {stderr}')