0.0
No release in over 3 years
Used to connect Legion to Prometheus
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
 Dependencies

Runtime

 Project Readme

lex-prometheus

LegionIO extension for querying Prometheus via the HTTP API v1.

Installation

Add to your Gemfile:

gem 'lex-prometheus'

Standalone Usage

require 'legion/extensions/prometheus'

client = Legion::Extensions::Prometheus::Client.new(
  url:      'http://prometheus:9090',
  username: 'admin',   # optional
  password: 'secret'   # optional
)

# Instant query
client.instant_query(query: 'up')
client.instant_query(query: 'up', time: '2026-01-01T00:00:00Z')

# Range query
client.range_query(query: 'rate(http_requests_total[5m])', start: '2026-01-01T00:00:00Z', end_time: '2026-01-02T00:00:00Z', step: '1h')

# Series
client.series(match: 'up')
client.series(match: '{job="prometheus"}', start: '2026-01-01T00:00:00Z')

# Labels
client.labels
client.label_values(label_name: 'job')

# Alerts and rules
client.list_alerts
client.list_rules

Authentication

Basic auth is optional. Pass username: and password: to the Client constructor if your Prometheus instance requires authentication.

License

MIT