[Git][NTPsec/ntpsec][master] temp-log.py: log all SMART drives found, not just the first.
Gary E. Miller
gitlab at mg.gitlab.com
Thu Jan 26 21:50:48 UTC 2017
Gary E. Miller pushed to branch master at NTPsec / ntpsec
Commits:
a77d52fb by James Browning at 2017-01-26T13:49:51-08:00
temp-log.py: log all SMART drives found, not just the first.
Signed-off-by: Gary E. Miller <gem at rellim.com>
- - - - -
1 changed file:
- contrib/temp-log.py
Changes:
=====================================
contrib/temp-log.py
=====================================
--- a/contrib/temp-log.py
+++ b/contrib/temp-log.py
@@ -65,16 +65,21 @@ class SmartCtl:
def get_data(self):
"Collects the data and return the output as an array"
- for _device in self._drives:
- _output = subprocess.check_output(["smartctl", "-a",
- _device],
- universal_newlines=True
- ).split('\n')
- for line in _output:
- if line.startswith('194 '):
- now = int(time.time())
- temp = line.split()[9]
- return ('%d %s %s' % (now, _device, temp))
+ out = ""
+ for _device in self._drives[:]:
+ try:
+ _output = subprocess.check_output(["smartctl", "-a",
+ _device],
+ universal_newlines=True
+ ).split('\n')
+ for line in _output:
+ if line.startswith('194 '):
+ now = int(time.time())
+ temp = line.split()[9]
+ out += ('%d %s %s\n' % (now, _device, temp))
+ except:
+ self._drives.remove(_device)
+ return out.rstrip()
class ZoneTemp:
View it on GitLab: https://gitlab.com/NTPsec/ntpsec/commit/a77d52fbc7e501e11f092d1c341e8b0282552db1
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.ntpsec.org/pipermail/vc/attachments/20170126/52aae63a/attachment.html>
More information about the vc
mailing list