turbot/prometheus

steampipe plugin install prometheussteampipe plugin install prometheus

Prometheus + Steampipe

Prometheus is an open-source monitoring system with a dimensional data model, flexible query language, efficient time series database and modern alerting approach.

Steampipe is an open source CLI to instantly query cloud APIs using SQL.

Query all the labels in your prometheus metrics:

select
name,
values
from
prometheus_label
> select name, values from prometheus_label
+---------------+----------------------------------------------+
| name | values |
+---------------+----------------------------------------------+
| alertname | ["TotalRequests"] |
| alertstate | ["firing"] |
| reason | ["refused","resolution","timeout","unknown"] |
| interval | ["10s"] |
| version | ["2.30.3","go1.17.1"] |
| code | ["200","302","400","500","503"] |
+---------------+----------------------------------------------+

Query data for a given metric (tables are dynamically created):

select
code,
handler,
value
from
prometheus_http_requests_total
+------+----------------------------+-------+
| code | handler | value |
+------+----------------------------+-------+
| 302 | / | 1 |
| 200 | /-/ready | 1 |
| 200 | /api/v1/alerts | 1 |
| 200 | /api/v1/label/:name/values | 421 |
| 200 | /api/v1/labels | 16 |
| 200 | /graph | 1 |
| 200 | /static/*filepath | 4 |
+------+----------------------------+-------+

Documentation

Get started

Install

Download and install the latest Prometheus plugin:

steampipe plugin install prometheus

Configuration

Installing the latest prometheus plugin will create a config file (~/.steampipe/config/prometheus.spc) with a single connection named prometheus:

connection "prometheus" {
plugin = "prometheus"
address = "http://localhost:9090"
metrics = ["prometheus_http_requests_.*", ".*error.*"]
}
  • address - HTTP address of your prometheus server
  • metrics - List of metric expressions to be matched against while creating dynamic metric tables

Get involved