https://github.com/lovromazgon/impromptu
CLI for scraping, querying and visualizing Prometheus metrics
https://github.com/lovromazgon/impromptu
cli prometheus promql visualization
Last synced: 8 months ago
JSON representation
CLI for scraping, querying and visualizing Prometheus metrics
- Host: GitHub
- URL: https://github.com/lovromazgon/impromptu
- Owner: lovromazgon
- License: mit
- Created: 2024-04-13T13:32:48.000Z (almost 2 years ago)
- Default Branch: main
- Last Pushed: 2025-05-02T18:45:48.000Z (9 months ago)
- Last Synced: 2025-05-02T19:37:15.946Z (9 months ago)
- Topics: cli, prometheus, promql, visualization
- Language: Go
- Homepage:
- Size: 386 KB
- Stars: 11
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
[](https://github.com/ConduitIO/conduit/blob/main/LICENSE)
[](https://github.com/lovromazgon/impromptu/actions/workflows/test.yml)
[](https://goreportcard.com/report/github.com/lovromazgon/impromptu)
Impromptu is a tool that scrapes metrics from a Prometheus endpoint and
continuously executes a user-provided PromQL query to visualize the metrics
in the CLI.
You can use Impromptu to get an insight into the metrics of a service without
deploying Prometheus and Grafana, mostly during development and testing.

## Installation
Install using homebrew:
```sh
brew install lovromazgon/tap/impromptu
```
Or download the binary manually from the [latest release](https://github.com/lovromazgon/impromptu/releases/latest).
> [!NOTE]
> When downloading Impromptu manually on MacOS you will get a warning about a safety issue.
> That's because Impromptu is currently not a signed binary, you have to do some
> [extra steps](https://support.apple.com/en-us/102445#openanyway) to make it run.
Once you have downloaded impromptu, you can try it out using this runnable example:
```sh
impromptu -t https://node.demo.prometheus.io/metrics -q "rate(node_cpu_seconds_total{mode=\"idle\"}[5s])" -r 1m
```
## Usage
```
Usage:
impromptu -t URL -q PROMQL_QUERY [-i DURATION] [-r DURATION]
Options:
-t, --target-url URL Fetch metrics from the specified URL
-q, --query-string PROMQL_QUERY Query to execute against the metrics
-i, --query-interval DURATION Interval to fetch metrics at [default: 1s]
-r, --query-range DURATION Range of the query [default: 5m]
-v, --version Print version information
URL represents an endpoint that serves Prometheus metrics in text format.
PROMQL_QUERY is a Prometheus query language expression that returns a single
time series. The query is executed every second and the result is displayed
in a terminal chart. The query should return a single time series, e.g. a
rate or a sum of a counter. The query interval and range can be adjusted with
the -i and -r flags.
DURATION is a time duration string that can be parsed by Go's time.ParseDuration
function. It represents a time interval, e.g. "5m" for 5 minutes, "1h" for 1
hour, "30s" for 30 seconds, "1h 2m 3s" for 1 hour, 2 minutes and 3 seconds etc.
Example:
$ impromptu -t https://node.demo.prometheus.io/metrics -q "rate(node_cpu_seconds_total{mode=\"idle\"}[5s])" -r 1m
```
## Roadmap
- [X] Remove initial 5 second delay (PR: https://github.com/prometheus/prometheus/pull/14073)
- [ ] Support for multiple time series
- [ ] Support for other charts (donut, bar chart)
- [ ] Display legend