Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to send multiple queries to Prometheus HTTP API?

Tags:

prometheus

This is a Prometheus HTTP API GET call for one query, i.e, "up".

http://localhost:port/api/v1/query?query=up[1m]

Now, if I want to send multiple queries (not only "up", but other queries as well), what will be the syntax?

like image 855
awesomemypro Avatar asked Dec 12 '25 14:12

awesomemypro


1 Answers

You can hack your way around it as long as you're not too picky about what you want to query. E.g. if you want to query all up time series and all cpu_utilization time series, you can use something like this:

{__name__=~"up|cpu_utilization"}

It will even work with range queries, as long as you want the same range for all time series:

{__name__=~"up|cpu_utilization"}[1m]

But not if you want different time ranges or want to add selectors (e.g. there's no easy way of combining up{job="prometheus} and cpu_utilization{instance="foo:8080"}).

like image 133
Alin Sînpălean Avatar answered Dec 15 '25 17:12

Alin Sînpălean



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!