All the metrics for a particular instance IP:9100
can be obtained via the following PromQL query:
{instance="IP:9100"}
This query returns all the metrics, which have the given instance="IP:9100"
label. See time series selector docs for more details. See also PromQL tutorial.
The {instance="IP:9100"}
query can be sent to the following Prometheus querying APIs:
- /api/v1/query - this endpoint returns matching time series values at the given timestamp specified via
time
query arg. For example, curl 'http://prometheus:9090/api/v1/query?query={instance="IP:9100"}'
. Make sure you properly encoded query
arg with percent encoding. See this demo.
- /api/v1/series - this endpoint returns matching time series without any data, e.g. only metric names and labels are returned. For example,
curl 'http://prometheus:9090/api/v1/series?match[]={instance="IP:9100"}'
. Make sure you properly encoded match[]
arg with percent encoding. See this demo
- /api/v1/query_range - this endpoint returns calculated datapoints for matching time series on the selected time range
[start ... end]
with the given step
interval between samples. See more details about calculated datapoints in these docs.
If you want returning just unique metric names without labels, then you can query /api/v1/label/__name__/values
endpoint: curl http://prometheus:9090/api/v1/label/__name__/values
. The __name__
is a special label name used in Prometheus for referring to metric names. Note that multiple time series may share the same metric name. For example, http_requests_total{path="/foo"}
and http_requests_total{path="/bar"}
time series share http_requests_total
metric name, while they differ by path
label values.