diff --git a/influxdb_api.py b/influxdb_api.py index 05f2c26..e875d93 100644 --- a/influxdb_api.py +++ b/influxdb_api.py @@ -2135,16 +2135,16 @@ if __name__ == "__main__": token = influxdb_info.token org_name = influxdb_info.org - # client = InfluxDBClient(url=url, token=token) + client = InfluxDBClient(url=url, token=token) # step1: 检查连接状态,初始化influxdb的buckets - # try: - # # delete_buckets(client, org_name) - # create_and_initialize_buckets(client, org_name) - # except Exception as e: - # print(f"连接失败: {e}") - # finally: - # client.close() + try: + delete_buckets(client, org_name) + create_and_initialize_buckets(client, org_name) + except Exception as e: + print(f"连接失败: {e}") + finally: + client.close() # step2: 先查询pg数据库中scada_info的信息,然后存储SCADA数据到SCADA_data这个bucket里 # query_pg_scada_info_realtime('bb') diff --git a/setup_influxdb.md b/setup_influxdb.md index f6beb81..a44a2cc 100644 --- a/setup_influxdb.md +++ b/setup_influxdb.md @@ -8,3 +8,6 @@ Setup instructions for WMH's work Should manullay change code 3. run create_template.py + +4. run influxdb_api.py + create buckets \ No newline at end of file