Configure Telegraf outputs.prometheus_client for Scrape Exposure
Stand up the outputs.prometheus_client plugin as a scrape target with correct metric_version, expiration, TLS, and string/collector handling so Prometheus reads stable, correctly-typed metrics without stale or duplicated series.
- Target user
- Observability engineers exposing Telegraf-collected metrics to a Prometheus/VictoriaMetrics scrape instead of remote-writing.
- Difficulty
- Intermediate
- Tools
- Claude, ChatGPT, Cursor
The prompt
You are a Telegraf + Prometheus integration engineer who knows how the prometheus_client output maps Telegraf's data model onto Prometheus metric types and naming. I will provide: - What Telegraf is collecting and the tag/field shape of those metrics - The scraper: Prometheus or VictoriaMetrics, scrape interval, and whether it's already scraping other v1 or v2 Telegraf endpoints - Network/security context: where the endpoint lives, who can reach it, and TLS requirements Your job: 1. **Choose metric_version deliberately** — recommend v2 for new setups (Prometheus-native names/labels) and explain exactly how v1 vs v2 rename series; if migrating an existing v1 endpoint, lay out the dashboard/rule migration and any transition window. 2. **Write the output block** — a complete `[[outputs.prometheus_client]]` with `listen`, `path`, `metric_version`, `expiration_interval`, and `collectors_exclude` where the Go/process collectors aren't wanted. 3. **Set expiration correctly** — tie `expiration_interval` to the scrape interval so a source that stops reporting ages out promptly but survives normal scrape gaps; explain the stale-series risk of getting this wrong. 4. **Handle types and strings** — explain how fields become gauges/counters, how string fields are dropped/handled, and where a `converter`/`enum` processor upstream is needed to get the right Prometheus type. 5. **Secure the endpoint** — bind to an internal address or add `tls_cert`/`tls_key` and `basic_username`/`basic_password`, and provide the matching Prometheus `scrape_config` (scheme, tls, basic_auth) so both sides agree. 6. **Verify** — the `curl` against the metrics path to confirm exposition format, and what a correct v2 sample looks like. Output as: (a) metric_version decision and migration impact, (b) the full output config, (c) expiration reasoning, (d) type/string handling notes, (e) the secured endpoint config plus the matching Prometheus scrape_config and a curl check. Be explicit that changing metric_version renames series, and never expose the endpoint without addressing who can reach it.
Run this prompt with AI
Test it, get an AI-improved version, or compare models — live in the Prompt Workspace. No copy-paste.
Related prompts
-
Design a Telegraf outputs.influxdb_v2 Output for Reliable Writes
Configure the outputs.influxdb_v2 plugin with correct org/bucket/token handling, batching, retries, timeouts, and content-coding so writes stay durable and efficient against InfluxDB 2.x / Cloud without dropping metrics under backpressure.
-
Design a Telegraf outputs.kafka Pipeline with Topic Routing
Configure the outputs.kafka plugin with dynamic topic routing, partition keys, serialization, compression, acks, and TLS/SASL so Telegraf publishes metrics to Kafka reliably and with sane partition distribution.
-
Telegraf Prometheus Scrape Input Prompt
Use inputs.prometheus to scrape /metrics endpoints and Kubernetes pods — target discovery, relabeling, metric_version selection, and namespace/label filtering — so Telegraf replaces or complements a Prometheus server without cardinality blowups.
-
Choose and Design the Right Telegraf Input Plugin for a Source
Pick the best Telegraf input plugin for a given data source (an app, host, API, log, queue, or device) and produce a production-ready inputs configuration with the right tags, fields, interval, and parser — instead of guessing between exec, http, prometheus, and a native plugin.
More Telegraf prompts & error guides
Browse every Telegraf prompt and troubleshooting guide in one place.
Reading prompts? Get all 500 in one free PDF
500 battle-tested, copy-paste AI prompts engineered by a senior systems engineer — every one with fill-in placeholders and safety/back-out notes. Drop your email and it's yours.
- 500 prompts: Linux · Kubernetes · Terraform · OpenStack · GitLab · Docker · Monitoring · Incident Response
- Instant PDF download — yours free, forever
- Plus one practical AI-workflow email a week (no spam)
Single opt-in · unsubscribe anytime · no spam.