garf for Prometheus HTTP API
garf-prometheus simplifies fetching data from Prometheus HTTP API using SQL-like queries.
Prerequisites
- Running Prometheus instance
Installation
pip install garf-prometheus
Usage
Run as a library
import os
from garf.io import writer
from garf.community.prometheus import PrometheusApiReportFetcher
query = """
SELECT
timestamp,
instance,
job,
value
FROM query
WHERE query = up
"""
fetched_report = (
PrometheusApiReportFetcher(
endpoint='http://localhost:9090'
)
.fetch(query)
)
console_writer = writer.create_writer('console')
console_writer.write(fetched_report, 'query')
Run via CLI
Install
garf-executorspackage to run queries via CLI (pip install garf-executors).
garf <PATH_TO_QUERIES> --source prometheus \
--output <OUTPUT_TYPE> \
--prometheus.endpoint=http://localhost:9090
where:
PATH_TO_QUERIES- local or remove files containing queriesoutput- output supported bygarf-iolibrary.SOURCE_PARAMETER=VALUE- key-value pairs to refine fetching, check available source parameters.
Available source parameters
| name | values | comments |
|---|---|---|
endpoint |
Base URL when Prometheus is running (http://localhost:9090 by default) |
Documentation
You can find a documentation on garf-prometheus here.
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
garf_prometheus-0.0.2.tar.gz
(4.3 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file garf_prometheus-0.0.2.tar.gz.
File metadata
- Download URL: garf_prometheus-0.0.2.tar.gz
- Upload date:
- Size: 4.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via:
uv/0.9.4
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
3305a0e7a7f96a49efc1bcf7f408b1aeaae691eb8da0ebf06f0b8fdb07f7f696
|
|
| MD5 |
3b9a0a3438e92f41ce2804904cee6ade
|
|
| BLAKE2b-256 |
d5c349f5572ef4f3203bfcfcbb263b1678090b06f35a8142dc4e2c337b4b1ccb
|
File details
Details for the file garf_prometheus-0.0.2-py3-none-any.whl.
File metadata
- Download URL: garf_prometheus-0.0.2-py3-none-any.whl
- Upload date:
- Size: 7.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via:
uv/0.9.4
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
9119b592277178f378af391e95cebd3615f6d0f169455f55c746b9bc1b297de2
|
|
| MD5 |
2e2a16b8c222088bd98676e8b29ab8da
|
|
| BLAKE2b-256 |
2903708bafd914d3ebe9f22d7cd41b7d3d83ef970123e903cec583ca6223bf5f
|