Tuesday, November 10, 2009

ntop and RRD

"ntop" conveniently displays web pages with charts and plots of your local network traffic. To record historical traffic, it uses Round Robin Database (rrd). The default ntop package enables the RRD plugin, but doesn't give itself permission to write out its data. Here's how to get the two to work:

sudo apt-get install ntop
sudo install -d /var/lib/ntop
sudo install -o nobody -d /var/lib/ntop/interfaces
sudo install -o nobody -d /var/lib/ntop/rrd
To test, start "sudo ntop" (probably in "screen"), then open the web page http://localhost:3000

To activate the RRD plugin, select Plugins / Round Robin / Describe, then click the red "no" to become a blue "yes." You'll see messages in the terminal where you started ntop.

After a few moments, you can view RRD graphs. One is in Summary / Network Load.

2 comments:

  1. Thanks - I had the same issues with ntop in Ubuntu 10.04 and appropriate use of chown, based on your suggestions, saved the day for me.

    ReplyDelete
  2. ...although as a PS:

    When you run ntop from the command line in Ubuntu it appears to run as nobody.

    But if you start it using the script in /etc/init.d then it pulls in config values from /etc/default/ntop which in turn pulls in the /var/lib/ntop/init.cfg (which sets the user as ntop).

    So I had to change the value in init.cfg as well. And then ntop complained that the /var/lib/ntop directory itself was owned by ntop rather than nobody.

    In the end I think it might have been simpler for me to run it as user ntop - which is probably what the original packagers had in mind.

    I think the reason for the confusion is that, run interactively from the command line, it attempts to run as user nobody, but run from the init.d script it attempts to run as user ntop. The first thing you do when trying to debug the problem is to run from the command line... and that changes its behaviour!

    ReplyDelete