Snmptrapd fails to post link events if module name is unknown

Bug #1532701 reported by Morten Brekkevold
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Network Administration Visualized
Fix Released
Medium
Morten Brekkevold
4.3
Won't Fix
Medium
Morten Brekkevold
4.4
Fix Released
Medium
Morten Brekkevold

Bug Description

Logs from some customers indicate that the snmptrapd keeps failing to insert link events into the database, due to violations of a non-null constraint when inserting to the eventqvar table. This is the logged error message:

[2016-01-11 09:13:06,727] [ERROR] [pid=18141 nav.snmptrapd] Error when handling trap with nav.snmptrapd.handlers.linkupdown: null value in column "val" violates not-null constraint
Traceback (most recent call last):
  File "/usr/lib/nav/snmptrapd.py", line 278, in trapHandler
    accepted = mod.handleTrap(trap, config=config)
  File "/usr/lib/python2.7/dist-packages/nav/snmptrapd/handlers/linkupdown.py", line 52, in handleTrap
    modulename, ifname, ifalias)
  File "/usr/lib/python2.7/dist-packages/nav/snmptrapd/handlers/linkupdown.py", line 121, in post_link_event
    event.post()
  File "/usr/lib/python2.7/dist-packages/nav/event.py", line 62, in post
    return EventQ.post_event(self)
  File "/usr/lib/python2.7/dist-packages/nav/event.py", line 134, in post_event
    cursor.executemany(varsql, values)
IntegrityError: null value in column "val" violates not-null constraint

The corresponding logs from PostgreSQL look like this:

2016-01-11 09:13:06 CET ERROR: null value in column "val" violates not-null constraint
2016-01-11 09:13:06 CET STATEMENT: INSERT INTO eventqvar (eventqid, var, val)VALUES (3337984, 'module', NULL)

Reviewing the code of the linkupdown plugin reveals that it will attempt to store the module name regardless of whether it has any value. Since this is a transaction, most likely the entire event is aborted.

Tags: snmptrapd
Revision history for this message
Morten Brekkevold (mbrekkevold) wrote :
Changed in nav:
status: Confirmed → Fix Committed
Changed in nav:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.