Pulling data from OpenTSDB into R

Sometimes you want to jam data from OpenTSDB into R, so you can do neat things like parameterize it by time. Well, I wrote an R function that does just that!

Here it is on gist.

Here’s a usage example:

read.opentsdb("http://localhost:44242",
metrics=c("sum:dummy.linear","sum:dummy.random.unif{blah=*}"),
start="4h-ago")

I considered turning this into a CRAN package, but then I was like “naw.” There’s not very much to it, and writing CRAN packages seems like a big pain. Correct me if I’m wrong.

Anyway, enjoy!

4 thoughts on “Pulling data from OpenTSDB into R

  1. Alessandro

    Sorry, but where must i put the read_opentsdb.r file to make work? I’m new to R but i don’t understand how work with .r files

    1. Alessandro

      I solved, but I have this error now:
      If i write
      > read.opentsdb(“http://127.0.0.1:4242”, metrics=c(“value.metrics{sensor=*}), start=”4h-ago”)

      I get this error:
      Errore: unexpected numeric constant in “read.opentsdb(“http://127.0.0.1:4242”, metrics=c(“value.metrics{sensor=*}), start=”4”

      What’s wrong? 🙂

      1. Alessandro

        Now i’ve solved also this problem, but when i put my command on the command line

        read.opentsdb(“http://127.0.0.1:4242”, metrics=c(“value.metrics{sensor=*}”), start=”2013/01/20-12:00:00″)

        Nothing seems to open, i don’t understand why

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s