Skip to content

fix(export): filter dot-notation metrics from Prometheus textfile#434

Closed
itcmsgr wants to merge 2 commits intomainfrom
fix/p91a-prometheus-filter
Closed

fix(export): filter dot-notation metrics from Prometheus textfile#434
itcmsgr wants to merge 2 commits intomainfrom
fix/p91a-prometheus-filter

Conversation

@itcmsgr
Copy link
Copy Markdown
Owner

@itcmsgr itcmsgr commented Apr 16, 2026

Summary

  • Shell exporter collects ~25 Zabbix dot-notation metrics (nftban.daemon.cpu_percent, nftban.server.load_1m)
  • export_prometheus() awk filter stripped |STRING| lines but not dot-notation names
  • Dots are invalid Prometheus metric names ([a-zA-Z_:][a-zA-Z0-9_:]*)
  • If NFTBAN_EXPORT_PROMETHEUS=true, these would leak into nftban.prom
  • Currently latent (Prometheus export defaults to false), but closes the gap

Pipeline audit finding: P-8 (V191_PIPELINE_INTEGRITY_AUDIT.md)

Change

One filter line added to export_prometheus() awk in nftban_unified_exporter_export.sh:

if (index($1, ".") > 0) next

Test plan

  • ShellCheck passes
  • Valid nftban_* metrics unaffected (no dots in underscore names)
  • Dot-notation lines filtered: echo 'nftban.daemon.cpu 3.2 123' | awk '{if (index($1,".") > 0) next; print}' → no output
  • Labeled metrics preserved: echo 'nftban_pressure{dim="cpu"} 42 123' | awk '{if (index($1,".") > 0) next; print}' → output preserved

🤖 Generated with Claude Code

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>
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Apr 16, 2026

Dependency Review

✅ No vulnerabilities or license issues or OpenSSF Scorecard issues found.

Scanned Files

None

@itcmsgr
Copy link
Copy Markdown
Owner Author

itcmsgr commented Apr 16, 2026

Superseded by #437 (combined v1.91 PR)

@itcmsgr itcmsgr closed this Apr 16, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant