使用C语言操作InfluxDB
时间:2021-07-01 10:21:17
帮助过:49人阅读
E-Mail : Mike_Zhang@live.com*/
#include "influxdb.h"
int main()
{
int status;
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 10",&
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;
}
好,就这些了,希望对你有帮助。
本文github地址:
https://github.com/mike-zhang/mikeBlogEssays/blob/master/2017/20170501_使用c语言操作Influxdb.rst
欢迎补充
使用C语言操作InfluxDB
标签:lib 语言 free style amp href sel out com