Mojo::InfluxDB - Super simple InfluxDB async cappable client with a nice interface
my $client = Mojo::InfluxDB->new( database => 'telegraf' );
my $result = $client->query('
SELECT last(state) AS state
WHERE time > now() - 5h
GROUP BY time(1h), host
We needed to do some async queries on our company InfluxDB instance and with some time this module has been growing. As it's useful for Us, it might also be useful for others so here I am releasing it.
This is not yet a full implementation of an InfluxDB driver. I will be very happy to accept contributions and to modify anything about this group of classes, so be warned that this is "beta" quality and the interface will change if it's needed to implement new features or if me or someone else found a nicer way.
Host of your InfluxDB instance: 'localhost' by default.
Port of your InfluxDB instance: 8086 by default.
The name of the database you want this client to send the queries. You can change it at any time.
An optional time_zone to be passed into results which will finally allow InfluxDB::Point to build DateTime objects on your requested time_zone.
will run queries synchronously. See query_p().
will run queries asynchronously and return a promise to get a Mojo::Collection of Mojo::InfluxDB::Result objects.
will run a query and return a Mojo::Transaction::HTTP.
As in any piece of software there might be bugs around. If you found one, please report it at the github repo:
Pull requests to fix bugs or add functionality are very welcomed, but please include an explanation of what you want to achieve.
Gonzalo Radio <firstname.lastname@example.org>
This software is copyright (c) 2020 by Gonzalo Radio.
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 Mojo::InfluxDB, copy and paste the appropriate command in to your terminal.
perl -MCPAN -e shell
For more information on module installation, please visit the detailed CPAN module installation guide.