Question

I don't understand from the official documentation of OpenTSDB how to create a collector and how to make it running. In addition to that, i would like to make one collector in Java language. I'm also a bit new to Unix systems, but i know the basics

Was it helpful?

Solution

Writing a collector for OpenTSDB is quite simple, if you have cloned from git repository the tcollector script you will see the startstop executable, this daemon once being launched will execute all files that are stored inside ./tcollector/collectors/NUMBER where NUMBER is the periodicity in minutes.

Said that, what you need to do is coding those scripts that will be stored inside collectors folder. When OpenTSDB executes those scripts it expects the following output:

<METRIC> <UNIX_TIMESTAMP> <VALUE>

So, in your case. Imaging you want to report the temperature of your PC (call each 5 minutes, you will have to follow the next steps:

  1. Write your script, for example in Java, that gets the temperature of your PC (using SNMP, from the OS, or using any other method). Then when you run your script manually it will output: pc.temperature 1371075574 40
  2. Put the script under ./tcollector/collectors/5/ so OpenTSDB will launch it each 5 minutes
  3. Launch the collector by invoking startstop (OpenTSDB must be running)

A more detailed explanation here.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top