0
votes

How it's possible to format a data to let the influxdb know that myscript is sending timestamp.

i have a script that sends:

ping,host=10.22.0.253,hostname=JAYNET01AA,location=Lab,function=Router rtt=1.26 timestamp=1.5230279389238705e+18 ping,host=10.22.0.254,hostname=JAYNET01BB,location=Lab,function=Router rtt=2.0 timestamp=1.5230279389238705e+18 ping,host=10.254.22.105,hostname=JAYNET02BB,location=Lab,function=Router rtt=0.483 timestamp=1.5230279389238705e+18

I added a precision variable at the end (in nanoseconds as the influx 1.2 defaults to). But seems that influxdb doesn't recognize it. Maybe you know in what format i need to push the data to influxdb to make the influxdb understand that this is timestamp data.

P.S i got this response ": bad timestamp\nunable to parse"

is there are simple way to convert a timestamp to RFC 3339 format ? Thanks

1

1 Answers

0
votes

You need to send data in line protocol.

https://docs.influxdata.com/influxdb/v1.5//write_protocols/line_protocol_tutorial/#timestamp

removing the timestamp= part will make influxdb give the data a timestamp.

However, if you are sending data into the database with your script - If you leave the time stamp out completely and the data will be given a time stamp from the database server.

Also, if you start inserting your own time stamps you run the risk of high series cardinlity and ultimately performance issues.

I don't have sufficient rep to comment and ask questions so there is a chance this might be deleted but if i knew what type of script (powershell/bash/some other) i could offer more.

However if you are running a bash or powershell script you can also use the Telegraf agent (part of the Influx stack) with a built in ping test. If you want a more custom ping test you could write your script in bash or powershell and then use the EXEC plugin to run the script and get the information.

Still though, the fact is that if you ommit the timestamp then Influx will add one when the data is written. If that is the only requirement for the time stamp then i'd drop it from the script completely.

EXEC PLUGIN

this link is for a powershell script that will send data into the database.

Hope that helps, i had a horrible time trying to get powershell to send data to influx. The exec plugin isn't well documented.

Also, if you haven't already i would recommend updating to influxDB 1.4/1.5 - New features involving the way memory is handled by Influx (plus a lot more).

Regards

Phil

Edit: also I don't think the time stamp value is valid. You're Gonna need to escape the none numerical parts.

https://docs.influxdata.com/influxdb/v1.5/write_protocols/line_protocol_reference/#quoting-special-characters-and-additional-naming-guidelines

Sorry if the link isn't formatted I'm posting from my phone I can't work out how to post it correctly.