This reporter pushes data to InfluxDB.
-
Add exometer_influxdb to your list of dependencies in rebar.config:
{deps, [ {exometer_influxdb, ".*", {git, "https://github.com/travelping/exometer_influxdb.git", "master"}} ]}. -
Ensure exometer_influxdb is started before your application:
{applications, [exometer_influxdb]}. -
Configure it:
{exometer, {reporters, [ {exometer_report_influxdb, [{protocol, http}, {host, <<"localhost">>}, {port, 8086}, {db, <<"exometer">>}, {tags, [{region, ru}]}]} ]} }.
Available options:
- host - InfluxDB host.
127.0.0.1by default. - protocol -
httporudpfor operating with InfluxDB.httpby default. - port - InfluxDB port.
8086by default. - db - database on InfluxDB for writing data.
exometerby default - username - username for authorization on InfluxDB.
- password - password for authorization on InfluxDB.
- timestamping - enable timestamping,
falseby default. - tags - list of default tags for each data point. The
hostis automatically included here. - batch_window_size - set window size in ms for batch sending. This means reported will collect measurements within this interval and send all measurements in one packet.
0by default.
Timestamping is by default done by influxdb itself. To enable timestamping with the reporter you can use true or {true, Precision} where Precision is a unit taken from [n,u,ms,s,m,h]. The default unit is u.
Besides the tags for the reporter initialization it is possible to add other tags via the Extra parameter of exometer_report:subscribe/5 as done here with environment variables:
{exometer,
{subscriptions, [
{exometer_report_influxdb, [erlang, memory], total, 5000, true, [{tag, <<"value">>}]},
]}
}.By default the in influxdb visible name of the metric is derived from the exometer id: here [erlang, memory] is translated to erlang_memory. It is possible to remove an item from this list by naming itself or its position with the from_name keyword. A removed element is then used as tag:
exometer_report:subscribe(exometer_report_influxdb, [erlang, memory], total, 5000, true, [{tag, {from_name, 2}}]).This will result in a name erlang with the tag pair {tag, memory} (plus the default pair {host, Host}).
- Tests
- Reconfiguration on runtime