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

[BUG] snmptrapd logs error on every trap received #2497

Closed
lunkwill42 opened this issue Nov 10, 2022 · 1 comment · Fixed by #2498
Closed

[BUG] snmptrapd logs error on every trap received #2497

lunkwill42 opened this issue Nov 10, 2022 · 1 comment · Fixed by #2498
Assignees
Milestone

Comments

@lunkwill42
Copy link
Member

Describe the bug

In NAV 5.5.1, snmptrapd has stopped working. Every received trap causes an exception+traceback to be logged.

It appears a syntax error somehow got into #2461 without any errors being triggered in the CI pipeline. This also needs to be looked at.

Expected behavior

Traps should be processed as before.

Screenshots

Tracebacks

snmptrapd.log is full of these:

Exception in _callback 'str' object is not callable
Traceback (most recent call last):
  File "/opt/venvs/nav/lib/python3.7/site-packages/pynetsnmp/netsnmp.py", line 464, in _callback
    sess.callback(pdu.contents)
  File "/opt/venvs/nav/lib/python3.7/site-packages/nav/snmptrapd/agent_pynetsnmp.py", line 221, in callback
    self._callback(addr, pdu)
  File "/opt/venvs/nav/lib/python3.7/site-packages/nav/snmptrapd/agent_pynetsnmp.py", line 130, in callback
    self._client_callback(trap)
  File "/usr/sbin/snmptrapd.py", line 234, in trap_handler
    _log_trap_handle_result(handled_by, trap)
  File "/usr/sbin/snmptrapd.py", line 239, in _log_trap_handle_result
    trap.netbox.sysname + ' ({})'.format(trap.agent) if trap.netbox else trap.agent
  File "/opt/venvs/nav/lib/python3.7/site-packages/nav/snmptrapd/trap.py", line 88, in netbox
    setattr(self, '_netbox', self._lookup_agent())
  File "/opt/venvs/nav/lib/python3.7/site-packages/nav/snmptrapd/trap.py", line 73, in _lookup_agent
    self.agent,
TypeError: 'str' object is not callable

Environment (please complete the following information):

  • NAV 5.5.1
  • Installed as Debian package
@lunkwill42 lunkwill42 added the bug label Nov 10, 2022
@lunkwill42 lunkwill42 added this to the 5.5.2 milestone Nov 10, 2022
@lunkwill42 lunkwill42 self-assigned this Nov 10, 2022
lunkwill42 added a commit to lunkwill42/nav that referenced this issue Nov 10, 2022
This detects the problem described by Uninett#2497
@lunkwill42 lunkwill42 linked a pull request Nov 10, 2022 that will close this issue
@lunkwill42
Copy link
Member Author

Closed by #2498

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant