mktxp fork: option to export zero-byte firewall rules (catch-all drop alerting) #146

Open
opened 2026-11-17 21:46:10 +00:00 by ginjiruu · 0 comments
Owner

mktxp 2.1.0 only exports firewall rules that have matched at least once. FirewallMetricsDataSource.metric_records is called with matching_only=True (mktxp/datasource/firewall_ds.py, _get_records drops bytes == 0), and no config key changes that. A rule that never fired has no series, so these alerts are impossible:

  • "the catch-all drop ([tf:in-drop], [tf:fw-drop]) stopped counting": you can't tell a flat counter from a missing one;
  • "rule X never fires": a dead or misordered rule.

Plan

  1. Fork akpw/mktxp into Forgejo, the same way as lab/terraform-provider-routeros (a LAB.md listing the carried patches, upstream first).
  2. Add a per-router config key, e.g. firewall_matching_only = True, keeping the upstream default, and pass it through the firewall collector for filter/raw/nat/mangle and IPv6.
  3. Open the same change upstream as a PR. If it merges, drop the fork.
  4. Build the image to Harbor and point clusters/mini/monitoring/resources/mktxp-exporter at it with firewall_matching_only = False.

Cardinality: the routers carry about 25 filter rules each, so exporting all of them is cheap.

Refs lab/iac#139, lab/iac#67 (comment labels as rule identity).

mktxp 2.1.0 only exports firewall rules that have matched at least once. `FirewallMetricsDataSource.metric_records` is called with `matching_only=True` (mktxp/datasource/firewall_ds.py, `_get_records` drops `bytes == 0`), and no config key changes that. A rule that never fired has no series, so these alerts are impossible: - "the catch-all drop (`[tf:in-drop]`, `[tf:fw-drop]`) stopped counting": you can't tell a flat counter from a missing one; - "rule X never fires": a dead or misordered rule. ## Plan 1. Fork akpw/mktxp into Forgejo, the same way as `lab/terraform-provider-routeros` (a LAB.md listing the carried patches, upstream first). 2. Add a per-router config key, e.g. `firewall_matching_only = True`, keeping the upstream default, and pass it through the firewall collector for filter/raw/nat/mangle and IPv6. 3. Open the same change upstream as a PR. If it merges, drop the fork. 4. Build the image to Harbor and point `clusters/mini/monitoring/resources/mktxp-exporter` at it with `firewall_matching_only = False`. Cardinality: the routers carry about 25 filter rules each, so exporting all of them is cheap. Refs lab/iac#139, lab/iac#67 (comment labels as rule identity).
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
lab/iac#146
No description provided.