文档文档

Prometheus Remote Write 输入数据格式

使用 prometheusremotewrite 输入数据格式来解析 Prometheus Remote Write 样本到 Telegraf 指标中。

如果您正在使用 InfluxDB 1.x 和 [Prometheus Remote Write 端点](https://github.com/influxdata/telegraf/blob/master/plugins/parsers/prometheusremotewrite/README.md) 来写入指标,您可以迁移到 InfluxDB 2.0 并使用此解析器。为了使指标与 1.x 端点完全一致,请添加 Starlark 处理器,如 此处 所述。

将 Prometheus remote write 样本直接转换为 Telegraf 指标。它可以与 http_listener_v2 一起使用。Prometheus Remote Write 样本没有其他配置选项。

配置

[[inputs.http_listener_v2]]
  ## Address and port to host HTTP listener on
  service_address = ":1234"

  ## Paths to listen to.
  paths = ["/receive"]

  ## Data format to consume.
  data_format = "prometheusremotewrite"

示例输入

prompb.WriteRequest{
        Timeseries: []*prompb.TimeSeries{
            {
                Labels: []*prompb.Label{
                    {Name: "__name__", Value: "go_gc_duration_seconds"},
                    {Name: "instance", Value: "localhost:9090"},
                    {Name: "job", Value: "prometheus"},
                    {Name: "quantile", Value: "0.99"},
                },
                Samples: []prompb.Sample{
                    {Value: 4.63, Timestamp: time.Date(2020, 4, 1, 0, 0, 0, 0, time.UTC).UnixNano()},
                },
            },
        },
    }

示例输出

prometheus_remote_write,instance=localhost:9090,job=prometheus,quantile=0.99 go_gc_duration_seconds=4.63 1614889298859000000

为了与 InfluxDB v1.x Prometheus Remote Write 规范 对齐


此页内容对您有帮助吗?

感谢您的反馈!


Flux 的未来

Flux 即将进入维护模式。您可以继续像现在这样使用它,而无需对代码进行任何更改。

阅读更多

InfluxDB 3 开源版本现已公开发布 Alpha 版

InfluxDB 3 开源版本现已可用于 Alpha 测试,根据 MIT 或 Apache 2 许可授权。

我们正在发布两个作为 Alpha 版本一部分的产品。

InfluxDB 3 Core 是我们新的开源产品。它是用于时间序列和事件数据的最新数据引擎。InfluxDB 3 Enterprise 是一个商业版本,它建立在 Core 的基础上,增加了历史查询功能、读取副本、高可用性、可扩展性和细粒度的安全性。

有关如何开始使用的更多信息,请查看