Page MenuHomeVyOS Platform

Enabling SNMP commit error
Closed, ResolvedPublicBUG

Description

[ service snmp ]
Traceback (most recent call last):
File "/usr/libexec/vyos/conf_mode/snmp.py", line 808, in <module>
  apply(c)
File "/usr/libexec/vyos/conf_mode/snmp.py", line 762, in apply
  with open(config_file_user, 'r') as f:
FileNotFoundError: [Errno 2] No such file or directory: '/var/lib/snmp/snmpd.conf'

[[service snmp]] failed
Commit failed

The config i added is:

set service snmp community <community> authorization 'ro'
set service snmp community <community> client 'ipv4-1'

With these 2 lines commit works but afterwards adding the third line does not work.
set service snmp community <community> client 'ipv4-2'

Details

Difficulty level
Normal (likely a few hours)
Version
1.3-rolling-202002080217
Why the issue appeared?
Other
Is it a breaking change?
Unspecified (possibly destroys the router)
Issue type
Bug (incorrect behavior)

Event Timeline

Most of the times when i try a second time it just works.

Unknown Object (User) added a subscriber: Unknown Object (User).Jan 1 2020, 9:05 PM

@Merijn, which exactly version are you using? Provide please show version output.

I have built the current branch this evening, version is 1.3.0-rolling because i named it that way.

hagbard changed the task status from Open to Confirmed.EditedJan 6 2020, 7:12 PM

Debian default snmp user is called Debian-snmp while the script tries to get the uid of the user snmp. Looks like that is the entire issue.

hagbard triaged this task as Normal priority.Jan 6 2020, 7:14 PM
hagbard changed the task status from Confirmed to Needs testing.Jan 6 2020, 7:46 PM

@Merijn https://github.com/vyos/vyos-1x/commit/78df0c46865b3af89d6bc327b4c1d08cc4450aff or tomorrows rolling, as you seem to compile it yourself is should now work out of the box when you install the new vyos-1x package.
(http://dev.packages.vyos.net/repositories/current/pool/main/v/vyos-1x/vyos-1x_1.3.0-16_all.deb)

@hagbard i tried testing by installing the package.
The service is running but not working correctly.
The following is shown:
Jan 07 10:25:54 server snmpd[9979]: /etc/snmp/snmpd.conf: line 10: Warning: Unknown token: smuxpeer.
Jan 07 10:25:54 server snmpd[9979]: /etc/snmp/snmpd.conf: line 11: Warning: Unknown token: smuxpeer.
Jan 07 10:25:54 server snmpd[9979]: /etc/snmp/snmpd.conf: line 12: Warning: Unknown token: smuxsocket.
Jan 07 10:25:54 server snmpd[9979]: notificationEvent OID: linkUp
Jan 07 10:25:54 server snmpd[9979]: /etc/snmp/snmpd.conf: line 21: Error: unknown notification OID
Jan 07 10:25:54 server snmpd[9979]: notificationEvent OID: linkDown
Jan 07 10:25:54 server snmpd[9979]: /etc/snmp/snmpd.conf: line 22: Error: unknown notification OID
Jan 07 10:25:54 server snmpd[9979]: /etc/snmp/snmpd.conf: line 23: Warning: Unknown token: monitor.
Jan 07 10:25:54 server snmpd[9979]: /etc/snmp/snmpd.conf: line 24: Warning: Unknown token: monitor.
Jan 07 10:25:54 server snmpd[9979]: net-snmp: 2 error(s) in config file(s)

The commit of the config was working this time.

@Merijn Can you please share the snmp part from your config?

hagbard changed the task status from Needs testing to In progress.Jan 7 2020, 8:08 PM

@hagbard

set service snmp community dummycomm authorization 'ro'
set service snmp community dummycomm client '8.8.8.8'
set service snmp community dummycomm client '8.8.4.4'
set service snmp contact '[email protected]'
set service snmp location 'Datacenter, City, Country'

@Merijn I tested with the latest rolling and can't reproduce the issue. From your error message yesterday it looks like your snmpd.conf has an issue. Can you copy that content as well?

With the config above, it should generate:

### Autogenerated by snmp.py ###

# non configurable defaults
sysObjectID 1.3.6.1.4.1.44641
sysServices 14
master agentx
agentXPerms 0777 0777
pass .1.3.6.1.2.1.31.1.1.1.18 /opt/vyatta/sbin/if-mib-alias

# linkUp/Down configure the Event MIB tables to monitor
# the ifTable for network interfaces being taken up or down
# for making internal queries to retrieve any necessary information
iquerySecName vyos347190737ff46520

# Modified from the default linkUpDownNotification
# to include more OIDs and poll more frequently
notificationEvent  linkUpTrap    linkUp   ifIndex ifDescr ifType ifAdminStatus ifOperStatus
notificationEvent  linkDownTrap  linkDown ifIndex ifDescr ifType ifAdminStatus ifOperStatus
monitor  -r 10 -e linkUpTrap   "Generate linkUp" ifOperStatus != 2
monitor  -r 10 -e linkDownTrap "Generate linkDown" ifOperStatus == 2

########################
# configurable section #
########################

# Default system description is VyOS version
sysDescr VyOS 1.3-rolling-202001081700



# Listen
agentaddress unix:/run/snmpd.socket,udp:161,udp6:161

# SNMP communities
rocommunity dummycomm 8.8.8.8
rocommunity dummycomm 8.8.4.4


# system contact information
SysContact [email protected]


# system location information
SysLocation Datacenter, City, Country




#
# SNMPv3 stuff goes here
#
# views

# access
#             context sec.model sec.level match  read    write  notif

# trap-target

# group

So I think you face an issue with the generated syntax in that file. You can also manully remove it and reboot, the vyos config will re-generate it (make a backup of the file first - no backup- no mercy :D)

Hang on, I see the error in syslog (only syslog), so at least I can reproduce it now.

Is this still an issue after the latest modifications (T1937) to SNMP wo fully run on Debian Buster?

hagbard added a subscriber: hagbard.
c-po raised the priority of this task from Normal to High.
c-po updated the task description. (Show Details)
c-po changed Difficulty level from Unknown (require assessment) to Normal (likely a few hours).
c-po changed Version from 1.3.0 to 1.3-rolling-202002080217.
c-po changed Why the issue appeared? from Will be filled on close to Other.

Please reopen if issue re-apperas

erkin set Issue type to Bug (incorrect behavior).Aug 31 2021, 5:58 PM