Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve table docs #34

Merged
merged 11 commits into from
Dec 12, 2023
12 changes: 12 additions & 0 deletions .github/workflows/steampipe-anywhere.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
name: Release Steampipe Anywhere Components

on:
push:
tags:
- 'v*'


jobs:
anywhere_publish_workflow:
uses: turbot/steampipe-workflows/.github/workflows/steampipe-anywhere.yml@main
secrets: inherit
24 changes: 21 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,18 @@ from
+------+----------------------------+-------+
```

## Engines

This plugin is available for the following engines:

| Engine | Description
|---------------|------------------------------------------
| [Steampipe](https://steampipe.io/docs) | The Steampipe CLI exposes APIs and services as a high-performance relational database, giving you the ability to write SQL-based queries to explore dynamic data. Mods extend Steampipe's capabilities with dashboards, reports, and controls built with simple HCL. The Steampipe CLI is a turnkey solution that includes its own Postgres database, plugin management, and mod support.
| [Postgres FDW](https://steampipe.io/docs/steampipe_postgres/overview) | Steampipe Postgres FDWs are native Postgres Foreign Data Wrappers that translate APIs to foreign tables. Unlike Steampipe CLI, which ships with its own Postgres server instance, the Steampipe Postgres FDWs can be installed in any supported Postgres database version.
| [SQLite Extension](https://steampipe.io/docs//steampipe_sqlite/overview) | Steampipe SQLite Extensions provide SQLite virtual tables that translate your queries into API calls, transparently fetching information from your API or service as you request it.
| [Export](https://steampipe.io/docs/steampipe_export/overview) | Steampipe Plugin Exporters provide a flexible mechanism for exporting information from cloud services and APIs. Each exporter is a stand-alone binary that allows you to extract data using Steampipe plugins without a database.
| [Turbot Pipes](https://turbot.com/pipes/docs) | Turbot Pipes is the only intelligence, automation & security platform built specifically for DevOps. Pipes provide hosted Steampipe database instances, shared dashboards, snapshots, and more.

## Developing

Prerequisites:
Expand Down Expand Up @@ -120,11 +132,17 @@ Further reading:
- [Writing plugins](https://steampipe.io/docs/develop/writing-plugins)
- [Writing your first table](https://steampipe.io/docs/develop/writing-your-first-table)

## Contributing
## Open Source & Contributing

This repository is published under the [Apache 2.0](https://www.apache.org/licenses/LICENSE-2.0) (source code) and [CC BY-NC-ND](https://creativecommons.org/licenses/by-nc-nd/2.0/) (docs) licenses. Please see our [code of conduct](https://github.com/turbot/.github/blob/main/CODE_OF_CONDUCT.md). We look forward to collaborating with you!

[Steampipe](https://steampipe.io) is a product produced from this open source software, exclusively by [Turbot HQ, Inc](https://turbot.com). It is distributed under our commercial terms. Others are allowed to make their own distribution of the software, but cannot use any of the Turbot trademarks, cloud services, etc. You can learn more in our [Open Source FAQ](https://turbot.com/open-source).

## Get Involved

Please see the [contribution guidelines](https://github.com/turbot/steampipe/blob/main/CONTRIBUTING.md) and our [code of conduct](https://github.com/turbot/steampipe/blob/main/CODE_OF_CONDUCT.md). All contributions are subject to the [Apache 2.0 open source license](https://github.com/turbot/steampipe-plugin-prometheus/blob/main/LICENSE).
**[Join #steampipe on Slack →](https://turbot.com/community/join)**

`help wanted` issues:
Want to help but don't know where to start? Pick up one of the `help wanted` issues:

- [Steampipe](https://github.com/turbot/steampipe/labels/help%20wanted)
- [Prometheus Plugin](https://github.com/turbot/steampipe-plugin-prometheus/labels/help%20wanted)
402 changes: 402 additions & 0 deletions docs/LICENSE

Large diffs are not rendered by default.

6 changes: 2 additions & 4 deletions docs/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,14 @@ short_name: "prometheus"
description: "Steampipe plugin to query metrics, labels, alerts and more from Prometheus."
og_description: "Query Prometheus with SQL! Open source CLI. No DB required."
og_image: "/images/plugins/turbot/prometheus-social-graphic.png"
engines: ["steampipe", "sqlite", "postgres", "export"]
---

# Prometheus + Steampipe

[Prometheus](https://prometheus.io) is an open-source monitoring system with a dimensional data model, flexible query language, efficient time series database and modern alerting approach.

[Steampipe](https://steampipe.io) is an open source CLI to instantly query cloud APIs using SQL.
[Steampipe](https://steampipe.io) is an open-source zero-ETL engine to instantly query cloud APIs using SQL.

Query all the labels in your prometheus metrics:

Expand Down Expand Up @@ -98,7 +99,4 @@ connection "prometheus" {
- `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.

## Get involved

- Open source: https://github.com/turbot/steampipe-plugin-prometheus
- Community: [Join #steampipe on Slack →](https://turbot.com/community/join)
53 changes: 45 additions & 8 deletions docs/tables/prometheus_alert.md
Original file line number Diff line number Diff line change
@@ -1,36 +1,73 @@
# Table: prometheus_alert
---
title: "Steampipe Table: prometheus_alert - Query Prometheus Alerts using SQL"
description: "Allows users to query Alerts in Prometheus, specifically the active alerts and their details, providing insights into system performance and potential issues."
---

List alerts in the Prometheus server.
# Table: prometheus_alert - Query Prometheus Alerts using SQL

Prometheus is an open-source systems monitoring and alerting toolkit. It provides a multi-dimensional data model with time series data identified by metric name and key/value pairs. Alerts in Prometheus sends notifications to external systems when certain conditions are observed in the monitored system.

## Table Usage Guide

The `prometheus_alert` table provides insights into active alerts within Prometheus. As a system administrator or DevOps engineer, explore alert-specific details through this table, including alert name, severity, and associated metadata. Utilize it to uncover information about active alerts, such as those with high severity, the conditions that triggered the alerts, and the duration for which the alerts have been active.

## Examples

### List all alerts
Gain insights into all the alerts currently active in your system. This can be useful for monitoring system health and responding quickly to any issues.

```sql
```sql+postgres
select
*
from
prometheus_alert
prometheus_alert;
```

```sql+sqlite
select
*
from
prometheus_alert;
```

### Alerts with a labeled severity of high
Identify instances where alerts have been marked with a high severity level. This can be useful in prioritizing responses to potential issues within your system.

```sql+postgres
select
*
from
prometheus_alert
where
labels ->> 'severity' = 'high';
```

```sql
```sql+sqlite
select
*
from
prometheus_alert
where
labels ->> 'severity' = 'high'
json_extract(labels, '$.severity') = 'high';
```

### Alerts that became active in the last 5 mins
Discover the alerts that have been activated recently, allowing you to respond promptly to any potential issues or threats. This can be particularly beneficial in real-time monitoring and incident response scenarios.

```sql
```sql+postgres
select
*
from
prometheus_alert
where
active_at > now() - interval '5 min'
active_at > now() - interval '5 min';
```

```sql+sqlite
select
*
from
prometheus_alert
where
active_at > datetime('now', '-5 minutes');
```
42 changes: 36 additions & 6 deletions docs/tables/prometheus_label.md
Original file line number Diff line number Diff line change
@@ -1,21 +1,39 @@
# Table: prometheus_label
---
title: "Steampipe Table: prometheus_label - Query Prometheus Labels using SQL"
description: "Allows users to query Labels in Prometheus, specifically the metadata attached to timeseries data, providing insights into the metrics data and its dimensions."
---

List labels and their values discovered by the Prometheus server.
# Table: prometheus_label - Query Prometheus Labels using SQL

Prometheus Labels are a type of metadata attached to timeseries data in Prometheus, a widely used open-source monitoring and alerting toolkit. Labels enable the identification of the metrics data and its dimensions, such as instance, job, etc. They play a crucial role in data querying, visualization, and aggregation.

## Table Usage Guide

The `prometheus_label` table provides insights into the labels used in Prometheus. As a DevOps engineer or a system administrator, you can explore label-specific details through this table, including the key-value pairs that identify the timeseries data. Utilize it to uncover information about the metrics data, such as the instance it belongs to, the job it is associated with, and other dimensions that help in effective data querying and visualization.

## Examples

### List all labels names
Explore all existing labels in your Prometheus monitoring system to understand the various classifications and groupings within your data. This can help in organizing and managing your system more effectively.

```sql
```sql+postgres
select
name
from
prometheus_label
prometheus_label;
```

```sql+sqlite
select
name
from
prometheus_label;
```

### List all labels with their values
Explore which labels are associated with specific values in your Prometheus data. This can help you categorize and better understand your data for more effective management and analysis.

```sql
```sql+postgres
select
ln.name as name,
value
Expand All @@ -24,5 +42,17 @@ from
jsonb_array_elements_text(ln.values) as value
order by
name,
value
value;
```

```sql+sqlite
select
ln.name as name,
value
from
prometheus_label as ln,
json_each(ln.values) as value
order by
name,
value.value;
```
77 changes: 65 additions & 12 deletions docs/tables/prometheus_metric.md
Original file line number Diff line number Diff line change
@@ -1,50 +1,90 @@
# Table: prometheus_metric
---
title: "Steampipe Table: prometheus_metric - Query Prometheus Metrics using SQL"
description: "Allows users to query Metrics in Prometheus, specifically the numerical data about the system's state, providing insights into system performance and potential anomalies."
---

List metric values for a query and time range.
# Table: prometheus_metric - Query Prometheus Metrics using SQL

Notes:
Prometheus is an open-source systems monitoring and alerting toolkit. It collects numerical data about the state of a system at any point in time. This data is stored as a series of metrics, which can be queried and visualized to gain insights into system performance.

* A `query` must be provided in all queries to this table.
## Table Usage Guide

The `prometheus_metric` table provides insights into the numerical data about the state of a system in Prometheus. As a system administrator or DevOps engineer, explore metric-specific details through this table, including metric names, labels, and values. Utilize it to monitor system performance, identify potential issues, and make data-driven decisions about system improvements.

**Important Notes**
- A `query` must be provided in all queries to this table.

## Examples

### Get current values for a metric
Explore the current values for a specific metric to monitor the performance and health of your system. This could be particularly useful in identifying potential issues or bottlenecks in your system's operation.

```sql
```sql+postgres
select
*
from
prometheus_metric
where
query = 'prometheus_http_requests_total'
query = 'prometheus_http_requests_total';
```

```sql+sqlite
select
*
from
prometheus_metric
where
query = 'prometheus_http_requests_total';
```

### Get current values for a metric with specific labels
Explore the current values of a specific metric by identifying its unique labels. This can be beneficial in monitoring and analyzing the performance of your system based on certain parameters.

```sql+postgres
select
*
from
prometheus_metric
where
query = 'prometheus_http_requests_total{handler="/metrics"}';
```

```sql
```sql+sqlite
select
*
from
prometheus_metric
where
query = 'prometheus_http_requests_total{handler="/metrics"}'
query = 'prometheus_http_requests_total{handler="/metrics"}';
```

### Get values from 24 hrs ago for a metric
Analyze the metrics to understand the changes in HTTP requests over the past 24 hours. This is particularly useful for monitoring server performance and identifying potential issues or anomalies.

```sql
```sql+postgres
select
*
from
prometheus_metric
where
query = 'prometheus_http_requests_total'
and timestamp = now() - interval '24 hrs'
and timestamp = now() - interval '24 hrs';
```

```sql+sqlite
select
*
from
prometheus_metric
where
query = 'prometheus_http_requests_total'
and timestamp = datetime('now', '-24 hours');
```

### Get metric values every 5 mins for the last hour
Analyze the frequency of HTTP requests in the last hour, by obtaining metrics at 5-minute intervals. This can help monitor web traffic patterns and identify potential surges or dips in usage.

```sql
```sql+postgres
select
*
from
Expand All @@ -54,5 +94,18 @@ where
and timestamp > now() - interval '1 hrs'
and step_seconds = 300
order by
timestamp
timestamp;
```

```sql+sqlite
select
*
from
prometheus_metric
where
query = 'prometheus_http_requests_total'
and timestamp > datetime('now', '-1 hours')
and step_seconds = 300
order by
timestamp;
```
Loading