added cpu temperature monitor
This commit is contained in:
parent
48c66e007d
commit
8c7b2687d6
|
@ -11,12 +11,17 @@ def send_data(results):
|
|||
print(output)
|
||||
|
||||
def format_data(host, name, data):
|
||||
results = 'sys_{},host={} value={}'.format(name, host, data)
|
||||
results = '{},host={} value={}'.format(name, host, data)
|
||||
send_data(results)
|
||||
if debug == 1:
|
||||
print(results)
|
||||
|
||||
while True:
|
||||
format_data(host, 'uptime', uptime())
|
||||
format_data(host, 'sys_uptime', uptime())
|
||||
|
||||
f = open("/sys/class/thermal/thermal_zone0/temp", "r")
|
||||
raw_temp = f.readline()
|
||||
cpu_temperature = int(raw_temp) / 1000
|
||||
format_data(host, 'temperature', cpu_temperature)
|
||||
|
||||
time.sleep(delay)
|
Loading…
Reference in New Issue