AGENTS.md
src/go/plugin/ibm.d/AGENTS.mdAGENTS.md
Quality
99/100
Scores the file, not the repository.Length
886 words
20 headings · 7 code blocksRepository
80k
— · pushed 0 days agoLast changed
3 days ago
First indexed 3 days ago.1# IBM.d Plugin Developer Guide23CRITICAL: Never write raw sensitive data to durable artifacts. This includes passwords, API keys, bearer tokens, SNMP communities, private keys, connection strings with embedded credentials, session cookies, community member names, customer names, customer identifiers, personal data, non-private IP addresses that can identify customers, private endpoints, account IDs, and proprietary incident details.45This guide is for developers contributing to the IBM.d plugin. For end-user documentation, see [README.md](./README.md).67## Architecture Overview89`ibm.d.plugin` is Netdata's CGO-enabled plugin for IBM workloads. It ships with collectors for DB2, IBM i (AS/400), IBM MQ, and WebSphere, all implemented with the **IBM.D framework** – a type-safe layer built on top of go.d designed to be AI-assistant friendly.1011### Why a Dedicated Plugin?1213- **Native libraries** – DB2 connectivity and several IBM APIs require IBM's C client libraries, so the plugin is compiled with `CGO_ENABLED=1`.14- **Predictable code generation** – collectors describe their metrics in declarative YAML; code-gen keeps the runtime, schema, metadata, and docs in sync.15- **Modular architecture** – reusable protocols (OpenMetrics, PMI XML, JMX bridge, MQ interfaces) make it easy to add new IBM collectors without duplicating plumbing.1617## Repository Layout1819| Path | Purpose |20|------|---------|21| `framework/` | IBM.D collector SDK: base collector, context helpers, generator tooling. See [`framework/README.md`](framework/README.md). |22| `modules/` | All IBM collectors (AS400, DB2, MQ, WebSphere). Each module is self-contained and backed by the framework. |23| `protocols/` | Reusable protocol clients (e.g. PMI XML parser, OpenMetrics client, JMX helper bridge, MQ PCF client). |24| `pkg/` | Shared CGO shims (DB2 ODBC bridge, ODBC helpers) used by multiple protocols/modules. |25| `docgen/` | Tooling to generate docs/config metadata straight from module sources. |26| `metricgen/` | Experimental helper for generating boilerplate metric exports. |2728## Auto-Generated Files2930The IBM.D plugin uses code generation to keep contexts, documentation, and metadata in sync. Understanding which files are generated vs. editable is crucial for development.3132### Generated Files (DO NOT EDIT)3334Each module generates these files automatically:3536| File | Generator | Source | Purpose |37|------|-----------|--------|---------|38| `zz_generated_contexts.go` | `metricgen` | `contexts.yaml` | Type-safe Go structs for metric contexts |39| `README.md` | `docgen` | `contexts.yaml` + `config.go` + `module.yaml` | Module documentation |40| `metadata.yaml` | `docgen` | `contexts.yaml` + `config.go` + `module.yaml` | Netdata integrations metadata |4142**⚠️ Warning:** Direct edits to these files will be overwritten on the next `go generate` run.4344### Source Files (EDITABLE)4546| File | Purpose |47|------|---------|48| `contexts/contexts.yaml` | **Source of truth** for all metrics, charts, dimensions, families, priorities |49| `config.go` | Collector configuration structure (exported to JSON schema by docgen) |50| `module.yaml` | Module metadata (name, description, categories) |51| All other `.go` files | Module implementation code |5253### Regenerating Code5455#### Regenerate a Single Module5657From the module directory:58```bash59cd modules/as40060go generate ./...61```6263This runs both generators:641. **metricgen** (via `contexts/doc.go`) → regenerates `zz_generated_contexts.go`652. **docgen** (via `generate.go`) → regenerates `README.md` and `metadata.yaml`6667#### Regenerate All Modules6869From the plugin root:70```bash71cd src/go/plugin/ibm.d72go generate ./modules/...73```7475#### After Regeneration7677Always run `gofmt` on generated Go code:78```bash79gofmt -w modules/*/contexts/zz_generated_contexts.go80```8182### When to Regenerate8384Regenerate after modifying:85- ✅ `contexts/contexts.yaml` (metrics definitions)86- ✅ `config.go` (configuration structure)87- ✅ `module.yaml` (module metadata)88- ❌ Implementation `.go` files (no regeneration needed)8990### Verifying Generated Code9192After regeneration, verify the module works:93```bash94sudo script -c '/usr/libexec/netdata/plugins.d/ibm.d.plugin -d -m MODULE --dump=3s --dump-summary 2>&1' /dev/null95```9697## Building the Plugin9899The plugin is built automatically by Netdata's CMake tree when `ENABLE_PLUGIN_IBM=On` and the IBM CLI driver is available:100101```bash102mkdir build-ibm && cd build-ibm103cmake -DENABLE_PLUGIN_IBM=On ..104make ibm-plugin105```106107The build target downloads the driver if it is not already present; see the packaging scripts for distro-specific logic. The resulting binary is placed under `build-ibm/ibm.d.plugin` and must remain in `usr/libexec/netdata/plugins.d/` for Netdata to load it.108109## Module Development Workflow1101111. Update `contexts/contexts.yaml` and `config.go` (see [Source Files](#source-files-editable)).1122. Run `go generate ./...` in the module directory (see [Regenerating Code](#regenerating-code)).1133. Run `gofmt -w contexts/zz_generated_contexts.go` to format generated code.1144. Validate with `script -c 'sudo /usr/libexec/netdata/plugins.d/ibm.d.plugin -d -m MODULE --dump=3s --dump-summary 2>&1' /dev/null`.1155. Commit **both** source files and generated files together.116117## Testing & Debugging118119### Command-line dump mode120Works exactly like go.d:121```bash122script -c 'sudo /usr/libexec/netdata/plugins.d/ibm.d.plugin -d -m MODULE --dump=2s --dump-summary 2>&1' /dev/null123```124125### Structured fixture dumps126Generate JSON/SQL artifacts for automated tests:127```bash128ibm.d.plugin --module MODULE --dump-data ./testdata/MODULE129```130The flag implicitly enables dump mode and exits once every job has produced at least one collection.131132## Contributing Guidelines1331341. Review [`framework/README.md`](framework/README.md) for IBM.D framework details.1352. Follow the Go-area rules in [`../../AGENTS.md`](../../AGENTS.md).1363. **Never edit auto-generated files** – see [Auto-Generated Files](#auto-generated-files) section.1374. Always regenerate code after modifying `contexts.yaml`, `config.go`, or `module.yaml`.1385. Run `gofmt` on generated Go files before committing.1396. Commit **both** source and generated files together to keep them in sync.1407. Each module directory (`modules/<name>/`) contains its own README with module-specific notes.141142## Runtime Internals143144- The plugin reads `/etc/netdata/ibm.d.conf` for global settings and discovers per-collector jobs under `/etc/netdata/ibm.d/*.conf`.145- Each module provides safe stock health alarms in `src/health/health.d/`.146- The plugin supports dynamic configuration through the Netdata Agent.147148For questions or suggestions, open a GitHub issue or reach out on Netdata's community channels.149
Also in netdata/netdata
Diff this repo’s formatsOne repository carrying more than one format is the comparison this product exists for: does anyone actually write different content in each file, or is one a copy of the other?
| Repository | Format | Stack | Covers | Score | Changed |
|---|---|---|---|---|---|
| netdata/netdatasrc/go/AGENTS.md · 80k | AGENTS.md | setuptestlint-formatstyle+5 | 79/100 | 3 days ago | |
| netdata/netdataAGENTS.md · 80k | AGENTS.md | testlint-formatstylearch+6 | 64/100 | 3 days ago |
Similar configs
Same format, overlapping stack, ranked by quality.
| Repository | Format | Stack | Covers | Score | Changed |
|---|---|---|---|---|---|
| wpscanteam/wpscanAGENTS.md · 9.7k | AGENTS.md | setupbuildteststyle+6 | 100/100 | 2 days ago | |
| aaif-goose/gooseAGENTS.md · 52k | AGENTS.md | setupbuildtestlint-format+6 | 100/100 | 3 days ago | |
| bagisto/bagistoAGENTS.md · 28k | AGENTS.md | setupbuildteststyle+7 | 100/100 | 3 days ago | |
| unoplat/unoplat-code-confluenceunoplat-code-confluence-frontend/AGENTS.md · 95 | AGENTS.md | setupbuildtestlint-format+6 | 100/100 | 2 days ago | |
| ethereum/go-ethereumAGENTS.md · 51k | AGENTS.md | buildtestlint-formatgit+1 | 100/100 | 3 days ago | |
| unoplat/unoplat-code-confluenceunoplat-code-confluence-query-engine/AGENTS.md · 95 | AGENTS.md | setupbuildtestlint-format+5 | 98/100 | 2 days ago | |
| Intervention/imageAGENTS.md · 14k | AGENTS.md | setupbuildtestlint-format+6 | 97/100 | 3 days ago | |
| JCodesMore/ai-website-cloner-templateAGENTS.md · 31k | AGENTS.md | buildlint-formatstylearch+1 | 97/100 | 2 days ago |
