Telegraf Procstat Process Monitoring Prompt
Design inputs.procstat to track specific processes by pattern, cgroup, systemd unit, or PID file — capturing CPU, RSS, FD count, thread count, and restarts — while keeping series cardinality and lookup cost under control.
- Target user
- SRE/sysadmins monitoring critical processes with Telegraf
- Difficulty
- Intermediate
- Tools
- Claude, ChatGPT, Cursor
The prompt
You are a senior SRE who uses Telegraf's `inputs.procstat` to watch the handful of processes that actually page you, and who has been burned by pattern matches that fanned out to hundreds of PIDs. Help me build a precise config. I will provide: - The processes I care about (service name, exe path, systemd unit, or pid file) - What I want to alert on (memory growth/leak, CPU, FD exhaustion, thread explosion, unexpected restarts, process-down) - The host init system (systemd, cgroups v1/v2) and OS Deliver: 1. **Process selection** — the right selector: `systemd_unit`, `cgroup`, `pid_file`, `exe`, or `pattern` — and which `pid_finder` (`pgrep` vs `native`) to pair with it. Warn me where a selector will over-match and how to tighten it. 2. **Field set** — enable the fields that matter for my alerts (`cpu_usage`, `memory_rss`, `num_fds`, `num_threads`, `created_at`, `pid`) and skip the rest to limit noise. 3. **Aggregation vs per-PID** — decide `mode`/tagging so a multi-worker service reports as a rolled-up unit or per-PID, and explain the cardinality tradeoff for services that fork heavily. 4. **Process-down detection** — how to make "the process isn't running" observable (procstat_lookup metrics / result count) so absence becomes an alertable signal, not silence. 5. **Permissions** — what Telegraf needs to read FD/thread stats for processes owned by other users, and how to grant it safely (group, capabilities) instead of running as root. 6. **Restart & leak signals** — using `created_at` to detect restarts and `memory_rss` slope for leak alerts downstream. Output: (a) a commented `inputs.procstat` TOML block per process, (b) the selector rationale, (c) a process-down alerting note, and (d) a `telegraf --test` validation snippet. Bias toward: precise selectors (unit/cgroup/pidfile), making absence observable, and least-privilege collection.
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 SNMP Input Plugin Design Prompt
Design a scalable inputs.snmp configuration that polls network gear (switches, routers, PDUs, UPS) with the right OIDs, tables, tag mappings, and translation — without melting the agents or the devices.
-
Design a Telegraf Processor and Aggregator Pipeline
Design an ordered Telegraf processor + aggregator pipeline — tag and field transforms, renaming, dedup, rate/derivative, and windowed aggregation — so metrics arrive at the output clean, correctly typed, and at the right resolution, with the ordering and `order`/`drop_original` semantics right the first time.
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.