From 30a05ee1d447c6f92627162a506225f833a80f8c Mon Sep 17 00:00:00 2001 From: Viacheslav Hletenko Date: Sat, 4 Nov 2023 10:56:55 +0000 Subject: T5702: SNMP add interface-mib max-interfaces-number and prefix - Allow to configure only required interface prefixes set service snmp mib interface 'eth' set service snmp mib interface 'bond' include_ifmib_iface_prefix eth bond Sets the interface name prefixes to include in the IF-MIB data collection. For servers with a large number of interfaces (ppp, dummy, bridge, etc) the IF-MIB processing will take a large chunk of CPU for ioctl calls. A set of space separated interface name prefixes will reduce the CPU load for IF-MIB processing. For example, configuring "include_ifmib_iface_prefix eth dummy lo" will include only interfaces with these prefixes and ignore all others for IF-MIB processing. - Allow to configure maximum interface number set service snmp mib interface-max '100' ifmib_max_num_ifaces NUM Sets the maximum number of interfaces included in IF-MIB data collection. For servers with a large number of interfaces (ppp, dummy, bridge, etc) the IF-MIB processing will take a large chunk of CPU for ioctl calls (on Linux). Setting a reasonable maximum for the CPU used will reduce the CPU load for IF-MIB processing. For example, configuring "ifmib_max_num_ifaces 500" will include only the first 500 interfaces based on ifindex and ignore all others for IF-MIB processing. --- data/templates/snmp/etc.snmpd.conf.j2 | 10 ++++ interface-definitions/snmp.xml.in | 95 +++++++++++++++++++++++++++++++++++ 2 files changed, 105 insertions(+) diff --git a/data/templates/snmp/etc.snmpd.conf.j2 b/data/templates/snmp/etc.snmpd.conf.j2 index 9d78d479a..3db8c4d7b 100644 --- a/data/templates/snmp/etc.snmpd.conf.j2 +++ b/data/templates/snmp/etc.snmpd.conf.j2 @@ -56,6 +56,16 @@ SysDescr {{ description }} {% endif %} agentaddress unix:/run/snmpd.socket{{ ',' ~ options | join(',') if options is vyos_defined }} +{% if mib is vyos_defined %} +# Interface MIB limits +{% if mib.interface_max is vyos_defined %} +ifmib_max_num_ifaces {{ mib.interface_max }} +{% endif %} +{% if mib.interface is vyos_defined %} +include_ifmib_iface_prefix {{ mib.interface | join(' ') }} +{% endif %} +{% endif %} + # SNMP communities {% if community is vyos_defined %} {% for comm, comm_config in community.items() %} diff --git a/interface-definitions/snmp.xml.in b/interface-definitions/snmp.xml.in index 0851b8389..ec2151b98 100644 --- a/interface-definitions/snmp.xml.in +++ b/interface-definitions/snmp.xml.in @@ -79,6 +79,101 @@ #include + + + Management information base (MIB) + + + + + Sets the maximum number of interfaces included in IF-MIB data collection + + u32:1-4294967295 + Sets the maximum number of interfaces included in IF-MIB data collection + + + + + + + + + Sets the interface name prefix to include in the IF-MIB data collection + + br bond dum eth gnv macsec peth sstpc tun veth vti vtun vxlan wg wlan wwan + + + br + Allow prefix for IF-MIB data collection + + + bond + Allow prefix for IF-MIB data collection + + + dum + Allow prefix for IF-MIB data collection + + + eth + Allow prefix for IF-MIB data collection + + + gnv + Allow prefix for IF-MIB data collection + + + macsec + Allow prefix for IF-MIB data collection + + + peth + Allow prefix for IF-MIB data collection + + + sstpc + Allow prefix for IF-MIB data collection + + + tun + Allow prefix for IF-MIB data collection + + + veth + Allow prefix for IF-MIB data collection + + + vti + Allow prefix for IF-MIB data collection + + + vtun + Allow prefix for IF-MIB data collection + + + vxlan + Allow prefix for IF-MIB data collection + + + wg + Allow prefix for IF-MIB data collection + + + wlan + Allow prefix for IF-MIB data collection + + + wwan + Allow prefix for IF-MIB data collection + + + (br|bond|dum|eth|gnv|macsec|peth|sstpc|tun|veth|vti|vtun|vxlan|wg|wlan|wwan) + + + + + + IP address to listen for incoming SNMP requests -- cgit v1.2.3