diff --git a/stats.py b/stats.py index 05965bc7d912975fbb2793408978de4c6e0ef52d..4662ca5ed3b42dcd993cf3e583fcef484b55b37c 100644 --- a/stats.py +++ b/stats.py @@ -42,8 +42,8 @@ def cpu_load(): def disk_usage(mount='/'): disk = cmd_df(mount).split(' ') return { - 'used': disk[2], - 'avail': disk[3], + 'used': disk[2], + 'available': disk[3], 'used_percent': disk[4].strip('%') } @@ -59,10 +59,10 @@ def mem_usage(): 'swap_free': swap[3] } -def push_to_nodeping(data): +def push_to_nodeping(check_id, token, data): params = { - 'id': NODEPING_ID, - 'checktoken': NODEPING_TOKEN + 'id': check_id, + 'checktoken': token } if not DEBUG: r = requests.post(url=NODEPING_ENDPOINT, json={'data': data}, params=params) @@ -71,13 +71,13 @@ def push_to_nodeping(data): print r.status_code if __name__ == '__main__': - out = { + data = { 'cpu_load': cpu_load(), 'disk': disk_usage(), 'memory': mem_usage() } if DEBUG: - print(json.dumps(out, indent=4)) - push_to_nodeping(out) + print(json.dumps(data, indent=4)) + push_to_nodeping(NODEPING_ID, NODEPING_TOKEN, data) # vi: set ts=4 sw=4 et ft=python: \ No newline at end of file