def write_db(dbc, rpt, domain=None, key=None):
l = []
for measurement, value in rpt.iteritems():
t = time.strftime('%Y-%m-%dT%H:%M:%SZ', time.gmtime())
if measurement not in ['class', 'device']:
json_body = {
'measurement': measurement,
'tags': {
'class': rpt['class'],
'device': rpt['device']
},
'time': t,
'fields': {
'value': value
}
}
l.append(json_body)
print('Write points: {0}'.format(l))
dbc.write_points(l)
update_dns(coords=rpt['geo'], domain=domain, key=key)
评论列表
文章目录