Skip to content

Instantly share code, notes, and snippets.

@zulhfreelancer
Last active April 4, 2024 04:13
Show Gist options
  • Save zulhfreelancer/c3871524cfdec959a776bda585a16418 to your computer and use it in GitHub Desktop.
Save zulhfreelancer/c3871524cfdec959a776bda585a16418 to your computer and use it in GitHub Desktop.
How to query Prometheus from local CLI / Terminal

How to query Prometheus from local CLI / Terminal

Requirements

promtool - see installation steps here

Command

promtool query instant '<PROM_SERVER_URL>' '<PROM_QUERY>' | jq

Normal output example

promtool query instant 'http://localhost:9090/' 'up' | jq

JSON output example

promtool query instant -o json 'http://localhost:9090/' 'up' | jq

References

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment