optional ipv6 firewall, disabled by default

This commit is contained in:
Arseniy Kuznetsov
2022-11-14 20:50:26 +01:00
parent 2953cf418a
commit 9a30555e39
2 changed files with 27 additions and 29 deletions

View File

@@ -23,3 +23,4 @@
bandwidth_test_interval = 420 # Interval for colllecting bandwidth metrics
verbose_mode = False # Set it on for troubleshooting

View File

@@ -22,13 +22,11 @@ class FirewallCollector(BaseCollector):
'''
@staticmethod
def collect(router_entry):
if not router_entry.config_entry.firewall:
return
# Initialize all pool counts, including those currently not used
# These are the same for both IPv4 and IPv6
firewall_labels = ['chain', 'action', 'bytes', 'comment', 'log']
if router_entry.config_entry.firewall:
# ~*~*~*~*~*~ IPv4 ~*~*~*~*~*~
firewall_filter_records = FirewallMetricsDataSource.metric_records_ipv4(router_entry, metric_labels = firewall_labels)
if firewall_filter_records:
@@ -43,8 +41,7 @@ class FirewallCollector(BaseCollector):
yield firewall_raw_metrics
# ~*~*~*~*~*~ IPv6 ~*~*~*~*~*~
if not router_entry.config_entry.ipv6_firewall:
return
if router_entry.config_entry.ipv6_firewall:
firewall_filter_records_ipv6 = FirewallMetricsDataSource.metric_records_ipv6(router_entry, metric_labels = firewall_labels)
if firewall_filter_records_ipv6:
metrics_records_ipv6 = [FirewallCollector.metric_record(router_entry, record) for record in firewall_filter_records_ipv6]