Page MenuHomeVyOS Platform

Snmp: Allow enable MIDs/OIDs ipCidrRouteTable
Closed, ResolvedPublicFEATURE REQUEST

Description

Hi team

the leads need we add a feature to enable -ipCidrRouteTable,inetCidrRouteTable , I know that the default behavior is disabled , but it'll be useful for the customer that we enable it through CLI, we use this bash script to enable it on vyos :

example:

#!/bin/bash


check_snmpd() {
  if sudo systemctl status snmpd > /dev/null; then
    if grep -q 'ipCidrRouteTable,inetCidrRouteTable' /etc/systemd/system/snmpd.service.d/override.conf; then
      return 0
    fitSec=10         sudo cat /etc/systemd/system/snmpd.service.d/override.conf
  fi
  return 1
}

if check_snmpd; then
    echo "Enabling CIDR tables in SNMP"
    sudo sed -i 's/-I -ipCidrRouteTable,inetCidrRouteTable //' /etc/systemd/system/snmpd.service.d/override.conf
    echo "Reloading systemd units configurations"
    sudo systemctl daemon-reload
    echo "Restarting SNMP daemon"
    sudo systemctl restart snmpd
fi

vyos-cli can be something like this :

set service snmp enable mib ipCidrRouteTable

Details

Difficulty level
Unknown (require assessment)
Version
-
Why the issue appeared?
Will be filled on close
Is it a breaking change?
Perfectly compatible

Event Timeline

It was a lot of problems with high CPU utilization with these mibs T1705.
https://forum.vyos.io/t/high-cpu-usage-by-bgpd-when-snmp-is-active

But if we can start SNMP with some limits by resources it needs more tests.

They should be disabled by default, but there must be the ability to re-enable OIDs back from CLI.

Viacheslav changed the task status from Open to Needs testing.Aug 10 2021, 12:14 PM

@fernando Can you check this feature in the next rolling release?

set service snmp community public client 127.0.0.1
set service snmp oid-enable route-table

Sure ! i'll test this feature and let you know !

Hi @Viacheslav

i've been testing this new feature in our last release and it works well :

vyos@ospf-rt6:~$ show version

Version:          VyOS 1.4-rolling-202108101124
Release Train:    sagitta

Built by:         [email protected]
Built on:         Tue 10 Aug 2021 18:06 UTC
Build UUID:       5373ce0e-e4be-4bdb-864e-afeabed888ff
Build Commit ID:  dc5e42b9daa97a

Architecture:     x86_64
Boot via:         installed image
System type:      KVM guest

Hardware vendor:  QEMU
Hardware model:   Standard PC (i440FX + PIIX, 1996)
Hardware S/N:
Hardware UUID:    0b586f53-2c0b-47f7-98c8-71eefddbb265

before applying set service snmp oid-enable route-table:

vyos@ospf-rt6:~$ sudo ps aux | grep snmpd
Debian-+    2393  0.8  3.0  35880 15068 ?        Ss   20:44   0:02 /usr/sbin/snmpd -LS0-5d -Lf /dev/null -u Debian-snmp -g Debian-snmp -I -ipCidrRouteTable inetCidrRouteTable -f -p /run/snmpd.pid
vyos        2794  0.0  0.1   6312   728 ttyS0    R+   20:49   0:00 grep snmpd

vyos@ospf-rt6:~$ cat /etc/systemd/system/snmpd.service.d/override.conf
[Unit]
StartLimitIntervalSec=0
After=vyos-router.service

[Service]
Environment=
Environment="MIBDIRS=/usr/share/snmp/mibs:/usr/share/snmp/mibs/iana:/usr/share/snmp/mibs/ietf:/usr/share/vyos/mibs"
ExecStart=
ExecStart=/usr/sbin/snmpd -LS0-5d -Lf /dev/null -u Debian-snmp -g Debian-snmp -I -ipCidrRouteTable,inetCidrRouteTable -f -p /run/snmpd.pid
Restart=always
RestartSec=10

after applying this new command :

vyos@ospf-rt6# set service snmp oid-enable route-table
[edit]
vyos@ospf-rt6# compare
[edit service snmp]
+oid-enable route-table
[edit]
vyos@ospf-rt6# commit
[edit]
vyos@ospf-rt6# save
Saving configuration to '/config/config.boot'...
Done
[edit]

we can pull the OID inetCidrRouteStatus.:

vyos@ospf-rt6:~$ sudo ps aux | grep snmpd
Debian-+    3214  3.0  3.0  35904 14952 ?        Ss   20:54   0:00 /usr/sbin/snmpd -LS0-5d -Lf /dev/null -u Debian-snmp -g Debian-snmp -f -p /run/snmpd.pid
vyos        3275  0.0  0.1   6180   664 ttyS0    S+   20:55   0:00 grep snmpd
vyos@ospf-rt6:~$ cat /etc/systemd/system/snmpd.service.d/override.conf
[Unit]
StartLimitIntervalSec=0
After=vyos-router.service

[Service]
Environment=
Environment="MIBDIRS=/usr/share/snmp/mibs:/usr/share/snmp/mibs/iana:/usr/share/snmp/mibs/ietf:/usr/share/vyos/mibs"
ExecStart=
ExecStart=/usr/sbin/snmpd -LS0-5d -Lf /dev/null -u Debian-snmp -g Debian-snmp   -f -p /run/snmpd.pid
Restart=always
RestartSec=10


vyos@ospf-rt6:~$ snmpwalk -v2c -c public localhost .1.3.6.1.2.1.4.24.7.1.17
MIB search path: /home/vyos/.snmp/mibs:/usr/share/snmp/mibs:/usr/share/snmp/mibs/iana:/usr/share/snmp/mibs/ietf
Cannot find module (IANAifType-MIB): At line 13 in /usr/share/snmp/mibs/IF-MIB.txt
Did not find 'IANAifType' in module #-1 (/usr/share/snmp/mibs/IF-MIB.txt)
Cannot find module (IANA-RTPROTO-MIB): At line 12 in /usr/share/snmp/mibs/IP-FORWARD-MIB.txt
Did not find 'IANAipRouteProtocol' in module #-1 (/usr/share/snmp/mibs/IP-FORWARD-MIB.txt)
IP-FORWARD-MIB::inetCidrRouteStatus.ipv4."0.0.0.0".0.2.0.0.ipv4."192.168.122.1" = INTEGER: active(1)
IP-FORWARD-MIB::inetCidrRouteStatus.ipv4."10.10.1.0".24.3.0.0.3.ipv4."0.0.0.0" = INTEGER: active(1)
IP-FORWARD-MIB::inetCidrRouteStatus.ipv4."20.20.20.20".32.2.0.0.ipv4."10.10.1.2" = INTEGER: active(1)
IP-FORWARD-MIB::inetCidrRouteStatus.ipv4."172.16.30.0".24.3.0.0.6.ipv4."0.0.0.0" = INTEGER: active(1)
IP-FORWARD-MIB::inetCidrRouteStatus.ipv4."172.16.40.0".24.2.0.0.ipv4."10.10.1.2" = INTEGER: active(1)
IP-FORWARD-MIB::inetCidrRouteStatus.ipv4."192.168.122.0".24.3.0.0.2.ipv4."0.0.0.0" = INTEGER: active(1)
IP-FORWARD-MIB::inetCidrRouteStatus.ipv4."192.168.190.0".24.2.0.0.ipv4."10.10.1.2" = INTEGER: active(1)

Thanks for add this feature very useful for our customer