All Projects â†’ orca-zhang â†’ influxdb-c

orca-zhang / influxdb-c

Licence: MIT license
💙 C write client for InfluxDB.

Programming Languages

c
50402 projects - #5 most used programming language
CMake
9771 projects

Projects that are alternatives of or similar to influxdb-c

Influxdb Cpp
💜 C++ client for InfluxDB.
Stars: ✭ 100 (+257.14%)
Mutual labels:  influxdb, no-dependencies
rpi-monitoring-node
Automated installation of Grafana, Telegraf and influxdb for your Raspberry Pi
Stars: ✭ 18 (-35.71%)
Mutual labels:  influxdb
idlejs
Execute stuff when user is idle or interactive
Stars: ✭ 35 (+25%)
Mutual labels:  no-dependencies
solar-logger
A datalogger for a solar inverter. Stores data in influxdb and displays it in grafana. Has load diverting capability, to use the inverter's excess power
Stars: ✭ 53 (+89.29%)
Mutual labels:  influxdb
brute-md5
Advanced, Light Weight & Extremely Fast MD5 Cracker/Decoder/Decryptor written in Python 3
Stars: ✭ 16 (-42.86%)
Mutual labels:  no-dependencies
Calculate
Math Expressions Parser Engine
Stars: ✭ 30 (+7.14%)
Mutual labels:  no-dependencies
InfluxDB.Client.Net
A C# client object model to help integrate with InfluxDB with CLI languages. Supports both .Net traditional and .Net Core.
Stars: ✭ 95 (+239.29%)
Mutual labels:  influxdb
air-quality
Live dashboard for air quality in my home.
Stars: ✭ 70 (+150%)
Mutual labels:  influxdb
komapper
Kotlin SQL Mapper
Stars: ✭ 28 (+0%)
Mutual labels:  no-dependencies
trickster
Open Source HTTP Reverse Proxy Cache and Time Series Dashboard Accelerator
Stars: ✭ 1,753 (+6160.71%)
Mutual labels:  influxdb
influx-crypto-watcher
Server that let you monitor many cryptocurrencies and store the OHLC data in InfluxDB (visualisation with grafana)
Stars: ✭ 49 (+75%)
Mutual labels:  influxdb
http-node-api
O objetivo dessa aplicação era criar uma API sem nenhuma dependência externa, apenas utilizando as bibliotecas nativas do NodeJS. Tudo foi feito utilizando 100% Javascript.
Stars: ✭ 44 (+57.14%)
Mutual labels:  no-dependencies
effluence
Zabbix loadable module for real-time export of history to InfluxDB
Stars: ✭ 26 (-7.14%)
Mutual labels:  influxdb
bme680 to influxdb
Simple script that sends your BME680 temp, pressure, humidity and gas sensor data to InfluxDB.
Stars: ✭ 21 (-25%)
Mutual labels:  influxdb
aioconnectors
Simple secure asynchronous message queue
Stars: ✭ 17 (-39.29%)
Mutual labels:  no-dependencies
sensu-influxdb-handler
Sensu Go InfluxDB Metrics Handler
Stars: ✭ 14 (-50%)
Mutual labels:  influxdb
csv2influx
A CLI tool for importing CSV files into Influxdb
Stars: ✭ 16 (-42.86%)
Mutual labels:  influxdb
value-ptr-lite
value-ptr-lite - A C++ smart-pointer with value semantics for C++98, C++11 and later in a single-file header-only library
Stars: ✭ 38 (+35.71%)
Mutual labels:  no-dependencies
geostat
GeoStat, Python script for parsing Nginx and Apache logs files and getting GEO data from incoming IP's.
Stars: ✭ 50 (+78.57%)
Mutual labels:  influxdb
ml-ops
Get your MLOps (Level 1) platform started and going fast.
Stars: ✭ 81 (+189.29%)
Mutual labels:  influxdb

influxdb-c

A header-only C write client for InfluxDB.

license Build Status

  • Supported versions:
    • InfluxDB v0.9 ~ v1.4
    • Check yourself while using other versions.

Why use influxdb-c?

  • Exactly small:
    • Less than 300 lines and only about 10KB.
  • Easy to use:
    • It's designed to be used without extra studies.
  • Easy to assemble:
    • Only a tiny header file needs to be included.
  • No dependencies:
    • Unless std C libraries.
  • Under serious testing:

Examples

Before using

  • The very simple thing you should do before using is only:

    #include "influxdb.h"

Write example

  • You should according to the write syntax while writing series(metrics).

    measurement[,tag-key=tag-value...] field-key=field-value[,field2-key=field2-value...] [unix-nano-timestamp]
    
  • You can rapidly start writing series by using one of the following examples:

  • Client configurations:

    influx_client_t c;
    c.host = strdup("127.0.0.1");
    c.port = 8086;
    c.db = strdup("db");
    c.usr = strdup("usr");
    c.pwd = strdup("pwd");
  • Under C99, you can use:

    influx_client_t c = {
        .host = strdup("127.0.0.1"),
        .port = 8086,
        .db = strdup("db"),
        .usr = strdup("usr"),
        .pwd = strdup("pwd")
    };
  • Then send out the series by calling post_http:

    post_http(&c,
        INFLUX_MEAS("foo"),
        INFLUX_TAG("k", "v"),
        INFLUX_TAG("x", "y"),
        INFLUX_F_INT("x", 10),
        INFLUX_F_FLT("y", 10.3, 2),
        INFLUX_F_FLT("z", 10.3456, 2),
        INFLUX_F_BOL("b", 10),
        INFLUX_TS(1512722735522840439),
        INFLUX_END);
    • NOTE:
      • 3rd parameter of INFLUX_F_FLT() is precision for floating point value.
      • usr and pwd is optional for authorization.
      • INFLUX_END is the delimiter for variable arguments list that should not be ommitted.
  • The series sent is:

    foo,k=v,x=y x=10i,y=10.30,z=10.35,b=t 1512722735522840439
    
  • You could change post_http to send_udp for UDP request. And only host and port are required for UDP operation.

    influx_client_t c = {strdup("127.0.0.1"), 8091, NULL, NULL, NULL};
    
    send_udp(&c,
        INFLUX_MEAS("foo"),
        INFLUX_TAG("k", "v"),
        INFLUX_F_INT("x", 10),
        INFLUX_END);
  • Bulk/batch write is also supported:

    send_udp(&c,
        INFLUX_MEAS("foo"),  // series 1
        INFLUX_F_INT("x", 10),
    
        INFLUX_MEAS("foo"),  // series 2
        INFLUX_F_FLT("y", 10.3, 2),
    
        INFLUX_END);
  • The series sent are:

    foo x=10i
    bar y=10.30
    
  • If measurement data is sent from within a loop, but higher write performance is needed, one has to format each measurement separately, then at the end send the formatted line to the database. This example sends 10 measurements with a single http request:

    influx_client_t c = {strdup("127.0.0.1"), 8091, NULL, NULL, NULL};
    char *line = NULL;
    int len = 0;
    int used = 0;
    
    for (int i = 0; i < 10; ++i) {
        used = format_line(line, &len, used,
            INFLUX_MEAS("foo"),
            INFLUX_TAG("k", "v"),
            INFLUX_F_INT("x", i),
            INFLUX_END);
    }
    
    post_http_send_line(&c, line, used);

TODO

  • Add more test cases for send functions.
  • Supports DSN initializatin for influx_client_t.
  • Add query function.
  • Do not need to connect every time.

Misc

  • Please feel free to use influxdb-c.
  • Looking forward to your suggestions.
  • If your project is using influxdb-c, you can show your project or company here by creating a issue or let me know.
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].