organization | category | icon_url | brand_color | display_name | short_name | description | og_description | og_image | engines | |||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Turbot |
|
/images/plugins/turbot/prometheus.svg |
#E6522C |
Prometheus |
prometheus |
Steampipe plugin to query metrics, labels, alerts and more from Prometheus. |
Query Prometheus with SQL! Open source CLI. No DB required. |
/images/plugins/turbot/prometheus-social-graphic.png |
|
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 zero-ETL engine 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 |
+------+----------------------------+-------+
Download and install the latest Prometheus plugin:
steampipe plugin install prometheus
Installing the latest prometheus plugin will create a config file (~/.steampipe/config/prometheus.spc
) with a single connection named prometheus
:
connection "prometheus" {
plugin = "prometheus"
# The address of your Prometheus.
# Can also be set with the PROMETHEUS_URL environment variable
address = "http://localhost:9090"
metrics = ["prometheus_http_requests_.*", ".*error.*"]
}
address
- HTTP address of your prometheus server. Can also be set with the PROMETHEUS_URL environment variable.metrics
- List of metric expressions to be matched against while creating dynamic metric tables.