ETL::Yertl::Adapter::graphite - Adapter to read/write from Graphite time series database
version 0.044
my $db = ETL::Yertl::Adapter::graphite->new( 'graphite://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 Graphite time series system. Yertl can write to Carbon using the "plaintext" protocol, and read from Graphite using its HTTP API.
This adapter is used by the yts command.
Graphite metrics are paths separated by ., which is the native format that Yertl supports.
.
yts graphite://localhost foo.bar.baz yts graphite://localhost foo.bar
my $db = ETL::Yertl::Adapter::graphite->new( 'graphite://localhost' ); my $db = ETL::Yertl::Adapter::graphite->new( 'graphite://localhost:8080' );
Construct a new Graphite adapter for the database on the given host and port. Port is optional and defaults to 2003 (the Carbon plaintext port) for writing and 8080 (the default Graphite HTTP API port) for reading.
2003
8080
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 Graphite, this is a path separated by dots (.).
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.
NOTE: Graphite does not support per-value tags. Using this field will cause a fatal error.
$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 Graphite, this is a path separated by dots (.).
An ISO8601 timestamp or UNIX epoch time. Optional. Defaults to the current time.
The metric value.
ETL::Yertl, yts, Write to Carbon Read from Graphite
Doug Bell <preaction@cpan.org>
This software is copyright (c) 2018 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.