Commit 74013eeb authored by oni's avatar oni

fixed timestamps

now they are in UTC and nano seconds as they should be
parent 87e6c5f4
......@@ -51,7 +51,7 @@ def read_jsonfile(file):
def create_series(jsondata):
series=[]
now = datetime.datetime.today()
now = datetime.datetime.utcnow()
for node in jsondata:
data={}
keys={'loadavg','uptime','memory','rootfs_usage','clients','traffic','processes','hostname','nodeid'}
......@@ -71,7 +71,7 @@ def create_series(jsondata):
pointValues = {}
pointValues['fields'] = {}
pointValues['tags'] = {}
pointValues['time'] = int(now.strftime('%s'))
pointValues['time'] = int(now.strftime('%s%f000'))
pointValues['measurement'] = metric
pointValues['fields']['value'] = float(data[metric])
pointValues['tags']['mac'] = mac
......@@ -95,7 +95,7 @@ def create_series(jsondata):
pointValues = {}
pointValues['fields'] = {}
pointValues['tags'] = {}
pointValues['time'] = int(now.strftime('%s'))
pointValues['time'] = int(now.strftime('%s%f000'))
pointValues['measurement'] = metric
pointValues['fields']['value'] = int(data[metric][type])
pointValues['tags']['type'] = type
......@@ -120,7 +120,7 @@ def create_series(jsondata):
pointValues = {}
pointValues['fields'] = {}
pointValues['tags'] = {}
pointValues['time'] = int(now.strftime('%s'))
pointValues['time'] = int(now.strftime('%s%f000'))
pointValues['measurement'] = 'traffic'
pointValues['fields']['value'] = int(data['traffic'][type_instance][type])
pointValues['tags']['type'] = type
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment