Environment: centos6.5_x64
Influxdb version: 1.1.0
The C language Development library is not available on the INFLUXDB website, but GitHub offers:
Https://github.com/influxdata/influxdb-c
However, this version is early, and so far does not support 0.9 and later versions.
Here is my own development of the INFLUXDB Client Development library, the direct use of the HTTP API implementation, the function is relatively simple, interested friends can join together perfect.
GitHub Address:
Https://github.com/mike-zhang/influxdbCApi
Principle:
Refer to Influxdb-c, using the Libcurl library to operate the INFLUXDB database.
Dependent libraries:
Yum Install Libcurl-devel
Examples of Use:
/*e-mail: [Email protected]*/#include"Influxdb.h"intMain () {intstatus; S_influxdb_string outstr; S_influxdb_client*client = Influxdb_client_new ("localhost:8086","Root","Root","MyDB",0); /*Create DB*/Status= Influxdb_create_database (Client,"MyDB"); printf ("status=%d\n", status); /*Do Insert*/Status= Influxdb_insert (Client,"cpu_load,host=server_1,region=us-west value=0.2"); printf ("Status:%d\n", status); /*Do query*/influxdb_query (client,"select * from Cpu_load limit",&outstr); printf ("%s\n", outstr.ptr); /*Delete db*/Status= Influxdb_delete_database (Client,"MyDB"); printf ("status=%d\n", status); Influxdb_client_free (client); return 0;}
All right, that's it, I hope it helps you.
This article GitHub address:
https://github.com/mike-zhang/mikeBlogEssays/blob/master/2017/20170501_ uses the C language Operation Influxdb.rst
Welcome to Supplement
Manipulating Influxdb using the C language