Snippets · Sources
Scrape Prometheus metrics endpoints
Most infrastructure already exposes Prometheus metrics. The prometheus receiver embeds Prometheus scrape configuration, so existing scrape_configs move over largely as they are and the results continue as OpenTelemetry metrics.
- Signals
- Metrics
- Category
- CollectionMigration
- Source
- Prometheus /metrics endpoint
- Components
- prometheusbatchmemory_limiterotlphttp
- Destination
- OTLP/HTTP endpoint
OpenTelemetry Collector
receivers:
prometheus:
config:
scrape_configs:
- job_name: node-exporter
scrape_interval: 30s
scrape_timeout: 10s
static_configs:
- targets: ['localhost:9100']
processors:
memory_limiter:
check_interval: 1s
limit_percentage: 80
spike_limit_percentage: 25
batch:
timeout: 5s
exporters:
otlphttp:
endpoint: https://your-backend:4318
service:
pipelines:
metrics:
receivers: [prometheus]
processors: [memory_limiter, batch]
exporters: [otlphttp]
LinkMesh
Library › Sources › Prometheus Scrape
- Scrape Targets
- ["localhost:9100"]
- Scheme
- http
- Scrape Interval
- 30s
- Metrics Path
- /metrics
What LinkMesh then pushes to the collector, under receivers:
prometheus/input_src_00000501:
config:
scrape_configs:
- job_name: input_src_00000501
metrics_path: /metrics
scheme: http
scrape_interval: 30s
static_configs:
- targets:
- localhost:9100
The same, as an API call (see automation recipes):
curl -X POST "$LINKMESH/sources" \
-H "Authorization: Bearer $LMSAT" \
-H "Content-Type: application/json" \
-d '{
"defaultConfig": {
"metrics_path": "/metrics",
"scheme": "http",
"scrape_interval": "30s",
"targets": [
"localhost:9100"
]
},
"name": "Prometheus Scrape",
"receiverType": "prometheus"
}'The rest of the collector config above (memory_limiter, batch, otlphttp) is not part of this template: in LinkMesh those are separate sources, processors and destinations on the route.
Generated from LinkMesh's template catalogue by linkmesh-server snippet-render 1.464.3, not written by hand.
Download config.yamlValidated with otelcol-contrib v0.161.0 on 2026-10-26
Complete config files, each checked with the collector's own validate command (otelcol-contrib v0.161.0). Replace https://your-backend:4318 with your own OTLP endpoint before you run it.
The gotcha
Targets live in config.scrape_configs, exactly as in prometheus.yml - there is no receiver-level targets list. And a scrape_timeout longer than the scrape_interval is a hard load error: in our test scrape_timeout: 45s with scrape_interval: 30s made validate fail with "scrape timeout greater than scrape interval for scrape config with job name \"node-exporter\"".
Used in these pipelines
Manage this across a fleet
LinkMesh manages collector configuration across a fleet from one self-hosted control plane, so a change like this is made once rather than host by host. The first 25 Collectors are free after a no-card registration in the OpenSight Customer Portal (5 without one).
Doing this in LinkMesh: Sources
Related snippets
- Receive logs from Fluent Bit and Fluentd (forward)Take logs from existing Fluent Bit or Fluentd agents over the forward protocol, without replacing them first.
- Receive StatsD metricsAccept StatsD counters, gauges and timers from applications that already emit them, and send them on as OpenTelemetry metrics.
- Prometheus counters to a delta-only backend (cumulativetodelta)Scrape Prometheus counters and convert them to the delta temporality Dynatrace requires - gauges untouched.
- Scrape cAdvisor container metrics from the kubeletThe container_* metrics Kubernetes dashboards expect, scraped from each node's kubelet with the pod's service account token.