72 lines
2.4 KiB
Markdown
72 lines
2.4 KiB
Markdown
# Prometheus scrape target metric names
|
||
|
||
Here are ready‑to‑run **cURL** commands you can use to query each Prometheus scrape target and list the metric names they expose.
|
||
The Prometheus HTTP API endpoint `http://localhost:9090/api/v1/label/__name__/values` returns all metric names currently known for the target’s job/instance.
|
||
|
||
---
|
||
|
||
## 1. Chat (`http://chat:3000/metrics`)
|
||
|
||
```bash
|
||
curl -s 'http://localhost:9090/api/v1/label/__name__/values?match[]={job="chat",instance="chat:3000"}' | jq .
|
||
```
|
||
|
||
## 2. NGINX exporter (`http://nginx-exporter:9113/metrics`)
|
||
|
||
```bash
|
||
curl -s 'http://localhost:9090/api/v1/label/__name__/values?match[]={job="nginx",instance="nginx-exporter:9113"}' | jq .
|
||
```
|
||
|
||
## 3. Node exporter (`http://node-exporter:9100/metrics`)
|
||
|
||
```bash
|
||
curl -s 'http://localhost:9090/api/v1/label/__name__/values?match[]={job="node",instance="node-exporter:9100"}' | jq .
|
||
```
|
||
|
||
## 4. Playout (`http://playout:8081/metrics`)
|
||
|
||
```bash
|
||
curl -s 'http://localhost:9090/api/v1/label/__name__/values?match[]={job="playout",instance="playout:8081"}' | jq .
|
||
```
|
||
|
||
## 5. Postgres exporter (`http://postgres-exporter:9187/metrics`)
|
||
|
||
```bash
|
||
curl -s 'http://localhost:9090/api/v1/label/__name__/values?match[]={job="postgres",instance="postgres-exporter:9187"}' | jq .
|
||
```
|
||
|
||
## 6. Prometheus itself (`http://prometheus:9090/metrics`)
|
||
|
||
```bash
|
||
curl -s 'http://localhost:9090/api/v1/label/__name__/values?match[]={job="prometheus",instance="prometheus:9090"}' | jq .
|
||
```
|
||
|
||
## 7. Redis exporter (`http://redis-exporter:9121/metrics`)
|
||
|
||
```bash
|
||
curl -s 'http://localhost:9090/api/v1/label/__name__/values?match[]={job="redis",instance="redis-exporter:9121"}' | jq .
|
||
```
|
||
|
||
---
|
||
|
||
### How it works
|
||
|
||
- `http://localhost:9090` – address of your Prometheus server.
|
||
- `/api/v1/label/__name__/values` – API call that lists _all_ metric names (`__name__` label) known to Prometheus.
|
||
- `match[]` – a selector that restricts the result to the specific `job` and `instance` you care about.
|
||
- `-s` – silent mode (no progress meter).
|
||
- `| jq .` – pretty‑prints the JSON response (optional but handy).
|
||
|
||
Running any of these commands will output a JSON array like:
|
||
|
||
```json
|
||
[
|
||
"up",
|
||
"process_cpu_seconds_total",
|
||
"http_requests_total",
|
||
...
|
||
]
|
||
```
|
||
|
||
which is the full set of metrics currently being scraped from that target. Adjust the Prometheus host/port if it differs from `http://localhost:9090`.
|