Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/sandipb/gcp-prom-query

CLI to query Google's managed prometheus API. Basically promtool with JWT support.
https://github.com/sandipb/gcp-prom-query

Last synced: about 6 hours ago
JSON representation

CLI to query Google's managed prometheus API. Basically promtool with JWT support.

Awesome Lists containing this project

README

        

# gcp-prom-query - Query GCP Prometheus API

## Usage

```shell-session
$ ./gcp-prom-query -h
usage: gcp-prom-query [] [ ...]

Runs query on the gcp prometheus api

Flags:
-h, --help Show context-sensitive help (also try --help-long and --help-man).
-v, --version Show version
-d, --debug Debug level logging
-t, --timeout=10 Timeout in seconds for the query
-u, --prom-api="localhost:9090"
URL to API server. Used when gcp-project is not provided.
-p, --gcp-project=GCP-PROJECT Name of the GCP project. If not given, uses 'prom-api'
-a, --gcp-token=GCP-TOKEN Name of the GCP project. Required if project is given. Can also be provided via env var GCP_ACCESS_TOKEN

Commands:
help [...]
Show help.

instant []
Instant query

$ ./gcp-prom-query instant -h
usage: gcp-prom-query instant []

Instant query

Flags:
...
--now=NOW Time to run instant query as Unix epoch time

Args:
Promql query
```

## Sample output

```shell-session
$ ./gcp-prom-query -p some-gcp-project instant 'sum by(job)(scrape_samples_scraped)'
+--------------------+-------+------------+
| METRIC | VALUE | TIMESTAMP |
+--------------------+-------+------------+
| {job="prometheus"} | 446.0 | 1655917668 |
+--------------------+-------+------------+
```