[os-node_exporter] Add textfile collector directory support
Nobody has claimed this yet.
- Dominant language
- PHP
- Stars
- 1.2k
- Forks
- 863
- Avg merge
- 2d 6h
- Merged PRs (30d)
- 10
Description
Important notices
Before you add a new report, we ask you kindly to acknowledge the following:
- I have read the contributing guide lines at https://github.com/opnsense/plugins/blob/master/CONTRIBUTING.md
- I have searched the existing issues, open and closed, and I'm convinced that mine is new.
- When the request is meant for an existing plugin, I've added its name to the title.
Is your feature request related to a problem? Please describe.
The os-node_exporter plugin exposes a fixed set of built-in collectors via toggle checkboxes, but provides no way to enable node_exporter's textfile collector. The textfile collector is the upstream-recommended escape hatch for custom or platform-specific metrics that don't have a built-in collector — for example, active SSH session counts, SMART drive data, or gateway health — none of which are available as native FreeBSD collectors in node_exporter. Without textfile support, users have no supported path to add custom metrics through this plugin.
Describe the solution you'd like
Add an optional "Textfile Directory" text field to the node_exporter settings page (Services → Node Exporter). When a path is provided, the plugin passes --collector.textfile.directory=<path> to the node_exporter daemon at startup. When left empty, behavior is unchanged. Users are then free to drop .prom files into that directory (via cron, configd actions, or other scripts) and have them scraped alongside the built-in collectors.
Describe alternatives you've considered
- Manually editing /etc/rc.conf.d/node_exporter to add the flag — this works but is overwritten on every config save or plugin upgrade.
- Running a separate dedicated exporter for each custom metric source — this is operationally heavier and introduces additional scrape targets.
- This was previously raised in #4275 (textfile/gateway metrics) and #3906 (SMART data); both closed due to inactivity without a resolution. A working implementation is available at https://github.com/StevenWolfe/plugins/tree/feature/node-exporter-textfile-collector if maintainers want to review before deciding.
Additional context
The textfile collector is enabled by default in the upstream node_exporter binary (including the FreeBSD port) — it just requires --collector.textfile.directory to be set. The change to the plugin is minimal: one new TextField in the model, one conditional block in the RC conf template, and one form field in the UI — the same pattern used when ZFS and IPv6 listen address support were added.
A pull request will follow
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Locate the os-node_exporter model, RC conf template, and settings form used by Services → Node Exporter. Inspect the existing ZFS and IPv6 listen address support for the matching pattern, then verify that a supplied directory passes the textfile flag and an empty field leaves behavior unchanged.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- php
- Domain
- observability
- Issue type
- Feature
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 72/100