繁体   English   中英

如何将 prometheus 指标直接推送到 VictoriaMetrics?

[英]How to push prometheus metrics directly to VictoriaMetrics?

我正在使用 python prometheus 客户端,并且无法将指标推送到 VictoriaMetrics (VM)。

There is a function called push_to_gateway and I tried to replace prometheus URL with VM: http://prometheus:9091 -> http://vm:8428/api/v1/write . 但 VM 以 400 状态码响应。

可以将push_to_gateway方法与 VictoriaMetrics 一起使用,请查看要点https://gist.github.com/f41gh7/85b2eb895bb63b93ce46ef73448c62d0中的示例

我在/api/v1/import/csv使用 CSV 导入,如下所述: https://github.com/VictoriaMetrics/VictoriaMetrics/blob/master/README.md#how-to-import-csv-data

直接从 pandas dataframe 生成 CSV。 就像是:

    df.rename(columns={'timestamp': 'ts_ns'}, inplace=True)
    data = df.to_csv(index=False, header=False)

    csv_format = f'1:time:unix_ns{metric_format}{label_format}'

    response = requests.post(url, params={'format': csv_format}, data=data)

另外,请看一下我最近创建的客户端: https://github.com/gistart/prometheus-push-client

支持使用 InfluxDB 线路协议通过 UDP 和 HTTP 直接推送到 VictoriaMetrics

通过 UDP 到 StatsD 格式的 StatsD 或 statsd-exporter

通过 HTTP 以 OpenMetrics 格式推送网关或 prom-aggregation-gateway

我尝试使用https://github.com/VictoriaMetrics/VictoriaMetrics/blob/master/README.md#how-to-import-csv-data

但我不知道究竟出了什么问题。

我正在使用 csv 文件,我在 python 中没有大手笔。 我只想将它导入prometheus。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM