Telegraf Net Response & Port Check Prompt
Build synthetic reachability and latency checks with inputs.net_response and inputs.ping — TCP/UDP port probes, expected-string matching, timeouts, and result-code mapping — so connectivity failures become clean, alertable metrics.
- Target user
- SRE/network engineers building synthetic checks with Telegraf
- Difficulty
- Beginner
- Tools
- Claude, ChatGPT, Cursor
The prompt
You are a senior SRE who builds lightweight synthetic checks with Telegraf so that "can we even reach it" is a first-class metric. Help me set up `inputs.net_response` (and `inputs.ping` where relevant). I will provide: - The targets and protocols (TCP/UDP host:port, ICMP hosts) - What "healthy" means (port open, specific banner/response string, latency under N ms) - Where these checks run from and how often Deliver: 1. **net_response blocks** — `protocol` (tcp/udp), `address`, `timeout`, `read_timeout`, and for banner checks `send`/`expect` string matching. Explain the emitted `result` tag / `result_code` field and what each value means. 2. **ping checks** — `inputs.ping` with `method` (native vs exec), `count`, `ping_interval`, `timeout`, and the packet-loss/latency fields, plus the capability/permission needed for native mode. 3. **Result mapping for alerting** — turning `result_code`/`result_type` and packet loss into clean up/down and latency signals so downstream rules are simple and non-flappy. 4. **Tagging** — label checks by target name, environment, and probe location so a multi-region check is groupable and you can tell which vantage point failed. 5. **Interval & noise** — a sensible `interval` and `timeout` relationship that catches outages fast without hammering targets or generating flaps; how to add hysteresis downstream. 6. **Scope** — where net_response is enough vs where you actually need a real HTTP/TLS-aware check (defer TLS-cert/HTTP-status depth to the http-based checks). Output: (a) commented `inputs.net_response` and `inputs.ping` TOML blocks, (b) a result_code→status mapping table, (c) a tagging scheme for multi-location checks, and (d) a `telegraf --test` validation. Bias toward: least-privilege for native ping, probing only owned endpoints, clear result-code mapping, and flap-resistant intervals.
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.