How to export Prometheus raw metric data?

Hey guys,

I’ve been working with Prometheus to gather data for an AI project (i.e., all of the gathered raw data is needed) and was able to set it up correctly. However, I now wish to export the raw data and I tried using the HTTP API. It works with 1 metric but I wasn’t able to get it working for multiple. This is my current solution:

<http://xxxx:9090/api/v1/query_range?query={__name__=~"up|http://xxxx:9090/api/v1/query_range?query={__name__=~"up> | node_disk_read_bytes_total"}&amp;start=2021-04-08T15:10:30.781Z&amp;end=2021-04-08T17:11:00.781Z&amp;step=1s

What am I doing wrong? Is it even possible? Is there a better solution for exporting all of the gathered metric data? Otherwise I may have to turn to a Python client…

I think it’s due to the spaces before and after the pipe. Try:
[http://xxxx:9090/api/v1/query_range?query={__name__=~](http://xxxx:9090/api/v1/query_range?query={__name__=~)"up|node_disk_read_bytes_total"}&amp;start=2021-04-08T15:10:30.781Z&amp;end=2021-04-08T17:11:00.781Z&amp;step=1s

if you wish to export all metrics from one job, rather take the {job="my_ai_job"} matcher

Nice, thank you for your solution! As I am using a Kubernetes cluster on Google Cloud, do you think there are metrics not related to a job (i.e., node in the cluster)?