I have influxdb database test
with measurement:
name: mes1
time Amount Buy_order_id Price
---- ------ ------------ -----
1529832177822 0.02294 132868375 130117.83
I would like to make graph in Grafana, but all data are in year 1970. I have other measurement:
name: cpu_load_short
time Bool_value Float_value Int_value String_value host region
---- ---------- ----------- --------- ------------ ---- ------
1257894000000000000 true 0.64 3 Text server01 us-west
This time works fine. I figure out, that time in measurement cpu_load_short
are stored in ns, but data in measurement mes1
are stored in ms.
I receiveing time for mes1
from websocket. Time for cpu_load_short
is generated from python:
datetime.utcnow().strftime('%Y-%m-%dT%H:%M:%SZ')
All data are sent to influxdb via influxdb-python. I tried to adjust time for mes1
and add six zeros in the end of number:
'1529832177822' -> '1529832177822000000'
but I received:
OverflowError: signed integer is greater than maximum
How can I send data to influxdb and make graph from it, so the data will be in proper format and the right date? Maybe I missing something but I can't figure out why I cant send data to my database in ns but I can send it with datetime. Could anybody explain me, where is the problem?
I have encountered the same issue and was able to solve it, let me try to guide you.
When you write your points to InfluxDB using the influxdb-python client you can specify the time precision in the write_points
method. (http://influxdb-python.readthedocs.io/en/latest/api-documentation.html#influxdb.DataFrameClient.write_points)
An example:
from influxdb import InfluxDBClient
client = InfluxDBClient(host=host, port=port, database=database)
client.write_points(value, time_precision='ms')
This will convert your ms
to ns
for you. Hope this helps.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With