Skip to content

C++ client library for InfluxDB 1.x/2.x

License

Notifications You must be signed in to change notification settings

mikewzr/influxdb-cxx

This branch is up to date with awegrzyn/influxdb-cxx:master.

Folders and files

NameName
Last commit message
Last commit date
Apr 3, 2020
Mar 20, 2020
Apr 10, 2020
Apr 14, 2020
Jul 30, 2019
Mar 28, 2019
Feb 24, 2020
Apr 3, 2020
Mar 30, 2019
Mar 19, 2020

Repository files navigation

influxdb-cxx

Build Status codecov

InfluxDB C++ client library

  • Batch write
  • Data exploration
  • Supported transports
    • HTTP/HTTPS with Basic Auth
    • UDP
    • Unix datagram socket

Installation

Build requirements

  • CMake 3.12+
  • C++17 compliler

Dependencies

  • CURL (required)
  • boost 1.57+ (optional - see Transports)

Generic

git clone https://github.com/awegrzyn/influxdb-cxx.git
cd influxdb-cxx; mkdir build
cd build
cmake ..
sudo make install

macOS

brew install awegrzyn/influxdata/influxdb-cxx

Quick start

Basic write

// Provide complete URI
auto influxdb = influxdb::InfluxDBFactory::Get("http://localhost:8086/?db=test");
influxdb->write(Point{"test"}
  .addField("value", 10)
  .addTag("host", "localhost")
);

Batch write

// Provide complete URI
auto influxdb = influxdb::InfluxDBFactory::Get("http://localhost:8086/?db=test");
// Write batches of 100 points
influxdb->batchOf(100);

for (;;) {
  influxdb->write(Point{"test"}.addField("value", 10));
}

Query

// Available over HTTP only
auto influxdb = influxdb::InfluxDBFactory::Get("http://localhost:8086/?db=test");
/// Pass an IFQL to get list of points
std::vector<Point> points = idb->query("SELECT * FROM test");

Transports

An underlying transport is fully configurable by passing an URI:

[protocol]://[username:password@]host:port[/?db=database]

List of supported transport is following:
Name Dependency URI protocol Sample URI
HTTP cURL http/https http://localhost:8086/?db=<db>
UDP boost udp udp://localhost:8094
Unix socket boost unix unix:///tmp/telegraf.sock

About

C++ client library for InfluxDB 1.x/2.x

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • C++ 80.7%
  • CMake 19.3%