Introducing Styx for Prometheus.
A simple tool for exporting data from Prometheus to CSV, gnuplot & matplotlib.

Video

Slides

You can find my Slides over at Speakerdeck.

Installation

go get -v -u github.com/go-pluto/styx

Optional dependencies are gnuplot & matplotlib.

Usage

CSV

# export the data for the last hour from http://localhost:9090 
styx 'go_goroutines'
styx 'sum(go_goroutines)'
styx 'go_goroutines{job="prometheus"}'
styx 'go_goroutines > 100'
# export the data for the last 6 hours from http://localhost:9090
styx --duration 6h 'sum(go_goroutines)' 
# export the data from a specific prometheus for the last hour.
styx --prometheus http://prom.example.com 'sum(go_goroutines)' 

gnuplot

# plot the data for the last hour from http://localhost:9090
styx gnuplot 'sum(go_goroutines)' > goroutines.gnuplot
# plot the data for the last 6 hours from http://localhost:9090
styx gnuplot --duration 6h 'sum(go_goroutines)' > goroutines.gnuplot 
# plot the data from a specific prometheus for the last hour.
styx gnuplot --prometheus http://prom.example.com 'sum(go_goroutines)' > goroutines.gnuplot

Once you have written the generated content into a file you can use this to edit and plot the graph:

gnuplot -p < test.gnuplot

matplotlib

# plot the data for the last hour from http://localhost:9090
styx matplotlib 'sum(go_goroutines)' > goroutines.py
# plot the data for the last 6 hours from http://localhost:9090
styx matplotlib --duration 6h 'sum(go_goroutines)' > goroutines.py 
# plot the data from a specific prometheus for the last hour.
styx matplotlib --prometheus http://prom.example.com 'sum(go_goroutines)' > goroutines.py

Once you have written the generated content into a file you can use this to edit and plot the graph:

python goroutines.py

Check it out at GitHub.