Hi
I can’t get write_points to insert all data-points.
Given the parameters I feed this loop, it runs 480 times and the list ‘data’ contains 480 elements, but .write_points only inserts 60 ‘rows’ into the database (sometimes 61 rows).
I can’t figure out why - hope someone has a hint to help me on my way
Thanks
data = []
loop_runs = 0
for metric in metrics.split(',') :
for node in nodes :
out = get_stats(ssh_host, ssh_username, ssh_password, 'lsnodecanisterstats -history ' + metric + ' -nohdr ' + node)
for line in out :
# 1 node1 140911134627 mdisk_r_mb 0
node_name = line.split()[1]
timestamp = int(time.mktime(time.strptime(line.split()[2], '%y%m%d%H%M%S')))
metric_name = line.split()[3]
value = line.split()[4]
#print(node_name, timestamp, metric, metric_name, value, sep=' ')
measurement = {
"measurement": table,
"tags": {
"customer": customer,
"stg_vendor": stg_vendor,
"stg_type" : stg_type,
"stg_model": stg_model,
"stg_name": stg_name
},
"fields": {
"stg_node": node_name,
"metric": metric_name,
"value": value
},
"time": timestamp
}
data.append(measurement)
loop_runs=loop_runs+1
client.write_points(data, time_precision='s', database=db, protocol='json')