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.
- Target user
- Platform engineers scraping Prometheus exporters via Telegraf
- Difficulty
- Advanced
- Tools
- Claude, ChatGPT, Cursor
The prompt
You are a senior platform engineer who has run Telegraf as a Prometheus scraper alongside and instead of Prometheus servers, and who has been burned by cardinality and metric_version surprises. Help me configure `inputs.prometheus`.
I will provide:
- The targets: static `/metrics` URLs and/or Kubernetes pods/services to discover
- The exporters involved (node_exporter, kube-state-metrics, cAdvisor, app exporters)
- Where metrics land downstream and my cardinality budget
Deliver:
1. **metric_version** — recommend `metric_version = 1` vs `2` and explain how they differ in series naming (field-per-metric vs measurement-per-metric) and which fits my downstream (InfluxDB vs Prometheus-style).
2. **Static targets** — `urls`, `response_timeout`, TLS, and bearer/basic auth from `${ENV}`/secretstore for plain exporter scraping.
3. **Kubernetes discovery** — `monitor_kubernetes_pods`, `pod_scrape_scope` (node vs cluster), `kubernetes_namespaces`, label/annotation selectors, and the RBAC/ServiceAccount + token needed. Note node-scope to avoid every agent scraping every pod.
4. **Filtering** — `namepass`/`namedrop`, `tagpass`/`tagdrop`, and `metric_buffer` to prune expensive series (per-container cAdvisor, unbounded label sets) at ingestion.
5. **Interval & timeout** — align scrape `interval` with exporter update cadence and set `response_timeout` so a slow exporter doesn't stall collection.
6. **Migration notes** — where this plugin cleanly replaces a Prometheus scrape_config and where it does not (no PromQL, no local rule eval), so I set expectations.
Output: (a) commented `inputs.prometheus` TOML for static + k8s discovery, (b) the metric_version decision with rationale, (c) a filtering/cardinality-control block, and (d) an RBAC snippet plus a `telegraf --test` check.
Bias toward: node-scoped k8s discovery, aggressive filtering of high-cardinality exporters, and least-privilege RBAC.
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
-
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.
-
Telegraf Docker Input Metrics Collection Prompt
Configure inputs.docker to collect per-container CPU, memory, network, and blkio metrics with the right label mapping, container filtering, and socket permissions — without drowning your TSDB in ephemeral-container cardinality.
-
Telegraf Exec & Execd Custom Input Prompt
Build custom metric collectors with inputs.exec (run a script per interval) and inputs.execd (long-running streaming process) — choosing the right one, picking a data_format, and handling stdout/stderr, exit codes, and timeouts safely.
-
Telegraf HTTP JSON Input Design Prompt
Poll REST/JSON HTTP endpoints with inputs.http and parse the response with json_v2 — mapping nested fields, arrays, and objects into well-tagged metrics with correct auth, timeouts, and failure handling.
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.