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.1.tar.gz (4.1 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.1-py3-none-any.whl (7.1 kB view details)

Uploaded Python 3

File details

Details for the file garf_prometheus-0.0.1.tar.gz.

File metadata

  • Download URL: garf_prometheus-0.0.1.tar.gz
  • Upload date:
  • Size: 4.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.9.4

File hashes

Hashes for garf_prometheus-0.0.1.tar.gz
Algorithm Hash digest
SHA256 87ac1eb85531c58d4a1915aa8466a4978e7f658bd6f2316aec1576f002c16baf
MD5 791880b5ddd7b362f15289fab4815060
BLAKE2b-256 f810aeae6c6a73a5be9fb322a043f8e9b5b546dd0c1b6e121d43e1f99bec5195

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for garf_prometheus-0.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 3b7a0850c6311c7d57e08e56e697ba405963b47455f4549460e3aef820c49a6f
MD5 4181d98409803ec206a53907319411c8
BLAKE2b-256 98590b60d88fa9238da3568b66d5ce1f27523e23f6dbbf9db70ad88580f06970

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