title: How to add data in openTSDB through java using tCollector
body: <p>My goal is to insert data into TSDB directly through java code, for which, I tried creating the executable jar which was printing data to STDOUT. Then I wrote collector to run this jar and put it inside <code>tcollector/collectors/0</code>. Finally, I tried executing the collector in two ways, one in shell script and the other in python. </p>
  
  <p>Python Collector:</p>
  
  <pre class="lang-py prettyprint-override"><code>def main():
      while True:
          os.system("java -jar ./TCollectorTSDB.jar")
          sys.stdout.flush()
          time.sleep(COLLECTION_INTERVAL)    
  if __name__ == "__main__":
      sys.stdin.close()
      sys.exit(main())
  </code></pre>
  
  <p>The above collector was working perfectly fine, but when I tried to run the same jar from shell script the Collector was not picking the shell script.</p>
  
  <p>Shell script collector:</p>
  
  <pre><code>java -jar "./TCollectorTSDB.jar"
  </code></pre>
  
  <p>Do I have to configure something, to register this collector? 
  If we have to insert data through Java which is the best way to do the same with Collector?</p>