diff --git a/sos/report/plugins/bird.py b/sos/report/plugins/bird.py new file mode 100644 index 0000000000..60ef89c88d --- /dev/null +++ b/sos/report/plugins/bird.py @@ -0,0 +1,70 @@ +# Copyright (C) 2024 Jake Hunsaker +# Copyright (C) 2019 Alexander Petrovskiy +# +# This file is part of the sos project: https://github.com/sosreport/sos +# +# This copyrighted material is made available to anyone wishing to use, +# modify, copy, or redistribute it subject to the terms and conditions of +# version 2 of the GNU General Public License. +# +# See the LICENSE file in the source distribution for further information. + +from sos.report.plugins import Plugin, IndependentPlugin + + +class Bird(Plugin, IndependentPlugin): + """BIRD is an Internet Routing Daemon used in many *nix and nix-like + distributions. This plugin will capture the configuration files for a local + bird installation, as well as runtime information and metrics. + """ + + plugin_name = 'bird' + profiles = ('network', ) + packages = ('bird', ) + services = ('bird', ) + + def setup(self): + + try: + with open('/etc/bird.conf', 'r', encoding='utf-8') as bfile: + for line in bfile: + if line.startswith('log'): + # non-file values will be dropped by add_copy_spec() + self.add_copy_spec(line.split()[1].strip('"')) + except Exception as err: + self._log_debug(f"Unable to parse bird.conf: {err}") + + self.add_copy_spec([ + "/etc/bird/*", + "/etc/bird.conf" + ]) + + self.add_cmd_output([ + "birdc show status", + "birdc show memory", + "birdc show protocols all", + "birdc show interfaces", + "birdc show route all", + "birdc show symbols", + "birdc show bfd sessions", + "birdc show babel interfaces", + "birdc show babel neighbors", + "birdc show babel entries", + "birdc show babel routes", + "birdc show ospf", + "birdc show ospf neighbors", + "birdc show ospf interface", + "birdc show ospf topology", + "birdc show ospf state all", + "birdc show ospf lsadb", + "birdc show rip interfaces", + "birdc show rip neighbors", + "birdc show static" + ]) + + def postproc(self): + self.do_path_regex_sub('/etc/bird(.*)?.conf', + r"((.*password)\s\"(.*)\"(.*))", + r"\2 *******\4") + +# vim: set et ts=4 sw=4 : diff --git a/sos/report/plugins/networking.py b/sos/report/plugins/networking.py index 848cf7562d..2ab4f5ae43 100644 --- a/sos/report/plugins/networking.py +++ b/sos/report/plugins/networking.py @@ -118,13 +118,35 @@ def setup(self): "devlink dev param show", "devlink dev info", "devlink port show", + "devlink sb show", + "devlink sb pool show", + "devlink sb port pool show", + "devlink sb tc bind show", + "devlink -s -v trap show", ]) devlinks = self.collect_cmd_output("devlink dev") if devlinks['status'] == 0: devlinks_list = devlinks['output'].splitlines() for devlink in devlinks_list: - self.add_cmd_output(f"devlink dev eswitch show {devlink}") + self.add_cmd_output([ + f"devlink dev eswitch show {devlink}", + f"devlink sb occupancy snapshot {devlink}", + f"devlink sb occupancy show {devlink}", + f"devlink -v resource show {devlink}" + ]) + dev_tables = [] + dpipe = self.collect_cmd_output( + f"devlink dpipe table show {devlink}" + ) + if dpipe['status'] == 0: + for tableln in dpipe['output'].splitlines(): + if tableln.startswith('name'): + dev_tables.append(tableln.split()[1]) + self.add_cmd_output([ + f"devlink dpipe table show {devlink} name {dname}" + for dname in dev_tables + ]) # below commands require some kernel module(s) to be loaded # run them only if the modules are loaded, or if explicitly requested @@ -227,17 +249,17 @@ def collect_ss_ip_ethtool_info(self): _subdir = f"namespaces/{namespace}" ns_cmd_prefix = cmd_prefix + namespace + " " self.add_cmd_output([ - ns_cmd_prefix + "ip -d address show", - ns_cmd_prefix + "ip route show table all", - ns_cmd_prefix + "ip -s -s neigh show", - ns_cmd_prefix + "ip -4 rule list", - ns_cmd_prefix + "ip -6 rule list", - ns_cmd_prefix + "ip vrf show", - ns_cmd_prefix + "sysctl -a", - ns_cmd_prefix + f"netstat {self.ns_wide} -neopa", - ns_cmd_prefix + "netstat -s", - ns_cmd_prefix + f"netstat {self.ns_wide} -agn", - ns_cmd_prefix + "nstat -zas", + f"{ns_cmd_prefix} ip -d address show", + f"{ns_cmd_prefix} ip route show table all", + f"{ns_cmd_prefix} ip -s -s neigh show", + f"{ns_cmd_prefix} ip -4 rule list", + f"{ns_cmd_prefix} ip -6 rule list", + f"{ns_cmd_prefix} ip vrf show", + f"{ns_cmd_prefix} sysctl -a", + f"{ns_cmd_prefix} netstat {self.ns_wide} -neopa", + f"{ns_cmd_prefix} netstat -s", + f"{ns_cmd_prefix} netstat {self.ns_wide} -agn", + f"{ns_cmd_prefix} nstat -zas", ], priority=50, subdir=_subdir) self.add_cmd_output([ns_cmd_prefix + "iptables-save"], pred=iptables_with_nft, @@ -260,10 +282,11 @@ def collect_ss_ip_ethtool_info(self): # Devices that exist in a namespace use less ethtool # parameters. Run this per namespace. self.add_device_cmd([ - ns_cmd_prefix + "ethtool %(dev)s", - ns_cmd_prefix + "ethtool -i %(dev)s", - ns_cmd_prefix + "ethtool -k %(dev)s", - ns_cmd_prefix + "ethtool -S %(dev)s" + f"{ns_cmd_prefix} ethtool %(dev)s", + f"{ns_cmd_prefix} ethtool -i %(dev)s", + f"{ns_cmd_prefix} ethtool -k %(dev)s", + f"{ns_cmd_prefix} ethtool -S %(dev)s", + f"{ns_cmd_prefix} ethtool -m %(dev)s" ], devices=_devs['ethernet'], priority=50, subdir=_subdir) self.add_command_tags()