This commit is contained in:
Daniel Langbein 2023-10-08 16:15:32 +02:00
parent 1997e35ed3
commit be10017165
Signed by: langfingaz
GPG Key ID: 6C47C753F0823002
2 changed files with 8 additions and 2 deletions

View File

@ -3,7 +3,7 @@
[metadata]
name = de.p1st.monitor
version = 0.10.5
version = 0.10.6
author = Daniel Langbein
author_email = daniel@systemli.org
description = periodically monitor and warn

View File

@ -150,4 +150,10 @@ class DriveLogger(Logger):
raise LoggerReadEx(f'smartctl failed with returncode {returncode}\nstdout: {stdout}\nstderr: {stderr}')
j = json.loads(stdout)
return j['temperature']['current']
temp_key = 'temperature'
if temp_key not in j:
raise LoggerReadEx(f'smartctl JSON does not contain key {temp_key}. {device}')
current_key = 'current'
if current_key not in j[temp_key]:
raise LoggerReadEx(f'smartctl JSON does not contain key {temp_key}.{current_key}. {device}')
return j[temp_key][current_key]