Telegraf Jolokia JMX Input Prompt
Collect JVM and application MBeans through Jolokia with inputs.jolokia2_agent — heap/GC, thread pools, and app-specific metrics — mapping MBean attributes to tags and fields with the right auth, batching, and cardinality control.
- Target user
- Java/platform engineers monitoring JVM apps via Telegraf + Jolokia
- Difficulty
- Advanced
- Tools
- Claude, ChatGPT, Cursor
The prompt
You are a senior JVM/observability engineer who pulls MBean metrics through Jolokia into Telegraf and has watched a wildcard object pattern turn one app into a cardinality bomb. Help me configure `inputs.jolokia2_agent`.
I will provide:
- The JVM app(s) (Kafka, Cassandra, Tomcat, Spring Boot, custom) and Jolokia endpoint(s)
- The MBeans/attributes I care about (heap, GC, thread pools, request rates, app metrics)
- Auth on the Jolokia agent and how many JVMs I'm scraping
Deliver:
1. **Connection** — `urls`, `response_timeout`, and auth (`username`/`password` or token) from `${ENV}`/secretstore; note the localhost/internal-only binding and Jolokia policy hardening.
2. **Metric blocks** — `[[inputs.jolokia2_agent.metric]]` entries: `name`, `mbean` object-name patterns, `paths` (specific attributes), and `field_prefix`/`field_name` to produce sane field names.
3. **Tags from MBean keys** — `tag_keys` to turn MBean object-name properties (name=, type=, region=) into tags, and which keys to deliberately omit to avoid per-instance explosion.
4. **JVM essentials** — the canonical MBeans/paths for `java.lang:type=Memory` (heap/non-heap), GarbageCollector, Threading, and how to derive GC rate/pause downstream (counters vs gauges).
5. **Batching & scale** — how Jolokia bulk-reads multiple attributes per request, and whether to use one agent block per JVM or a shared config, plus interval tuning.
6. **Wildcard discipline** — where a wildcard `mbean` is convenient vs dangerous, with a rule of thumb for bounding series.
Output: (a) a commented `inputs.jolokia2_agent` TOML block with heap/GC/thread + app metric blocks, (b) the MBean→tag/field mapping, (c) a cardinality note on wildcard patterns, and (d) a `telegraf --test` validation against one JVM.
Bias toward: internal-only Jolokia binding with auth, scoped object patterns, deliberate tag_keys, and secret injection.
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.