我在用旧数据回填普罗米修斯。我的输入数据是:
$ cat /etc/prometheus/backfill.txt
# HELP mymetric My metric.
# TYPE mymetric counter
mymetric{code="200",service="user"} 123 1665824331000
mymetric{code="500",service="user"} 456 1665824331000
# EOF然后,在医生们之后,运行不输出任何错误的命令:
$ promtool tsdb create-blocks-from openmetrics /etc/prometheus/backfill.txt /tmp/backfill_data
BLOCK ULID MIN TIME MAX TIME DURATION NUM SAMPLES NUM CHUNKS NUM SERIES SIZE
01GFNDV65PR5Z6MS5J82C6SAH4 1665824331000000 1665824331000001 1ms 2 2 2 787然后将创建的文件夹复制到Prometheus的数据文件夹:
$ cp -r /tmp/backfill_data/* /prometheus/data但随后什么也没发生:普罗米修斯没有列出这个指标。然而,它似乎正确地存储在TSDB中:
$ promtool tsdb analyze /prometheus/data
Block ID: 01GFNDV65PR5Z6MS5J82C6SAH4
Duration: 1ms
Series: 2
Label names: 3
Postings (unique label pairs): 4
Postings entries (total label pairs): 6
Label pairs most involved in churning:
2 service=user
2 __name__=mymetric
1 code=500
1 code=200
Label names most involved in churning:
2 __name__
2 code
2 service
Most common label pairs:
2 __name__=mymetric
2 service=user
1 code=200
1 code=500
Label names with highest cumulative label value length:
8 __name__
6 code
4 service
Highest cardinality labels:
2 code
1 __name__
1 service
Highest cardinality metric names:
2 mymetric我试图重新启动我的Prometheus容器,但这并没有改变任何事情。
编辑:我使用命令参数--no-scrape.adjust-timestamps --log.level=debug --config.file=/etc/prometheus/prometheus.yml --storage.tsdb.retention.time=2y --web.console.libraries=/usr/share/prometheus/console_libraries --web.console.templates=/usr/share/prometheus/consoles --web.config.file=/etc/prometheus/web.yml启动Prometheus
发布于 2023-01-20 18:47:57
您正在使用错误的时间格式创建回填文件,它只需要一个普通的unix时间戳,但您的文件以毫秒为单位。
因此,将其更改为:
# HELP mymetric My metric.
# TYPE mymetric counter
mymetric{code="200",service="user"} 123 1665824331
mymetric{code="500",service="user"} 456 1665824331
# EOF而且它应该能工作。
https://serverfault.com/questions/1113357
复制相似问题