Add sys_uptime.py
This commit is contained in:
parent
640a605814
commit
289d5b1728
|
@ -0,0 +1,22 @@
|
||||||
|
import requests
|
||||||
|
import time
|
||||||
|
from uptime import uptime
|
||||||
|
|
||||||
|
debug = 1
|
||||||
|
delay = 20
|
||||||
|
host='CHANGEME'
|
||||||
|
|
||||||
|
def send_data(results):
|
||||||
|
output = requests.post('http://192.168.1.231:8086/write?db=garagedb', data = results, timeout=30)
|
||||||
|
print(output)
|
||||||
|
|
||||||
|
def format_data(host, name, data):
|
||||||
|
results = 'sys_{},host={} value={}'.format(name, host, data)
|
||||||
|
send_data(results)
|
||||||
|
if debug == 1:
|
||||||
|
print(results)
|
||||||
|
|
||||||
|
while True:
|
||||||
|
format_data(host, 'uptime', uptime())
|
||||||
|
|
||||||
|
time.sleep(delay)
|
Loading…
Reference in New Issue