Chronix HTTP API
Chronix supports multiple input formats:
- Graphite plaintext format
- InfluxDB line protocol
- OpenTSDB HTTP API protocol
- OpenTSDB Telnet protocol
- KairosDB REST protocol
Graphite Plaintext format
TODO. This protocol is not based on HTTP, but on raw TCP
InfluxDB line protocol
Use the url http://localhost:8913/solr/chronix/ingest/influxdb
to write data to Chronix. For example using curl:
curl -i -XPOST 'http://localhost:8913/solr/chronix/ingest/influxdb/write' --data-binary 'cpu_load_short,host=server01,region=us-west value=0.64 1434055562000000000'
Restrictions of the endpoint:
- Only one field name is allowed, it has to be
value
- Only double values are allowed as field value.
You can also use, for example, the InfluxDB Java client library:
InfluxDB influxDB = InfluxDBFactory.connect("http://127.0.0.1:8913/solr/chronix/ingest/influxdb", "root", "root");
BatchPoints batchPoints = BatchPoints
.database("foo")
.retentionPolicy("autogen")
.consistency(InfluxDB.ConsistencyLevel.ALL)
.build();
Point point1 = Point.measurement("cpu")
.time(System.currentTimeMillis(), TimeUnit.MILLISECONDS)
.tag("host", "server01")
.addField("value", 1.0)
.build();
Point point2 = Point.measurement("disk")
.time(System.currentTimeMillis(), TimeUnit.MILLISECONDS)
.tag("host", "server02")
.addField("value", 2.0)
.build();
batchPoints.point(point1);
batchPoints.point(point2);
influxDB.write(batchPoints);
OpenTSDB HTTP API protocol
Use the url http://localhost:8913/solr/chronix/ingest/opentsdb/http
to write data to Chronix.
Using the OpenTSDB Java client:
HttpClient client = new HttpClientImpl("http://localhost:8913/solr/chronix/ingest/opentsdb/http");
MetricBuilder builder = MetricBuilder.getInstance();
builder.addMetric("metric1")
.setDataPoint(System.currentTimeMillis(), 30L)
.addTag("host", "server01");
builder.addMetric("metric2")
.setDataPoint(System.currentTimeMillis(), 232.34)
.addTag("host", "server02");
Response response = client.pushMetrics(builder, ExpectResponse.STATUS_CODE);
System.out.println(response);
OpenTSDB Telnet protocol
TODO. This protocol is not based on HTTP, but on raw TCP
KairosDB REST protocol
Use the url http://localhost:8913/solr/chronix/ingest/kairosdb
to write data to Chronix.
Using the KairosDB Java API:
MetricBuilder builder = MetricBuilder.getInstance();
builder.addMetric("metric1")
.addTag("host", "server1")
.addDataPoint(System.currentTimeMillis(), 10)
.addDataPoint(System.currentTimeMillis(), 30L);
builder.addMetric("metric2")
.addTag("host", "server2")
.addDataPoint(System.currentTimeMillis(), 20)
.addDataPoint(System.currentTimeMillis(), 40L);
HttpClient client = new HttpClient("http://localhost:8913/solr/chronix/ingest/kairosdb");
Response response = client.pushMetrics(builder);
client.shutdown();