ETL::Yertl::Adapter::influxdb - Adapter to read/write from InfluxDB time series database
version 0.034
my $db = ETL::Yertl::Adapter::influxdb->new( 'influxdb://localhost:8086' ); my @points = $db->read_ts( { metric => 'db.cpu_load.1m' } ); $db->write_ts( { metric => 'db.cpu_load.1m', value => 1.23 } );
This class allows Yertl to read and write time series from the InfluxDB time series database.
This adapter is used by the yts command.
InfluxDB has databases, metrics, and fields. In Yertl, the time series is identified by joining the database, metric, and field with periods (.). The field is optional, and defaults to value.
.
value
# Database "foo", metric "bar", field "baz" yts influxdb://localhost foo.bar.baz # Database "foo", metric "bar", field "value" yts influxdb://localhost foo.bar
my $db = ETL::Yertl::Adapter::influxdb->new( 'influxdb://localhost' ); my $db = ETL::Yertl::Adapter::influxdb->new( 'influxdb://localhost:8086' );
Construct a new InfluxDB adapter for the database on the given host and port. Port is optional and defaults to 8086.
8086
my @points = $db->read_ts( $query );
Read a time series from the database. $query is a hash reference with the following keys:
$query
The time series to read. For InfluxDB, this is the database, metric, and field separated by dots (.). Field defaults to value.
An ISO8601 date/time for the start of the series points to return, inclusive.
An ISO8601 date/time for the end of the series points to return, inclusive.
An optional hashref of tags. If specified, only points matching all of these tags will be returned.
$db->write_ts( @points );
Write time series points to the database. @points is an array of hashrefs with the following keys:
@points
The metric to write. For InfluxDB, this is the database, metric, and field separated by dots (.). Field defaults to value.
An ISO8601 timestamp. Optional. Defaults to the current time on the InfluxDB server.
The metric value.
ETL::Yertl, yts, Reading data from InfluxDB, Writing data to InfluxDB, InfluxDB Query language
Doug Bell <preaction@cpan.org>
This software is copyright (c) 2016 by Doug Bell.
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.
To install ETL::Yertl, copy and paste the appropriate command in to your terminal.
cpanm
cpanm ETL::Yertl
CPAN shell
perl -MCPAN -e shell install ETL::Yertl
For more information on module installation, please visit the detailed CPAN module installation guide.