Closed karim-manaouil closed 4 years ago
Hi @karim-manaouil! Looks like import was successful and the reason why you don't see query results may be following:
curl -g "http://localhost:8428/api/v1/export?match[]=apiserver_request_count"
. If you see data returned then VM actually has that data saved.The third options seems most likely to me. The reason is that you use instant query handler that returns only last datapoint for last 5minute. It means, if there was no data in last 5 minutes - the result will be always empty.
To avoid this please specify the time
param (time=<rfc3339 | unix_timestamp>
) in the query:
curl -g "http://localhost:8428/api/v1/query?query=apiserver_request_count&time= 1587688778083"
.
Another option is to use query range handler, that scans data over a time range.
But the most handy tool to explore data in VM is to use Grafana and its Explore feature. It provides very useful tools for querying data from Prometheus compatible datasources.
Hi @hagen1778 Thanks for the detailed reply. Honestly, I tried the export handler with the Prometheus snapshots and it didn't work again. However, I wasn't really focusing and I know I was missing something somewhere. Anyway, I completely switched to using VictoriaMetrics as my Backend storage and I use the native exportation mechanism and it works really great. I really like this tool, it's very complete, robust and very well documented. Keep it up. Thanks.
Moved to native exportation mechanism of VictoriaMetrics.
I want to do offline analysis of a Kubernetes cluster so I generated a Prometheus snapshot based on this article, compressed it and moved to my local machine. Initially, I used a local Prometheus instance and it worked great, I can locally access all the cluster time series and perform the queries. The day after when I woke up, I uncompressed the snapshot again and launched a new local Prometheus instance but I can no more see the time series, everything returns empty results. Based on the Prometheus server log, it looks like it runs a garbage collector on old data so I tricked the system time and the GC is no more triggered but the same problem, no results.
I decided to use VictoriaMetrics, so I uncompressed the Prometheus snapshot again and loaded it into VictoMetrics using vmctl as explained in the docs. It was loaded successfully and it shows the correct min and max UNIX timestamps. I can get all the labels correctly but querying the time series returns empty results again. I have no idea what's the reason behind this behavior. I have many compressed tarballs of Prometheus snapshots that worked fine the night before with the local Prometheus instance but now they don't work neither with Prometheus nor VictoriaMetrics.
Here is the vmctl output: