36 lines
607 B
Text
36 lines
607 B
Text
|
#!/usr/bin/env python
|
||
|
|
||
|
import re
|
||
|
import subprocess
|
||
|
|
||
|
CRIT = 70.0
|
||
|
|
||
|
|
||
|
def main():
|
||
|
sensors = subprocess.check_output(['sensors', '-u']).decode('utf-8')
|
||
|
|
||
|
max_temp = 0.0
|
||
|
for line in sensors.split('\n'):
|
||
|
if not re.match(r'.*temp._input:.*', line):
|
||
|
continue
|
||
|
temp = float(line.split(':')[1])
|
||
|
|
||
|
if temp > max_temp:
|
||
|
max_temp = temp
|
||
|
|
||
|
text = '\uf2c7 {:.1f}°C'.format(max_temp)
|
||
|
color = ''
|
||
|
|
||
|
if max_temp > CRIT:
|
||
|
color = '#dd0000'
|
||
|
|
||
|
print('\n'.join([
|
||
|
text,
|
||
|
text,
|
||
|
color,
|
||
|
]))
|
||
|
|
||
|
|
||
|
if __name__ == '__main__':
|
||
|
main()
|