Prometheus and PromQL 3 cheatsheet
Prometheus and PromQL 3: Selecting data
5 common Prometheus and PromQL 3 tasks.
Filter by labels
Match labels exactly with = and !=, or by regular expression with =~ and !~.
http_requests_total{job="api", status=~"5..", method!="OPTIONS"}
Select a range of samples
Return the samples from the last five minutes. Range vectors are the input to functions such as rate.
http_requests_total{job="api"}[5m]
Find targets that are down
The up metric is 1 when the last scrape worked and 0 when it failed.
up == 0