Using the C language Operation Influxdb

Source: Internet
Author: User
Tags influxdb

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

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.