Fixed cpu high and cpu crit for osx and raspberry pi

pull/81/head
aristocratos 2020-08-11 21:37:57 +02:00
parent 739eeca3b7
commit 38d9e97504
1 changed files with 7 additions and 1 deletions

View File

@ -2539,9 +2539,15 @@ class CpuCollector(Collector):
else:
try:
if cls.sensor_method == "osx-cpu-temp":
temp = round(float(subprocess.check_output("osx-cpu-temp", text=True).strip().rstrip("°C")))
temp = round(float(subprocess.check_output("osx-cpu-temp", text=True).strip()[:-2]))
if not cls.cpu_temp_high:
cls.cpu_temp_high = 85
cls.cpu_temp_crit = 100
elif cls.sensor_method == "vcgencmd":
temp = round(float(subprocess.check_output(["vcgencmd", "measure_temp"], text=True).strip()[5:-2]))
if not cls.cpu_temp_high:
cls.cpu_temp_high = 60
cls.cpu_temp_crit = 80
except Exception as e:
errlog.exception(f'{e}')
cls.got_sensors = False