From eb6ae2a8bc2906181a8b8130d9c225f7def7bfa8 Mon Sep 17 00:00:00 2001 From: Date Huang Date: Thu, 16 Jul 2026 19:46:02 +0800 Subject: T9073: frr-exporter: add CLI support for optional collectors and collector options frr_exporter v1.5.0 enables the bgp, ospf, bfd and route collectors by default, while bgpl2vpn, pim and vrrp must be enabled explicitly. Expose bgpl2vpn (CLI: bgp-l2-vpn) and pim under "service monitoring prometheus frr-exporter collector", following the same CLI style as the node-exporter collectors node. The vrrp collector is not exposed since VyOS implements VRRP with keepalived and FRR's vrrpd is never started. Also expose the collector options available in v1.5.0: - collector bgp accept-filtered-prefixes - collector bgp advertised-prefixes - collector bgp peer-description - collector bgp peer-group - collector bgp peer-hostname - collector bgp peer-type - collector ospf-instance - collector detailed-routes The bgp.* options are shared by the bgp, bgp6 and bgpl2vpn collectors upstream. The bgp6 collector remains unconditionally enabled, hence existing configurations render the same ExecStart and no migration is required. Includes code generated by Claude Code --- .../cli/test_service_monitoring_prometheus.py | 41 ++++++++++++++++++++++ 1 file changed, 41 insertions(+) (limited to 'smoketest/scripts/cli') diff --git a/smoketest/scripts/cli/test_service_monitoring_prometheus.py b/smoketest/scripts/cli/test_service_monitoring_prometheus.py index df27162ef..f8961d199 100755 --- a/smoketest/scripts/cli/test_service_monitoring_prometheus.py +++ b/smoketest/scripts/cli/test_service_monitoring_prometheus.py @@ -75,13 +75,54 @@ class TestMonitoringPrometheus(VyOSUnitTestSHIM.TestCase): self.assertTrue(process_named_running(NODE_EXPORTER_PROCESS_NAME)) def test_02_frr_exporter(self): + optional_collectors = ['bgp-l2-vpn', 'pim'] + collector_base = base_path + ['frr-exporter', 'collector'] self.cli_set(base_path + ['frr-exporter', 'listen-address', listen_ip]) # commit changes self.cli_commit() + # optional collectors and collector options are opt-in + file_content = read_file(frr_exporter_service_file) + self.assertNotIn('--collector.bgp.peer-descriptions', file_content) + + for collector in optional_collectors: + self.cli_set(collector_base + [collector]) + + # BGP collector options + self.cli_set(collector_base + ['bgp', 'accept-filtered-prefixes']) + self.cli_set(collector_base + ['bgp', 'advertised-prefixes']) + self.cli_set(collector_base + ['bgp', 'peer-description', 'plain-text']) + self.cli_set(collector_base + ['bgp', 'peer-group']) + self.cli_set(collector_base + ['bgp', 'peer-hostname']) + self.cli_set(collector_base + ['bgp', 'peer-type']) + # OSPF collector options + self.cli_set(collector_base + ['ospf-instance', '1']) + self.cli_set(collector_base + ['ospf-instance', '2']) + # Route collector options + self.cli_set(collector_base + ['detailed-routes']) + + # commit changes + self.cli_commit() + file_content = read_file(frr_exporter_service_file) self.assertIn(f'{listen_ip}:9342', file_content) + # bgp6 collector is always enabled + self.assertIn('--collector.bgp6', file_content) + for collector in ['bgpl2vpn', 'pim']: + self.assertIn(f'--collector.{collector}', file_content) + for flag in [ + '--collector.bgp.accepted-filtered-prefixes', + '--collector.bgp.advertised-prefixes', + '--collector.bgp.peer-descriptions', + '--collector.bgp.peer-descriptions.plain-text', + '--collector.bgp.peer-groups', + '--collector.bgp.peer-hostnames', + '--collector.bgp.peer-types', + '--collector.ospf.instances=1,2', + '--collector.route.detailed-routes', + ]: + self.assertIn(flag, file_content) # Check for running process self.assertTrue(process_named_running(FRR_EXPORTER_PROCESS_NAME)) -- cgit v1.2.3