modoboa / modoboa-stats

Graphical statistics for Modoboa
MIT License
9 stars 13 forks source link

logparser fails to create RRD directory #40

Open tonioo opened 6 years ago

tonioo commented 6 years ago

From @cptMikky on March 5, 2018 23:14

Impacted versions

Steps to reproduce

root@server# /path/to/venv/bin/python /path/to/modoboa/instance/manage.py logparser

Current behavior

Traceback (most recent call last):
  File "./manage.py", line 22, in <module>
    execute_from_command_line(sys.argv)
  File "/srv/app/modoboa/venv/local/lib/python2.7/site-packages/django/core/management/__init__.py", line 364, in execute_from_command_line
    utility.execute()
  File "/srv/app/modoboa/venv/local/lib/python2.7/site-packages/django/core/management/__init__.py", line 356, in execute
    self.fetch_command(subcommand).run_from_argv(self.argv)
  File "/srv/app/modoboa/venv/local/lib/python2.7/site-packages/django/core/management/base.py", line 283, in run_from_argv
    self.execute(*args, **cmd_options)
  File "/srv/app/modoboa/venv/local/lib/python2.7/site-packages/django/core/management/base.py", line 330, in execute
    output = self.handle(*args, **options)
  File "/srv/app/modoboa/venv/local/lib/python2.7/site-packages/modoboa_stats/management/commands/logparser.py", line 588, in handle
    p.process()
  File "/srv/app/modoboa/venv/local/lib/python2.7/site-packages/modoboa_stats/management/commands/logparser.py", line 559, in process
    self.update_rrd(dom, t)
  File "/srv/app/modoboa/venv/local/lib/python2.7/site-packages/modoboa_stats/management/commands/logparser.py", line 257, in update_rrd
    self.lupdates[fname] = self.init_rrd(fname, m)
  File "/srv/app/modoboa/venv/local/lib/python2.7/site-packages/modoboa_stats/management/commands/logparser.py", line 215, in init_rrd
    *params)
rrdtool.OperationalError: Cannot create temporary file

RRD storage directory does not exist and logparser probably doesn't even try to create it.

Expected behavior

Parse log and create RRD files. Create the necessary directory structure and fail properly if that isn't possible.

Command works as expected after the directory is created manually.

Copied from original issue: modoboa/modoboa#1424

tonioo commented 6 years ago

@cptMikky I don't think the script should be responsible for creating the directory structure. A better option would be to ensure the directory exists when the global setting is modified. What do you think?

tonioo commented 6 years ago

From @cptMikky on March 8, 2018 21:30

Not sure. Directory structure, especially in /tmp is definitely a responsibility of the owner (the script in this scenario). As for other places, well, hard to tell, I have no single opinion.

However, a directory existence test and a (sane) error message would be enough I guess.

florealcab commented 3 years ago

I have the same issue on ubuntu 20.04 with modoboa 16.0. Which folder should I create please?

tonioo commented 3 years ago

@florealcab You can customize the folder in the admin panel (settings).

yannfill commented 1 year ago

I don't see anything related to statistics in the new or old admin.

In the old admin I get No preferences available.

In the new admin, no tab or option related to statistics.

I have followed all the steps in the README (install plugin, modify settings.py, restart gunicorn).

yannfill commented 1 year ago

Nervermind, I was looking at the wrong place. Configuration is in the modoboa menu in the old admin interface.

I had to add sudo policy because the cron command update_statistics wanted to launch this:

sudo -u vmail /usr/bin/doveadm pw -l

It also created a new file new_accounts.rrd, which I think I can ignore safely.