Python操作InfluxDB指南
文章目录 简单例子 详细API InfluxDBClient InfluxDBClient类的参数说明 InfluxDB类的方法 DataFrameClient DataFrameClient类的参数说明 DataFrame类的方法 详细例子 InfluxDBClient例子 DataFrameClient例子 简单例子 from influxdb import InfluxDBClient client = InfluxDBClient ( 'localhost' , 8086 , 'aiops_logwarn' ) # 连接数据库 client . create_database ( 'example' ) # 创建数据库 points = [ # 待写入数据库的点组成的列表 { "measurement" : "cpu_load_short" , "tags" : { "host" : "server01" , "region" : "us-west" } , "time" : "2009-11-10T23:00:00Z" , "fields" : { "value" : 0.64 } } ] client . write_points ( points , database = 'example' ) # 将这些点写入指定database # 查询刚刚写入的点 result