Skip to main content

Garf implementation for Prometheus API

Project description

garf for Prometheus HTTP API

PyPI Downloads PyPI

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-executors package to run queries via CLI (pip install garf-executors).

garf <PATH_TO_QUERIES> --source prometheus \
  --output <OUTPUT_TYPE> \
  --prometheus.endpoint=http://localhost:9090

where:

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.

Project details


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)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

garf_prometheus-0.0.2-py3-none-any.whl (7.4 kB view details)

Uploaded Python 3

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

Hashes for garf_prometheus-0.0.2.tar.gz
Algorithm Hash digest
SHA256 3305a0e7a7f96a49efc1bcf7f408b1aeaae691eb8da0ebf06f0b8fdb07f7f696
MD5 3b9a0a3438e92f41ce2804904cee6ade
BLAKE2b-256 d5c349f5572ef4f3203bfcfcbb263b1678090b06f35a8142dc4e2c337b4b1ccb

See more details on using hashes here.

File details

Details for the file garf_prometheus-0.0.2-py3-none-any.whl.

File metadata

File hashes

Hashes for garf_prometheus-0.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 9119b592277178f378af391e95cebd3615f6d0f169455f55c746b9bc1b297de2
MD5 2e2a16b8c222088bd98676e8b29ab8da
BLAKE2b-256 2903708bafd914d3ebe9f22d7cd41b7d3d83ef970123e903cec583ca6223bf5f

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page