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 规范 对齐
- 使用 Starlark 处理器重命名 prometheus remote write 脚本 来将 measurement name 重命名为 fieldname,并将 fieldname 重命名为 value。
此页内容对您有帮助吗?
感谢您的反馈!
支持和反馈
感谢您成为我们社区的一份子!我们欢迎并鼓励您提供关于 Telegraf 和本文档的反馈和错误报告。如需获得支持,请使用以下资源
拥有年度合同或支持合同的客户 可以 联系 InfluxData 支持。