Project

General

Profile

Bug #350

Agents tab: list index out of range

Added by Vitaly Tskhovrebov almost 15 years ago. Updated almost 15 years ago.

Status:
Resolved
Priority:
Normal
Target version:
Start date:
05/20/2009
Due date:
% Done:

100%

Resolution:

Description

  • app-admin/prelude-manager
    Latest version installed: 0.9.14.2
  • dev-libs/libprelude
    Latest version installed: 0.9.22
  • dev-libs/libpreludedb
    Latest version installed: 0.9.15.1
  • net-analyzer/prewikka
    Latest version installed: 0.9.14

Traceback (most recent call last):
File "/usr/lib/python2.6/site-packages/prewikka/Core.py", line 333, in process
getattr(view_object, view["handler"])()
File "/usr/lib/python2.6/site-packages/prewikka/views/sensor.py", line 115, in render
analyzerid = analyzer_path[-1]
IndexError: list index out of range

Please, help.
Other tabs Prewikka works good.

pre.tar.bz2 (12.4 KB) Vitaly Tskhovrebov, 06/05/2009 12:28 PM

prewikka-debug.diff View (739 Bytes) Yoann VANDOORSELAERE, 06/09/2009 11:15 AM

prewikka.diff View (22.7 KB) Yoann VANDOORSELAERE, 06/09/2009 12:40 PM

prewikka.diff View (38.7 KB) Yoann VANDOORSELAERE, 06/10/2009 11:08 AM

prewikka.PNG View (21.3 KB) Vitaly Tskhovrebov, 06/10/2009 12:18 PM

Associated revisions

Revision 78826d2f (diff)
Added by Yoann VANDOORSELAERE almost 15 years ago

Analyzer retrieval fixes and speedup.

Make the database requests used to generate the agents view simpler,
which should provide a minor speedup. Make the getAnalyzer() function
simpler. Prevent failure in case an analyzer has no analyzerID set.

Fixes #350.

History

#1 Updated by Yoann VANDOORSELAERE almost 15 years ago

Could you please enable SQL query logging, and report the error logs here ?

You can do this by editing the [idmef_database] section in the prewikka.conf configuration file, adding:

log: /tmp/prewikka.log

#2 Updated by Yoann VANDOORSELAERE almost 15 years ago

  • Status changed from New to Feedback
  • Assignee set to Yoann VANDOORSELAERE
  • Target version set to 0.9.15

#3 Updated by Vitaly Tskhovrebov almost 15 years ago

Here it is.

Explanation - log turned on, then i've gone to the prewikka's homepage, then Agents.

#4 Updated by Yoann VANDOORSELAERE almost 15 years ago

For one reason or another, there seem to be an analyzer with an empty ID.
In order to confirm this, could you please apply the attached patch, and report the prewikka-httpd output when going to the agent view?

#5 Updated by Vitaly Tskhovrebov almost 15 years ago

I believe you're right, because there was one agent incorrectly added. But there's no option anywere to remove agents, and i didn't find any solutions to remove it directly.

The traceback now is the same:
Traceback (most recent call last):
File "/usr/lib/python2.6/site-packages/prewikka/Core.py", line 333, in process
getattr(view_object, view["handler"])()
File "/usr/lib/python2.6/site-packages/prewikka/views/sensor.py", line 115, in render
analyzerid = analyzer_path[-1]
IndexError: list index out of range

I have an access to pgsql directly, so please tell me the right place to look for misconfigured agent?

Anyway, prewikka should not lock up on this issue. :-)

#6 Updated by Yoann VANDOORSELAERE almost 15 years ago

The attached patch should fixes the problem, as well as making the agents view load a little faster.

Once the patch is applied, please let me know:
  • Whether you can see the offending analyzer in the generated agent list.
  • Whether deleting this analyzer succeed.

#7 Updated by Vitaly Tskhovrebov almost 15 years ago

The Show Must go on, Yoann.

Traceback (most recent call last):
File "/usr/lib/python2.6/site-packages/prewikka/Core.py", line 333, in process
getattr(view_object, view["handler"])()
File "/usr/lib/python2.6/site-packages/prewikka/views/sensor.py", line 114, in render
analyzer = self.env.idmef_db.getAnalyzer(analyzerid)
File "/usr/lib/python2.6/site-packages/prewikka/IDMEFDatabase.py", line 539, in getAnalyzer
analyzerd[column] = analyzer[column]
TypeError: 'NoneType' object is unsubscriptable

#8 Updated by Yoann VANDOORSELAERE almost 15 years ago

Thanks for the quick feedback,

On line 526, immediately after:

        for analyzer in heartbeat["analyzer"]:

Could you please insert:

            print "A=", analyzer
            print "N=", analyzer["name"]
            print "I=", analyzer["analyzerid"]

And provides the prewikka-httpd output?

#9 Updated by Vitaly Tskhovrebov almost 15 years ago

We will continue tomorrow, Yoann. Thanks for your support!

#10 Updated by Vitaly Tskhovrebov almost 15 years ago


Traceback (most recent call last):
File "/usr/lib/python2.6/site-packages/prewikka/Core.py", line 333, in process
getattr(view_object, view["handler"])()
File "/usr/lib/python2.6/site-packages/prewikka/views/sensor.py", line 114, in render
analyzer = self.env.idmef_db.getAnalyzer(analyzerid)
File "/usr/lib/python2.6/site-packages/prewikka/IDMEFDatabase.py", line 542, in getAnalyzer
analyzerd[column] = analyzer[column]
TypeError: 'NoneType' object is unsubscriptable

#11 Updated by Yoann VANDOORSELAERE almost 15 years ago

Updated patch attached. This should at least allow you to get a working agent view (although deleting an Agent with an empty ID will require manual database operation at the moment).

#12 Updated by Vitaly Tskhovrebov almost 15 years ago

I haven't any *.tmpl files. Cannot apply patch correctly.

spbsec02 templates # pwd
/usr/lib/python2.6/site-packages/prewikka/templates
spbsec02 templates # ls -l
total 364
-rw-r--r-- 1 root root 17386 May 15 17:33 About.py
-rw-r--r-- 1 root root 69668 May 15 17:33 AlertListing.py
-rw-r--r-- 1 root root 15392 May 15 17:33 ClassicLayout.py
-rw-r--r-- 1 root root  5314 May 15 17:33 Command.py
-rw-r--r-- 1 root root 11105 May 15 17:33 ErrorTemplate.py
-rw-r--r-- 1 root root 15985 May 15 17:33 FilterEdition.py
-rw-r--r-- 1 root root  6703 May 15 17:33 HTMLDocument.py
-rw-r--r-- 1 root root  9888 May 15 17:33 HeartbeatAnalyze.py
-rw-r--r-- 1 root root 13817 May 15 17:33 HeartbeatListing.py
-rw-r--r-- 1 root root  7908 May 15 17:33 LoginPasswordForm.py
-rw-r--r-- 1 root root  8503 May 15 17:33 MessageDetails.py
-rw-r--r-- 1 root root 37675 May 15 17:33 MessageListing.py
-rw-r--r-- 1 root root 15901 May 15 17:33 MessageSummary.py
-rw-r--r-- 1 root root  7879 May 15 17:33 PropertiesChangeForm.py
-rw-r--r-- 1 root root  5478 May 15 17:33 SensorAlertListing.py
-rw-r--r-- 1 root root  5504 May 15 17:33 SensorHeartbeatListing.py
-rw-r--r-- 1 root root 30105 May 15 17:33 SensorListing.py
-rw-r--r-- 1 root root  7182 May 15 17:33 TopLayout.py
-rw-r--r-- 1 root root  9337 May 15 17:33 UserListing.py
-rw-r--r-- 1 root root 16593 May 15 17:33 UserSettings.py
-rw-r--r-- 1 root root     0 Mar  4  2008 __init__.py
-rw-r--r-- 1 root root  7891 May 15 17:33 utils.py

#13 Updated by Yoann VANDOORSELAERE almost 15 years ago

Vitaly Tskhovrebov wrote:

I haven't any *.tmpl files. Cannot apply patch correctly.

You should apply the patch on top of a Prewikka-0.9.14 source tree, then run:

python setup.py install

So that the patched source base is installed.

#14 Updated by Vitaly Tskhovrebov almost 15 years ago

Ok, i've got a picture of some misconfigured analyzers. How to remove them?

#15 Updated by Yoann VANDOORSELAERE almost 15 years ago

Vitaly Tskhovrebov wrote:

Ok, i've got a picture of some misconfigured analyzers. How to remove them?

preludedb-admin delete heartbeat "type=mysql user=prelude pass=prelude name=prelude" --criteria '! heartbeat.analyzer.analyzerid'

Note: do this only for heartbeat. Doing it for alert will delete LML events.
Note

#16 Updated by Yoann VANDOORSELAERE almost 15 years ago

  • Status changed from Feedback to Resolved
  • % Done changed from 0 to 100

Also available in: Atom PDF