NAME

InfluxDB::Client - query and manage InfluxDB

VERSION

version 0.1

SYNOPSIS

use InfluxDB::Client;

METHODS

new(%args)

creates a new InfluxDB::Client instance.

The arguments are:

  • url complete URL to the influx host. Can be an array reference or a string. default: http://localhost:8086

  • ua_opts a hash reference, given to LWP::UserAgent during construction

  • username username for authentication

  • password password for authentication

If url is an array reference, we will use the URL's round robin. If a request fails the next URL is tried The username and password are optional. None or both must be defined.

ping()

queries the ping endpoint of the InfluxDB server and returns a HTTP::Response object on success, undef otherwise

returns: InfluxDB::Client::Response

query($query)

sends the $query as GET request to the /query endpoint of the remote database

returns: InfluxDB::Client::Response

query(%args)

The arguments are:

  • query the query string to send to the /query endpoint

  • method either POST or GET, defaults to GET

  • database the database to use for database dependent queries

  • epoch defines the precision of the returned timestamp values, must be one of ns,u,ms,s,m,h. Defaults to ns

query is the only required argument. If this is the only argument you need, consider using query($query) instead.

returns: InfluxDB::Client::Response

write(%args)

The arguments are:

  • database the database, the data should be written to

  • consistency the write consistency for InfluxEnterprise cluster, defaults to one

  • precision defines the precision of the given data, must be one of ns,u,ms,s,m,h. Defaults to ns

  • data an array reference of strings and/or InfluxDB::Client::DataSet objects

  • rp sets the target retention policy for the write, defaults to undef

If precision is not given and the first element of data is a InfluxDB::Client::DataSet, the precision is taken from that object.

All elements of data must have the same precision. If you need to write data with different precision, you must call this method once for each precision.

You can mix strings and InfluxDB::Client::DataSet objects in the data array reference.

returns: InfluxDB::Client::Response

show_databases()

wrapper around query('SHOW DATABASES')

returns: A InfluxDB::Client::Response object.

the ->content of the response contains an array of database names

AUTHOR

Thomas Berger <thomas.berger@1und1.de>

COPYRIGHT AND LICENSE

This software is Copyright (c) 2017 by 1&1 Telecommunication SE.

This is free software, licensed under:

The Apache License, Version 2.0, January 2004