https://github.com/mtulio/prometheus-cli
Prometheus Command Line Interface to interact with Prometheus API
https://github.com/mtulio/prometheus-cli
Last synced: 10 months ago
JSON representation
Prometheus Command Line Interface to interact with Prometheus API
- Host: GitHub
- URL: https://github.com/mtulio/prometheus-cli
- Owner: mtulio
- License: apache-2.0
- Created: 2019-03-10T17:14:28.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2019-03-24T03:20:58.000Z (about 7 years ago)
- Last Synced: 2025-02-24T03:17:44.314Z (over 1 year ago)
- Language: Go
- Size: 25.4 KB
- Stars: 0
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# prometheus-cli
Prometheus Command Line Interface to interact with [Prometheus API](https://prometheus.io/docs/prometheus/latest/querying/api/).
## USAGE
[Series Documentation reference](https://prometheus.io/docs/prometheus/latest/querying/api/#querying-metadata) to understand the API usage.
### SERIES Query
* Show all series for an query
```bash
$ PROMETHEUS_API_URL=http://prometheus.internal:9090 \
./bin/prometheus-cli \
-query=go_info \
-start="2018-06-01T20:10:30.781Z" \
-end="2018-12-31T00:00:00.000Z" \
-verbose \
series
```
### SERIES Removal
* Delete specific series.
> Eg. deleting series `go_info`.
```bash
$ PROMETHEUS_API_URL=http://prometheus.internal:9090 \
./bin/prometheus-cli \
-match=go_info \
-time.start="2018-09-02T00:00:00.000Z" \
-time.end="2018-09-02T23:59:59.999Z" \
-verbose \
-force \
delete
```
* Delete all series on time range.
> E.g. lookup by `__name__` ("all metrics") series, deletem them on specific `start` and `end`.
> WARNING: We don't responsible for the data loss.
```bash
$ PROMETHEUS_API_URL=http://prometheus.internal:9090 \
./bin/prometheus-cli \
-time.start="2018-09-02T00:00:00.000Z" \
-time.end="2018-09-02T23:59:59.999Z" \
-verbose \
-query='{__name__}' \
delete-batch
```
### LABELS Query
* List Label - metric name
```bash
$ PROMETHEUS_API_URL=http://prometheus.internal:9090 \
./bin/prometheus-cli \
-verbose \
-query=__name__ \
label
```
* List Label - instance
```bash
$ PROMETHEUS_API_URL=http://prometheus.internal:9090 \
./bin/prometheus-cli \
-query=instance \
-verbose \
label
```
## CONTRIBUTING
Feel free to contributing opening an Issue or an PR. =)