Drew DeVault 4 years ago
7 commits
d5eacb22 d5eacb22a525e767ec5e150c02dcbb0fabb5d383
Add date to labels for ranges >24 hours
File Commit Size Mode Time
LICENSE Initial commit 1 KiB -rw-r--r-- 4 years ago
README.md Implement &min=... 1.5 KiB -rw-r--r-- 4 years ago
go.mod go.mod: update module name 127 B -rw-r--r-- 4 years ago
go.sum Initial commit 6.2 KiB -rw-r--r-- 4 years ago
main.go Add date to labels for ranges >24 hours 6 KiB -rw-r--r-- 4 years ago

chartsrv

chartsrv is a dead-simple web application which runs Prometheus queries and charts the result as an SVG. You make a dashboard by putting a lot of these images into a web page. You make it refresh by adding <meta id="refresh" http-equiv="refresh" content="5"> to the header. Ta-da!

Live graph from metrics.sr.ht

This is a live graph from metrics.sr.ht

Running the daemon

$ go build -o chartsrv main.go
$ ./chartsrv https://prometheus.example.org
Listening on :8142

Forward /chart.svg to this address with your favorite reverse proxy. If you want to listen to some other port, pass a second argument like :1337.

Usage

Create a URL like https://chartsrv.example.org/chart.svg?query=...&args... and set the query parameters as appropriate:

  • query: required. Prometheus query to execute.
  • title: chart title
  • stacked: set to create an area chart instead of a line chart
  • since: time.ParseDuration to set distance in the past to start charting from
  • width, height: adjust chart dimensions in inches
  • step: number of seconds between data points
  • min, max: Y axis limits

Clone

HTTP

Subscribe

License

Authors

Drew DeVault: 100%

Analysis