How to insert data in OpenTSDB (Time Series Database)

13,097

Solution 1

The short answer is that those "put name timestamp value [tags]" commands are the network protocol for adding data to OpenTSDB over TCP/IP. So from your Java program, you can open a TCP socket to the TSD port and start writing commands to add your data.

Obviously, that still leaves a lot of details an an excercise to the reader.

You didn't specify in your question how, or even if, you're collecting time series data that you want to store. How complicated it is to periodically push data into TSD from your application will depend on what you're doing there. If you're using the excellent Yammer/Coda Hale Metrics library to collect data (and in Java, there really isn't a slicker way to do it, that I know of)

Metrics includes a reporter interface with several implementations for other statistics repositories like Graphite and Ganglia. You can easily implement one for OpenTSDB (in fact, someone already has - I'm trying to find the pull request on github but failing; I'll update this when I find it).

Solution 2

Have you read the getting started guide

You have several options. Once started, and metrics created via ./tsdb mkmetric mymetric.data_1 mymetric.data_2 , you can batch import files written in the form

metric_name timestamp value tags e.g.

mymetric.data_1 1295643636 48 a=foo

then you can ./tsdb import file

An other way is to "telnet" commands to the server in the same form as above, but with the put keyword, like echo "put mymetric.data_1 1295643636 48 a=foo" | nc -w 15 tsdHost tsdPort (linux way :-) )

Share:
13,097
Admin
Author by

Admin

Updated on June 05, 2022

Comments

  • Admin
    Admin almost 2 years

    I'm new to OpenTSDB. I somehow managed to install and configure OpenTSDB, but I don't know how to put data into OpenTSDB from client. Can anyone of you help me?

  • Admin
    Admin over 12 years
    yeah i read the getting stated guide but i dont know how to put data from into opentstb from nodes using java