Reliable Insights

A blog on monitoring, scale and operational sanity

Prometheus query results as CSV

The default JSON output isn’t always what you want when querying Prometheus. Let’s see how to get out CSV files.

I’ve written a small Python program to show how you can view the output of an instant query as CSV files.

Let’s see it in action against the live demo:

pip install requests  # If you don't have it already.
python 'irate(process_cpu_seconds_total[1m])'

Which produces output like:


This can be further processed or redirected to a file, which you can load up in Excel!


To learn how we can help you extract useful information with Prometheus queries, contact us.

Brian BrazilPrometheus query results as CSV
Share this post

Related Posts