Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

T5702: SNMP add interface-mib max-interfaces-number and prefix #2434

Merged
merged 1 commit into from
Nov 7, 2023

Conversation

sever-sever
Copy link
Member

@sever-sever sever-sever commented Nov 4, 2023

Change Summary

  • 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 '25'
  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.

Without those options we have high CPU utilization with many dynamic interfaces (ipoe/l2tp/pppoe/etc)
snmp

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Code style update (formatting, renaming)
  • Refactoring (no functional changes)
  • Migration from an old Vyatta component to vyos-1x, please link to related PR inside obsoleted component
  • Other (please describe):

Related Task(s)

Related PR(s)

Component(s) name

snmp

Proposed changes

How to test

VyOS configuration:

set service snmp community public client '127.0.0.1'
set service snmp mib interface-max '25'
set service snmp mib interface 'eth'
set service snmp mib interface 'bond'

snmpd config:

# Interface MIB limits
ifmib_max_num_ifaces 25
include_ifmib_iface_prefix eth bond

Smoketest result

vyos@r4:~$ /usr/libexec/vyos/tests/smoke/cli/test_service_snmp.py
test_snmp_basic (__main__.TestSNMPService.test_snmp_basic) ... ok
test_snmpv3_md5 (__main__.TestSNMPService.test_snmpv3_md5) ... ok
test_snmpv3_sha (__main__.TestSNMPService.test_snmpv3_sha) ... ok

----------------------------------------------------------------------
Ran 3 tests in 22.142s

OK

Checklist:

  • I have read the CONTRIBUTING document
  • I have linked this PR to one or more Phabricator Task(s)
  • I have run the components SMOKETESTS if applicable
  • My commit headlines contain a valid Task id
  • My change requires a change to the documentation
  • I have updated the documentation accordingly

@vyosbot vyosbot requested review from a team, dmbaturin, sarthurdev, zdc, jestabro and c-po and removed request for a team November 4, 2023 11:15
@c-po
Copy link
Member

c-po commented Nov 4, 2023

Why not make the CLI more generic by using:

set service snmp mib interface-max '25'
set service snmp mib interface 'eth'
set service snmp mib interface 'bond'

?

@sever-sever
Copy link
Member Author

sever-sever commented Nov 4, 2023

Why not make the CLI more generic by using:

set service snmp mib interface interfaces-max '25'
set service snmp mib interface 'eth'
set service snmp mib interface 'bond'

?

How to separate “interface interfaces-max” and “interface eth”?
Will interface be a “tagNode”?

@c-po
Copy link
Member

c-po commented Nov 4, 2023

Why not make the CLI more generic by using:

set service snmp mib interface interfaces-max '25'
set service snmp mib interface 'eth'
set service snmp mib interface 'bond'

?

How to separate “interface interfaces-max” and “interface eth”? Will interface be a “tagNode”?

Sorry, typo - I have adjusted m initial comment

@sever-sever
Copy link
Member Author

Why not make the CLI more generic by using:

set service snmp mib interface interfaces-max '25'
set service snmp mib interface 'eth'
set service snmp mib interface 'bond'

?

How to separate “interface interfaces-max” and “interface eth”? Will interface be a “tagNode”?

Sorry, typo - I have adjusted m initial comment

Done!

set service snmp community public client '127.0.0.1'
set service snmp mib interface 'eth'
set service snmp mib interface 'bond'
set service snmp mib interface-max '25'

<properties>
<help>Sets the interface name prefix to include in the IF-MIB data collection</help>
<valueHelp>
<format>txt</format>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we probably include proper <valueHelp> nodes for the interface types?

Like eth,br,bond.wireguard,vxlan and so on? So the users know only the text part is required and nothing like an asterisk as glob pattern?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@c-po Done!

- 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.
@c-po c-po merged commit c3ddea5 into vyos:current Nov 7, 2023
7 checks passed
@sever-sever
Copy link
Member Author

@Mergifyio backport sagitta

Copy link
Contributor

mergify bot commented Nov 7, 2023

backport sagitta

✅ Backports have been created

c-po added a commit that referenced this pull request Nov 7, 2023
T5702: SNMP add interface-mib max-interfaces-number and prefix (backport #2434)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Development

Successfully merging this pull request may close these issues.

2 participants