【问题标题】:Can I set specific time for a point in Influxdb using Python?我可以使用 Python 为 Influxdb 中的某个点设置特定时间吗?
【发布时间】:2018-09-25 13:44:55
【问题描述】:

是否可以为 InfluxDB 点设置时间而不是依赖默认的“现在”选项?

【问题讨论】:

    标签: python python-3.x influxdb


    【解决方案1】:

    是的,你可以。您可以为要写入流入的每个点指定一个“时间”字段值。像这样:

    json_body = [
        {
            "measurement": "cpu_load_short",
            "tags": {
                "host": "server01",
                "region": "us-west"
            },
            "time": "2009-11-10T23:00:00Z",
            "fields": {
                "Float_value": 0.64,
                "Int_value": 3,
                "String_value": "Text",
                "Bool_value": True
            }
        }
    ]
    
    client = InfluxDBClient(host, port, user, password, dbname)
    client.write_points(json_body)
    

    【讨论】:

      猜你喜欢
      • 2020-10-11
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2019-05-21
      • 1970-01-01
      相关资源
      最近更新 更多