一、Prometheus启动后没有数据,查看日志
- 日志的时间戳与当前时间戳不一致。
level=warn ts=2021-09-05T08:11:56.003Z caller=scrape.go:1380 component="scrape manager" scrape_pool=prometheus target=http://localhost:9090/metrics msg="Error on ingesting samples that are too old or are too far into the future" num_dropped=317
level=warn ts=2021-09-05T08:11:56.003Z caller=scrape.go:1096 component="scrape manager" scrape_pool=prometheus target=http://localhost:9090/metrics msg="Appending scrape report failed" err="out of bounds"
- 解决办法
- 1 重新创建一个目录
[root@Ansible01 ~]# cd /usr/local/Prometheus
[root@Ansible01 Prometheus]# ls
console_libraries consoles LICENSE NOTICE prometheus prometheus.yml promtool
[root@Ansible01 Prometheus]# mkdir data
[root@Ansible01 Prometheus]# /usr/local/Prometheus/prometheus --config.file=/usr/local/Prometheus/prometheus.yml --storage.tsdb.path=/usr/local/Prometheus/data
- 2 删除data日志
注: 这个data
目录是因为/usr/local/Prometheus/prometheus --config.file=/usr/local/Prometheus/prometheus.yml
命令执行后 /usr/local/
路径下与Prometheus平
行
[root@Ansible01 Prometheus]# cd ../data/
[root@Ansible01 data]# ls
chunks_head lock queries.active wal
[root@Ansible01 data]# cd ..
[root@Ansible01 local]# ls
bin data etc games include lib lib64 libexec Prometheus sbin share src
[root@Ansible01 local]# rm -rf data/
[root@Ansible01 local]# ls
bin etc games include lib lib64 libexec Prometheus sbin share src