java - openTSDB REST API is not storing data -


i trying write opentsdb database can analyse data using bosun.

if manually add data through bosun interface works fine, if post request <docker-ip>/api/put (where <docker-ip> configured correctly) data not show in bosun.

if send data points a json java application nothing shows @ in bosun, if send request using chrome app 'postman' metric shows up, data sent request not.

this data i'm sending:

try {     closeablehttpclient httpclient = httpclientbuilder.create().build();     httppost request = new httppost("http://192.168.59.103:8070/api/put?summary");     stringentity params = new stringentity("{\"metric\":\"tester.example\",\"timestamp\":\"" + system.currenttimemillis() + "\", \"value\": \"22\", \"tags\": { \"host\": \"chrisedwards\", \"dc\": \"lga\" }}");     request.setentity(params);     request.setheader("content-type", "application/json; charset=utf-8");     httpresponse response = httpclient.execute(request);     system.out.println(response);     // handle response here... } catch (exception ex) {     ex.printstacktrace(); } {     // httpclient.close(); } 

which returns 200 response code. send same request using postmaster same address in java application however, postmaster request shows metric name in bosun no data, , java request doesn't show metric name.

try this, served purpose:

try {             string url = "http://192.168.59.103:8070/api/put";             url obj = new url(url);             httpurlconnection con = (httpurlconnection) obj.openconnection();              //add reuqest header             con.setrequestmethod("post");             con.setrequestproperty("user-agent", user_agent);             con.setrequestproperty("accept-language", "en-us,en;q=0.5");              string urlparameters = "{\"metric\":\"tester.example\",\"timestamp\":\"" + system.currenttimemillis() + "\", \"value\": \"22\", \"tags\": { \"host\": \"chrisedwards\", \"dc\": \"lga\" }}";             // send post request             con.setdooutput(true);             dataoutputstream wr = new dataoutputstream(con.getoutputstream());             wr.writebytes(urlparameters);             wr.flush();             wr.close();              int responsecode = con.getresponsecode();             system.out.println("\nsending 'post' request url : " + url);             system.out.println("post parameters : " + urlparameters);             system.out.println("response code : " + responsecode);              bufferedreader in = new bufferedreader(                     new inputstreamreader(con.getinputstream()));             string inputline;             stringbuffer response = new stringbuffer();              while ((inputline = in.readline()) != null) {                 response.append(inputline);             }             in.close();              //print result             system.out.println(response.tostring());         }         catch(exception e) {             e.printstacktrace();         } 

Comments