Skip to content

Commit 90f548a

Browse files
fix: fixed get cpu temperature and tested on ec2
1 parent 1b7904d commit 90f548a

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

src/utils.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -185,9 +185,13 @@ def get_cpu_temp():
185185

186186
try:
187187
temp = psutil.sensors_temperatures().get('coretemp', [{'current': 'N/A'}])[0]
188+
current_temp = temp.get('current', 'N/A')
189+
high_temp = temp.get('high', 'N/A')
190+
critical_temp = temp.get('critical', 'N/A')
191+
return (current_temp, high_temp, critical_temp)
188192
except Exception:
189193
return ("N/A", "N/A", "N/A")
190-
return temp.current, temp.high, temp.critical
194+
191195

192196
def get_top_processes(number=5):
193197
"""Get the top processes by memory usage.

0 commit comments

Comments
 (0)