I am trying to write to an openTSDB database so I can analyse my data using Bosun.
If I manually add data through the Bosun interface it works fine, however if i do a POST
request to <docker-ip>/api/put
(where <docker-ip>
is configured correctly) the data does not show up in Bosun.
If I send the data points as a a JSON from my Java application nothing shows up at all in Bosun, but if I send the request using the chrome app 'Postman' then the metric shows up, but the data I sent with the request does not.
This is the 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();
} finally {
// httpClient.close();
}
which returns a 200 response code
. I send the same request using Postmaster to the same address as in the java application however, the postmaster request shows the metric name in Bosun but no data, and the Java request doesn't even show the metric name.