我正在使用 python prometheus 客户端,并且无法将指标推送到 VictoriaMetrics (VM)。
有一个函数被调用push_to_gateway
,我试图用 VM: 替换 prometheus URL http://prometheus:9091 -> http://vm:8428/api/v1/write
。但是 VM 以 400 状态码响应。
我正在使用 python prometheus 客户端,并且无法将指标推送到 VictoriaMetrics (VM)。
有一个函数被调用push_to_gateway
,我试图用 VM: 替换 prometheus URL http://prometheus:9091 -> http://vm:8428/api/v1/write
。但是 VM 以 400 状态码响应。
我正在使用 CSV 导入,/api/v1/import/csv
如下所述:https ://github.com/VictoriaMetrics/VictoriaMetrics/blob/master/README.md#how-to-import-csv-data
直接从 pandas 数据框生成 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)
It possible to use push_to_gateway
method with VictoriaMetrics, check examples at gist https://gist.github.com/f41gh7/85b2eb895bb63b93ce46ef73448c62d0
另外,请看一下我最近创建的客户端:https ://github.com/gistart/prometheus-push-client
支持使用 InfluxDB 线路协议通过 UDP 和 HTTP 直接推送到 VictoriaMetrics
通过 UDP 到 StatsD 格式的 StatsD 或 statsd-exporter
通过 HTTP 以 OpenMetrics 格式推送网关或 prom-aggregation-gateway