22 lines
480 B
Python
22 lines
480 B
Python
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) |