Page MenuHomePhabricator

Enabling SNMP commit error
In progress, NormalPublicBUG

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
Unknown (require assessment)
Version
1.3.0
Why the issue appeared?
Will be filled on close
Is it a breaking change?
Perfectly compatible

Event Timeline

Merijn created this task.Wed, Jan 1, 8:36 PM
Merijn added a comment.Wed, Jan 1, 8:45 PM

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

Dmitry added a subscriber: Dmitry.Wed, Jan 1, 9:05 PM

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

Merijn added a comment.Wed, Jan 1, 9:07 PM

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

pasik added a subscriber: pasik.Thu, Jan 2, 8:31 AM
hagbard claimed this task.Mon, Jan 6, 7:07 PM
hagbard changed the task status from Open to Confirmed.EditedMon, Jan 6, 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.Mon, Jan 6, 7:14 PM
hagbard changed the task status from Confirmed to Needs testing.Mon, Jan 6, 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)

Merijn added a comment.EditedTue, Jan 7, 9:30 AM

@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.Tue, Jan 7, 8:08 PM
Merijn added a comment.Wed, Jan 8, 5:30 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 'noreply@nowhere.com'
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 noreply@nowhere.com


# 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.