thresholdmon AttributeError crash

Bug #1422316 reported by Morten Brekkevold
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Network Administration Visualized
Fix Released
Medium
Morten Brekkevold

Bug Description

The fix for bug 1316608, introduced in NAV 4.3.3, enables the nav.metrics.lookup() function to return objects that are not Django models.

The threshold monitor makes the assumption that all looked-up objects from this API are Django model objects, causing the threshold monitor to crash when generating some threshold events. For example, when a "CPU" threshold is exceeded, the object returned by the lookup API will be a string or unicode object, causing an attribute access to fail.

The traceback from cron mail looks like this:

Traceback (most recent call last):
  File "/usr/lib/nav/thresholdmon", line 16, in <module>
    main()
  File "/usr/lib/python2.7/dist-packages/nav/thresholdmon.py", line 47, in main
    scan()
  File "/usr/lib/python2.7/dist-packages/nav/thresholdmon.py", line 86, in scan
    evaluate_rule(rule, alerts)
  File "/usr/lib/python2.7/dist-packages/nav/thresholdmon.py", line 135, in evaluate_rule
    end_event(rule, metric, value)
  File "/usr/lib/python2.7/dist-packages/nav/thresholdmon.py", line 167, in end_event
    event = make_event(False, rule, metric, value)
  File "/usr/lib/python2.7/dist-packages/django/db/transaction.py", line 224, in inner
    return func(*args, **kwargs)
  File "/usr/lib/python2.7/dist-packages/nav/thresholdmon.py", line 183, in make_event
    _add_subject_details(event, metric, varmap)
  File "/usr/lib/python2.7/dist-packages/nav/thresholdmon.py", line 195, in _add_subject_details
    table=getattr(obj, '_meta').db_table,
AttributeError: 'unicode' object has no attribute '_meta'

Tags: thresholdmon
Revision history for this message
Morten Brekkevold (mbrekkevold) wrote :
Changed in nav:
status: Confirmed → Fix Committed
Changed in nav:
status: Fix Committed → Fix Released
Changed in nav:
milestone: 4.2.4 → 4.2.5
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.