The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.

NAME

InfluxDB::Client - The lightweight InfluxDB client

VERSION

Version 0.01

SYNOPSIS

InfluxDB::Client provides an easy way to interact with an InfluxDB server.

    use InfluxDB::Client;

    ########################## TCP ##########################
    my $client = InfluxDB::Client->new( host => 'server.address.com', port => 8086, protocol => 'tcp' ) or die "Can't instantiate client";

    # Check server connectivity
    my $result = $client->ping();
    die "No pong" unless $result;

    # You can also get the server version
    print $result->{version};

    # Read
    $result = $client->query('SELECT "severity_code" FROM "syslog" WHERE ("severity" = \'err\' AND "hostname" =~ /^(srv01|srv02)$/) AND time >= 1558878013531ms and time <= 1609886964827ms', database => 'grafana');

    # Write
    $result = $client->write("testing,host=containment,repo=cadi-libs,file=testfile statement=42,pod=85", database => 'dbname');

    ########################## UDP ##########################
    $client = InfluxDB::Client->new( host => 'server.address.com', port => 8089, protocol => 'udp' ) or die "Can't instantiate client";

    # UDP allows only write()
    $result = $client->write("testing,host=containment,repo=cadi-libs,file=testfile statement=47,pod=89", database => 'grafana');

WHY

In its current state this module offers few additional features over InfluxDB::HTTP (from which it's derived)

The only reasons why you would use this module are: =over

  • Less dependencies (no Object::Result and its dependencies)

  • You want to use UDP protocol for writing (WIP)

SUBROUTINES/METHODS

new ( [%options] )

Constructor. %otions is an hash with the following keys:

    =item* host - Server hostname (default: 'localhost')

    =item* port - Server port (default: 8086)

    =item* timeout - Timeout value in seconds (default: 180)

    =item* protocol - Transport protocol (default: 'tcp')

ping()

Check the server connectivity.

Returns an hashref which evaluates to true if the connection is ok and to false otherwise. The hashref has the following keys:

    =item* raw - The raw response from the server

    =item* error - The error message returned by the server (empty on success)

    =item* version - The InfluxDB verstion returned by the server through the 'X-Influxdb-Version' header

query( $query [, %options] )

write

AUTHOR

Arnaud (Arhuman) ASSAD, <aassad at cpan.org>

BUGS

Please report any bugs or feature requests to bug-influxdb-client at rt.cpan.org, or through the web interface at https://rt.cpan.org/NoAuth/ReportBug.html?Queue=InfluxDB-Client. I will be notified, and then you'll automatically be notified of progress on your bug as I make changes.

SEE ALSO

This module is derived from InfluxDB::HTTP.

SUPPORT

You can find documentation for this module with the perldoc command.

    perldoc InfluxDB::Client

You can also look for information at:

ACKNOWLEDGEMENTS

LICENSE AND COPYRIGHT

This software is copyright (c) 2020 by Arnaud (Arhuman) ASSAD.

This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.

1 POD Error

The following errors were encountered while parsing the POD:

Around line 60:

'=item' outside of any '=over'