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.
select namefrom prometheus_label;
select namefrom 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.
select ln.name as name, valuefrom prometheus_label as ln, jsonb_array_elements_text(ln.values) as valueorder by name, value;
select ln.name as name, valuefrom prometheus_label as ln, json_each(ln.values) as valueorder by name, value.value;
Schema for prometheus_label
Name | Type | Operators | Description |
---|---|---|---|
_ctx | jsonb | Steampipe context in JSON form, e.g. connection_name. | |
name | text | Name of the label. | |
query | text | Query used to filter the label search. | |
timestamp | timestamp with time zone | Timestamp when the labels were found. | |
values | jsonb | Values for the label. |
Export
This table is available as a standalone Exporter CLI. Steampipe exporters are stand-alone binaries that allow you to extract data using Steampipe plugins without a database.
You can download the tarball for your platform from the Releases page, but it is simplest to install them with the steampipe_export_installer.sh
script:
/bin/sh -c "$(curl -fsSL https://steampipe.io/install/export.sh)" -- prometheus
You can pass the configuration to the command with the --config
argument:
steampipe_export_prometheus --config '<your_config>' prometheus_label