Within the Prometheus UI if you navigate to Status -> Targets you can see what targets Prometheus is scraping (or attempting to scrape) and when each was last successfully scraped.
You can query Prometheus via it's HTTP API: https://prometheus.io/docs/prometheus/latest/querying/api/ On Thursday, February 27, 2020 at 10:40:38 AM UTC-8, adi garg wrote: > > Thanks a lot, Brian, that clears a lot of things for me. Just one more > doubt is there a way to look at the current scraped metrics as I am not > sure but I think that Prometheus stores metrics in 2 hours chunk in the > memory(Ram) and after then sends them to the storage(SSD). Like how can I > confirm this that my Prometheus is scraping all those targets? > Moreover, that querying part can either be done by promql locally or using > grafana right? > > On Thursday, February 27, 2020 at 11:55:58 PM UTC+5:30, Brian Candler > wrote: >> >> On Thursday, 27 February 2020 17:53:41 UTC, adi garg wrote: >>> >>> I was able to select my hs2 metrics there for querying, but I couldn't >>> see them on localhost:9090/metrics. Is there any reason for it. >>> >> >> Yes. >> >> /metrics on the prometheus server only exposes metrics about the >> operation of the prometheus server itself. >> >> If you want to query metrics which are *stored* in the prometheus time >> series database, then you need to use the prometheus API: >> >> https://prometheus.io/docs/prometheus/latest/querying/api/#expression-queries >> >> There's a command line interface that wraps this for you: e.g. >> promtool query instant http://localhost:9090 up >> is like entering "up" as a query in the GUI >> >> >>> Also, my metrics on port 12156 are present on the '/' route and not on >>> '/metrics', so that can be handled with metrics_path right? >>> >>> >> Yes. If you can scrape the metrics using >> curl http://x.x.x.x:12156/ >> then prometheus needs metrics_path of "/" >> >> -- You received this message because you are subscribed to the Google Groups "Prometheus Users" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/prometheus-users/e5dfdf8c-49c1-48a3-8486-620ae48036cc%40googlegroups.com.

