Skip to content

Instantly share code, notes, and snippets.

@zulhfreelancer
Last active May 16, 2024 06:41
Show Gist options
  • Save zulhfreelancer/da4767404a88fb2273e9259b8d96d8f8 to your computer and use it in GitHub Desktop.
Save zulhfreelancer/da4767404a88fb2273e9259b8d96d8f8 to your computer and use it in GitHub Desktop.
Get all Prometheus metrics and descriptions/help texts

Get all Prometheus metrics and descriptions/help texts

Requirement:

As JSON

curl -sg 'http://prom-server:prom-port/api/v1/metadata' | jq -r '.data'

As CSV

curl -sg 'http://prom-server:prom-port/api/v1/metadata' | jq -r '(["metric_name","description"], (.data | to_entries[] | [.key, .value[0].help])) | @csv'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment