fix(export): filter dot-notation metrics from Prometheus textfile#434
Closed
fix(export): filter dot-notation metrics from Prometheus textfile#434
Conversation
The shell exporter collects ~25 metrics using Zabbix dot-notation (nftban.daemon.cpu_percent, nftban.server.load_1m). These are valid for Zabbix trapper but invalid Prometheus metric names — dots violate the [a-zA-Z_:][a-zA-Z0-9_:]* pattern. The export_prometheus() awk filter already strips |STRING| lines but did not filter dot-notation names. If Prometheus export is enabled, these would leak into nftban.prom and cause node_exporter parse errors. Currently a latent defect (NFTBAN_EXPORT_PROMETHEUS defaults to false), but this closes the gap before anyone enables it. Pipeline audit finding: P-8 Ref: V191_PIPELINE_INTEGRITY_AUDIT.md Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Contributor
Dependency Review✅ No vulnerabilities or license issues or OpenSSF Scorecard issues found.Scanned FilesNone |
…a-prometheus-filter
4 tasks
Owner
Author
|
Superseded by #437 (combined v1.91 PR) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
nftban.daemon.cpu_percent,nftban.server.load_1m)export_prometheus()awk filter stripped|STRING|lines but not dot-notation names[a-zA-Z_:][a-zA-Z0-9_:]*)NFTBAN_EXPORT_PROMETHEUS=true, these would leak intonftban.promfalse), but closes the gapPipeline audit finding: P-8 (V191_PIPELINE_INTEGRITY_AUDIT.md)
Change
One filter line added to
export_prometheus()awk innftban_unified_exporter_export.sh:Test plan
nftban_*metrics unaffected (no dots in underscore names)echo 'nftban.daemon.cpu 3.2 123' | awk '{if (index($1,".") > 0) next; print}'→ no outputecho 'nftban_pressure{dim="cpu"} 42 123' | awk '{if (index($1,".") > 0) next; print}'→ output preserved🤖 Generated with Claude Code